Virtualize : Map DB Tool Result Sets To XML Response

bsaikrishna84bsaikrishna84 Posts: 46

How to map multiple rows returned from resultSet to the XML response ?

We have a SOAP Message responder having below xml response. I need to parameterize the account numbers in the response

 <findTransactions>
 <transactions><accountNumber></accountNumber></transactions>
 </findTransactions>

In the above xml response the transactions tag will repeat based on the list of accountNumbers added.

I chained a DB tool to the responder. Once the query is executed the resultSet will return the rows with accountNumbers. I need to map all the accountNumbers to the above response. I used XML Databank but I could only save one account number. Is there a way to copy list of account numbers and add them to the response dynamically ?

If I get 10 rows in the result set then the response should have like below.

 <findTransactions>
 <transactions><accountNumber>34857384753</accountNumber></transactions
 <transactions><accountNumber>324523452345</accountNumber></transactions>
 <transactions><accountNumber>2345345345</accountNumber></transactions>
 <transactions><accountNumber>345345345</accountNumber></transactions>
 <transactions><accountNumber>3453453453</accountNumber></transactions>
 <transactions><accountNumber>345435345345</accountNumber></transactions>
 <transactions><accountNumber>34234234456</accountNumber></transactions>
 <transactions><accountNumber>567856785678</accountNumber></transactions>
 <transactions><accountNumber>45764567567</accountNumber></transactions>
 <transactions><accountNumber>567456745675</accountNumber></transactions>
 </findTransactions>

Comments

  • williammccuskerwilliammccusker Posts: 154 ✭✭

    Hi,
    One idea would be to use the Multiple Response generator from marketplace to process each row return from the db and insert the appropriate xml fragment into the response.

    Here is a link to the custom tool and it has documentation on how to use it.
    https://marketplace.parasoft.com/#query?limit=24&amp;offset=0&amp;keywords=multiple response

  • bsaikrishna84bsaikrishna84 Posts: 46
    edited July 23

    Thanks William. But I could see that Multiple response generator is designed to send multiple occurrences of fields from the input to the backend url so that we receive aggregate response in xml.
    This means sending send multiple customer Id's at once so that it will loop over the Id and get the specific account related to that id. This returns only one account. Not list of accounts .

    My requirement is when I send only one customer I'd to the responder it should send the account numbers which are linked to that specific customer.
    I have a responder and a db tool which is chained to it. As soon as I hit the responder db query will execute and return multiple rows. But to get the list of account numbers or rows in the response is challenge here.

    Could you share if you know any other idea ?

  • williammccuskerwilliammccusker Posts: 154 ✭✭

    Hi,
    Why doesn't it work to chain the multiple response generator to the db tool? That should be able to process each row and return an aggregate of all the accounts. Then data bank that aggregated result and parameterize the response payload with it.

    If this is not working it might be easier if you could contact [email protected] so that someone can work directly with you.

  • bsaikrishna84bsaikrishna84 Posts: 46

    Thanks William. I have raised a support request.

Sign In or Register to comment.