cancel
Showing results for 
Search instead for 
Did you mean: 

Combine Two Files and sent to webservice

Former Member
0 Kudos

Hi all,

I need to read two files and combine in XI and i need to send it to webservice.

can anyone please tell me which way is the better.

kind regards,

Praveen

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello Kiran,

this is only a little bit of information about your problem but I will try to answer.

Your web service expects a structure.

If this structure fits to the file from the sender and you have to add only two files into one web service connect I would use a BPM with a loop step managed by a counter to collect always two messages from the sender via mapping into a multiline container (web service interface has to accept then multiline message).

In the loop step change your counter variable (container) by adding 1 for each loop start to leave the loop step after collecting two messages into the web service message.

Hope this helps!

If not, tell more about your issue!

Best regards

Dirk

Former Member
0 Kudos

hi

i am reading two different file structures and i need to map it to webservice structure.

i did all design and config steps including BPM also. i used fork step with two receivers and transformation step and send step.

but in the mapping iam getting only first file message only.

This is source message

<?xml version="1.0" encoding="UTF-8"?>

<ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">

<ns0:Message1>

<ns1:Test_result_MT xmlns:ns1="http://lonmin.co.za/GetServeyData">

<Details>

<x>10</x>

<y>aaa</y>

</Details>

<Details>

<x>20</x>

<y>bbb</y>

</Details>

</ns1:Test_result_MT>

</ns0:Message1>

<ns0:Message2>

<ns1:Test_result_MT xmlns:ns1="http://lonmin.co.za/GetServeyData">

<Details>

<x>30</x>

<y>ccc</y>

</Details>

<Details>

<x>40</x>

<y>ddd</y>

</Details>

</ns1:Test_result_MT>

</ns0:Message2>

</ns0:Messages>

Target Messgae must be like this

<?xml version="1.0" encoding="UTF-8"?>

<ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">

<ns0:Message1>

<ns1:Test_final_MT xmlns:ns1="http://lonmin.co.za/GetServeyData">

<Details>

<x>10</x>

<y>aaa</y>

</Details>

<Details>

<x>20</x>

<y>bbb</y>

</Details>

<Details>

<x>30</x>

<y>ccc</y>

</Details>

<Details>

<x>40</x>

<y>ddd</y>

</Details>

</ns1:Test_final_MT></ns0:Message1></ns0:Messages>

i am giving source and target message can any one please tell me which elements i must map to get this target structure.

Edited by: Kiran Kumar on Dec 19, 2007 1:21 PM

Former Member
0 Kudos

I did map source Details to target Details and the context i set to root node messages. but still i am getting only first message only.

I am dam struck here can any one please help me out of this issue.

Answer will be rewarded.

Kind Regards,

kiran

Former Member
0 Kudos

Hi,

In order to make a single file You have to merge these two files using BPM, that you have already done.

Step 1. In message Mapping you have two messages (Message1 and Message2) both containing DETAILS Node.So you need to count the occurrences of Details node of each message and then add both resultant Counts and pass this final count to target DETAILS Node.

So Target DETAIL Node will generate as many times as youn have sum of both the COUNTS on Source side.

Step 2. Now we need to pass the values of X and Y.

if we have two values of X in Message1 and three values of X in message 2 then we need to generate target X 5 times.

So, write a UDF and pass both source X values to it and pass these values to target X using for loop in UDF .

Step 3. using same UDF generated above ,pass two source Y nodes to it and pass the result to target Y..

This willl solve your query.

For Helpful answers rewards Points.

former_member182412
Active Contributor
0 Kudos

Hi anurag

for details i did count details in message1 and details in message2 and i added both of the and i map it to target details node but still only one detail is coming in target side.

message1 detail->count--


>

add---->target detail

message2 detail---->count--


>

Can you please please supply me the UDF code for generate X.

Kind Regards,

kiran

Edited by: Praveen Kumar on Dec 19, 2007 4:43 PM

Answers (0)