Any ideas about the exchange between this two document type

hi,everyone

who can give me the any ideas or samples about the exchange between document type A & B following?

it’s urgent,thanks in advance!

A:

<head>
<messagetype>StudentScore</messagetype>
<version>1.0</version>
<item>
<property>
<name>id</name>
<value>Jim</value>
</property>
<property>
<name>age</name>
<value>18</value>
</property>
<property>
<name>score</name>
<value>95</value>
</property>
</item>
<item>
<property>
<name>id</name>
<value>Jake</value>
</property>
<property>
<name>age</name>
<value>14</value>
</property>
<property>
<name>score</name>
<value>95</value>
</property>
</item>
<item>
<property>
<name>id</name>
<value>Kate</value>
</property>
<property>
<name>age</name>
<value>18</value>
</property>
<property>
<name>score</name>
<value>61</value>
</property>
</item>
<item>
<property>
<name>id</name>
<value>Tom</value>
</property>
<property>
<name>age</name>
<value>16</value>
</property>
<property>
<name>score</name>
<value>100</value>
</property>
</item>
</head>

B:

<message>
<messagetype>StudentScore</messagetype>
<version>1.0</version>
<record>
<id>Jim</id>
<age>18</age>
<score>95</score>
</record>
<record>
<id>Jake</id>
<age>14</age>
<score>95</score>
</record>
<record>
<id>Kate</id>
<age>18</age>
<score>61</score>
</record>
<record>
<id>Tom</id>
<age>16</age>
<score>100</score>
</record>
</message>

Lynn.

Can you please elaborate more on the above query in detail?What is ur exact requirement and trying to do?

Do you have to do mapping from A to B and viceversa and process it to backend?

So that we can try to help accordingly.

HTH,
RMG

RMG,thanks for your kind response.

yes,i want to develop a flow service with input document type A and output document type B,and viceversa.

i had tried to use service “recordlistToRecord”,and “appendToRecordList” in a loop for mapping from A to B,but it failed ,I can only get last one record in B from A.

Lynn:

You need to create a new B record for each iteration of the loop. If you will always map all A records to the new B list, then using an in-array and out-array will be the most efficient approach. If you need to be selective with which A records get mapped, then use appendToRecordList (caution: this is a bad approach for large lists). You don’t need recordListToRecord.

Review these threads for more info on looping over one record list to create another record list.

[url=“wmusers.com”]wmusers.com
[url=“wmusers.com”]wmusers.com

Lynn,

Create a new B message Document(list) and try using the Loop on (In-Array(head/item/property) and Out-Array(message/record) approach and inside the loop you will see the A of head/Item/Property as document and also message/record as document instead of documentlist and so map the fields from A to B.Step thru the loop and make sure the results/pipeline as expected.

HTH,
RMG.

Rob & RMG,thanks for your kind help

I’ve resolved the problem with your help!