I have an Order Request which contains Item Collections - shown below
Each Item is saved as a single record in the database table which are bound together by OrderId for a specific Order
Request with two items
<orderRequest>
<orderTimestamp>
<!--1 or more repetitions:-->
<items>
<item>
</itemName>
</quantity>
</unitPrice>
</item>
<item>
</itemName>
</quantity>
</unitPrice>
</item>
</items>
</orderRequest>
I am using a DataSource step to pull the data from Database using a Query and have mapped the values from the query results onto the request elements.
However by doing this I am only able to add one item to the order request. Is there a way I can dynamically add objects to the item collection based on the number of rows being returned for a specific orderID?
Edit For Example purpose, I have taken sample values for two order Step 1: DataSource Step. Count in the first column defines the number of item for a given Order ID. Essentially the number of Item Collection to be added
Step 2: The SOAP Request Step - The elements value are directly mapped to the Datasource Step's column. However as indicated above, we would need to add the collection based on the number of items for a given order Ex: Order ID 1 has 2 items, Order ID 2 has 4 items. So two requests have to made, one with 2 item and second with 4 items. Currently though I have mapped it directly
<orderRequest>
<orderTimestamp>${OrderData#orderTimestamp}</orderTimestamp>
<!--1 or more repetitions:-->
<items>
<item>
<itemName>${OrderData#itemName}</itemName>
<quantity>${OrderData#quantity}</quantity>
<unitPrice>${OrderData#unitPrice}</unitPrice>
</item>
</items>
</orderRequest>
Step 3: DataSource Loop Step - This essentially loops through the above two steps for all data in the Datasource Step. So if I run as is, it will make 6 requests with one item each