Virtualize : Map DB Tool Result Sets To XML Response
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
-
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&offset=0&keywords=multiple response0 -
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 ?
0 -
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 support@parasoft.com so that someone can work directly with you.
0 -
Thanks William. I have raised a support request.
0