Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Loop through tSOAP components

Hi,
I am trying to create a Talend job, that requires a lot of SOAP calls. I need to use a tSOAP using an ID (within the message bosy) to fetch a response, that I am using to iterate over XPath (tExtractXML). This response may contain more IDs, which I should use to further call the same tSOAP.
An example,
tSOAP calls first time by supplying an ID = 1. The response returned consists of two further IDs (under certain XPath) say ID = 2 and ID = 3. Now I want to iterate over the same tSOAP using ID = 2. This may further return an ID = 4. So essentially, then for ID = 3, tSOAP should be called, and if no further XPath is present then ID = 4 and so on..
I am stuck at how to proceed. Should I go with ArrayList? Or should I store them in a XML file, and just provide a Loop query?
Further, once I retrieve all these IDs, I need to call tSOAPs (different) again, to fetch further responses, so I need this list of IDs somehow.
Labels (4)
3 Replies
Anonymous
Not applicable
Author

Hi
When or what is the condition for the exit of the loop? Does the response may not contains IDs?
Shong
alevy
Specialist
Specialist

This looks like it can be solved in a similar way to https://community.talend.com/t5/Design-and-Development/resolved-Loop-a-tFileFetch/td-p/115073 but instead of using a simple boolean goagain to control the tLoop, use an ArrayList to hold the IDs you need to call, delete each one when calling it and loop until the ArrayList is empty.
You can have a second ArrayList that just holds all the IDs you call for use in your later tSOAPs. See https://community.talend.com/t5/Design-and-Development/resolved-Transitivity-Problem/td-p/116006 for an example of iterating over an ArrayList.
Anonymous
Not applicable
Author

Thanks alevy, I am giving it a go using tJavaFlex and ArrayList. I've created a 'for' loop in tJavaFlex, and encompassed the entire SOAP call and the tExtractXML components in it.
Further, if I find an ID I am adding the ID to the Array List using tJavaRow, and the next time loop runs it automatically fetches the added IDs, if any (as it's dynamic in size), and processes the next SOAP call.
Shong,
The condition of the exit loop is when I have finally extracted all the IDs at some point. Some response may not contain IDs as well.