Forum Discussion

AngieD's avatar
AngieD
Occasional Contributor
13 years ago

Populating repeating XML sections from Datasource

Hi. I have an XML request that has several sections. Once of the sections has repeating data. I am stuck on how to populate the repeating sections when the data is coming from one datasource.

In this example the <microchip> section is repeating. I have a response that includes the micochip information. I am using a datasource to pull the information from the response, but I can only get one set of data (microchipID, model and assign date) at a time. I am doing all kinds of crazy things [Multiple datasources, GroovyScript, etc.] to do this. There must be an easier way.


Request:
<chip>
<owner>
<id></id>
<name></name>
<microchip>
<microchipID></microchipID>
<microchipModel></microchipModel>
<assignDate></assignDate>
</microchip>
<microchip>
<microchipID></microchipID>
<microchipModel></microchipModel>
<assignDate></assignDate>
</microchip>
<microchip>
<microchipID></microchipID>
<microchipModel></microchipModel>
<assignDate></assignDate>
</microchip>
</owner>
</chip>

Thank you,
Angie

3 Replies

  • AngieD's avatar
    AngieD
    Occasional Contributor
    Hi Ole,
    Thank you for the quick response.

    I've been playing with the DataSink, which is pretty handly. But I am having a data issue. This is what I have:
    1. Request [Which brings in all of my items]
    2. Property Transfer
    3. DataSink [Which creates XML section]
    4. Request

    I would like to pull x number of items from the request (step 1.) to be inserted into the next request (step 4.). I've been able to get the data sink to create the XML section I want, but I am always getting the same data. I tried adding a loop (after the datasink returning to the property transfer) , but I keep getting the same data added multiple times to the XML. The problem is the property transfer or data sink but I can't figure out what.

    What am I doing wrong?
    Thank you,
    Angie
  • Hi Angie,

    if you want to transfer a block of XML from the response of the first step to the request of the last step maybe a property-transfer is easier to use? If the XML needs to be "augmented" during the transfer you could use the XQuery option of the property-transfer to do this..

    Does that make sense?

    regards!

    /Ole
    SmartBear Software