• 1 reply
  • Latest Post - ‏2014-08-04T22:16:10Z by M3NG_Richard_Wolters
1 Post

Pinned topic Appending data to XML File

‏2012-09-12T17:20:10Z |
Hello all,

I have an orchestration which accepts the XML String(bulk data) as input inside the body of HTTP Request. I'll parse the input to XML and store it in a local variable. Now, I use the local variable to iterate through the data inside XML and invoke the outside service and get the related Data and store it in the form of XML(another local variable). Here, as I am iterating through the list of data from XML input, I am not getting any ideas of how to store the results from the external webservice into a list. When i run this orchestration, I could see the result of only the last record in the input XML and the others are skipped.

Thanks and regards,
  • M3NG_Richard_Wolters
    18 Posts

    Re: Appending data to XML File


    IBM came up with a  workaround for this years ago, as far as I know there's still no better way to do it.

    For the first record in your list, map straight across like you would normally.  For the subsequent records:

    1.)  On your recurring XML 'list' element in the output, right click on the recurring node and select 'expand occurrences', set to 1 and select ok.

    2.)  Put your same XML 'list' element in the map inputs section, map the list element from input to output.  

    3.) Put your XML response as an additional input variable, and map that to the additional instance of the XML 'list' element created in step 1


    I usually do an if-then with these two mappings.  E.g.

    if (first record in list) {
    input(XML Result(single)) --> output (XML List(recurring))
    else {
    input(XML List(recurring)) --> output (XML List(recurring))
    input(XML Result(single)) --> output (XML List (single expanded occurrence))