ForEachLoop with rowsets
Post any question you may have in regards to GoAnywhere Director and let our talented support staff and other users assist you.
5 posts
Page 1 of 1
- Posts: 17
- Joined: Thu May 08, 2014 2:07 am
Hi,
I have a read xml task that reads an xml file and output data into a rowset variable with columns defined like the xml file. I created a ForEachLoop with Items Variable as name of the rowset ${Tokens} and Current Item Variable as Row. But when I execute my project, the ForEachLoop ends with the below message:
(Read xml task completes successfully, but the Loop encounter an error)
Job Log
5/28/14 4:33:36 PM INFO Executing task 'xmlRead 1.0 (Read Tokens)'
5/28/14 4:33:36 PM INFO Data parsed successfully and the rowset variable(s) 'Tokens' were created
5/28/14 4:33:36 PM INFO Finished task 'xmlRead 1.0 (Read Tokens)'
5/28/14 4:33:36 PM INFO Entering loop 'forEachLoop'
5/28/14 4:33:44 PM INFO Finished project 'AUTO_RNW_REG'
5/28/14 4:33:44 PM ERROR [9006 - Read Tokens] When building rowset "Tokens", the root element did not match in the file "smb://dta05100p03/General/iSeries Downloads - Test/AUTO_RNW/SoapResponse/TokenResponse.xml".
com.linoma.dpa.runtime.JobFailedException: [9006 - Read Tokens] When building rowset "Tokens", the root element did not match in the file "smb://dta05100p03/General/iSeries Downloads - Test/AUTO_RNW/SoapResponse/TokenResponse.xml".
at com.linoma.dpa.runtime.Job.run(Unknown Source)
I have a read xml task that reads an xml file and output data into a rowset variable with columns defined like the xml file. I created a ForEachLoop with Items Variable as name of the rowset ${Tokens} and Current Item Variable as Row. But when I execute my project, the ForEachLoop ends with the below message:
(Read xml task completes successfully, but the Loop encounter an error)
Job Log
5/28/14 4:33:36 PM INFO Executing task 'xmlRead 1.0 (Read Tokens)'
5/28/14 4:33:36 PM INFO Data parsed successfully and the rowset variable(s) 'Tokens' were created
5/28/14 4:33:36 PM INFO Finished task 'xmlRead 1.0 (Read Tokens)'
5/28/14 4:33:36 PM INFO Entering loop 'forEachLoop'
5/28/14 4:33:44 PM INFO Finished project 'AUTO_RNW_REG'
5/28/14 4:33:44 PM ERROR [9006 - Read Tokens] When building rowset "Tokens", the root element did not match in the file "smb://dta05100p03/General/iSeries Downloads - Test/AUTO_RNW/SoapResponse/TokenResponse.xml".
com.linoma.dpa.runtime.JobFailedException: [9006 - Read Tokens] When building rowset "Tokens", the root element did not match in the file "smb://dta05100p03/General/iSeries Downloads - Test/AUTO_RNW/SoapResponse/TokenResponse.xml".
at com.linoma.dpa.runtime.Job.run(Unknown Source)
- Support Specialist
- Posts: 590
- Joined: Tue Jul 17, 2012 2:12 pm
- Location: Phoenix, AZ
-
Reading the XML file is just a matter of utilizing a Well-Formed XML file and identifying the path to the values you need to retrieve.
The example that was sent for the ResponseCode/ResponseMessage ... would look something like this:
The example that was sent for the ResponseCode/ResponseMessage ... would look something like this:
Code: Select all
This is based on the XML file as such:<project name="ReadXML" mainModule="Main" version="2.0" logLevel="debug">
<module name="Main">
<xmlRead label="Read Response XML" file="C:\Users\relliott\Documents\Customers\Gensys\TokenResponse2.xml" defaultTrim="both" version="1.0" logLevel="verbose" disabled="false">
<rowset name="response" nestedSharedValues="false">
<column index="1" value="/soap:Envelope/soap:Body/GetRecentlyModifiedTokensResponse/response/ResponseCode" name="ResponseCode" />
<column index="2" value="/soap:Envelope/soap:Body/GetRecentlyModifiedTokensResponse/response/ResponseMessage" name="ResponseMessage" />
</rowset>
</xmlRead>
<forEachLoop label="Display Responses" itemsVariable="${response}" currentItemVariable="currentItem" beginIndex="1" endIndex="1" logLevel="debug" disabled="false">
<setVariable label="Set ResponseCode" name="ResponseCode" value="${currentItem[1]}" version="2.0" />
<setVariable label="Set ResponseMessage" name="ResponseMessage" value="${currentItem[2]}" version="2.0" />
<print label="Show Information" version="1.0">
<![CDATA[
===============================================
ResponseCode: ${ ResponseCode }
ResponseMessage: ${ ResponseMessage }
===============================================
]]>
</print>
</forEachLoop>
</module>
</project>
Code: Select all
The Job Log from the execution of this project looks like this:<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetRecentlyModifiedTokensResponse xmlns="urn:Eve_1_4_4">
<GetRecentlyModifiedTokensResult />
<response>
<ResponseCode>ERROR</ResponseCode>
<ResponseMessage>invalid login</ResponseMessage>
</response>
</GetRecentlyModifiedTokensResponse>
</soap:Body>
</soap:Envelope>
Code: Select all
Please let us know if you have any other questions...06/02/2014 09:41:21 INFO Executing module 'Main'
06/02/2014 09:41:21 INFO Executing task 'xmlRead 1.0 (Read Response XML)'
06/02/2014 09:41:21 INFO Data parsed successfully and the rowset variable(s) 'response' were created
06/02/2014 09:41:21 INFO Finished task 'xmlRead 1.0 (Read Response XML)'
06/02/2014 09:41:21 INFO Entering loop 'forEachLoop (Display Responses)'
06/02/2014 09:41:21 INFO [Read Response XML] Rowset "response" is beginning to process file "C:\Users\relliott\Documents\Customers\Gensys\TokenResponse2.xml".
06/02/2014 09:41:21 INFO Executing task 'setVariable 2.0 (Set ResponseCode)'
06/02/2014 09:41:21 INFO Variable 'ResponseCode' was created and set to 'ERROR'.
06/02/2014 09:41:21 INFO Finished task 'setVariable 2.0 (Set ResponseCode)'
06/02/2014 09:41:21 INFO Executing task 'setVariable 2.0 (Set ResponseMessage)'
06/02/2014 09:41:21 INFO Variable 'ResponseMessage' was created and set to 'invalid login'.
06/02/2014 09:41:21 INFO Finished task 'setVariable 2.0 (Set ResponseMessage)'
06/02/2014 09:41:21 INFO Executing task 'print 1.0 (Show Information)'
06/02/2014 09:41:21 INFO ===============================================
ResponseCode: ERROR
ResponseMessage: invalid login
===============================================
06/02/2014 09:41:21 INFO Finished task 'print 1.0 (Show Information)'
06/02/2014 09:41:21 INFO Exiting loop 'forEachLoop (Display Responses)'
06/02/2014 09:41:21 INFO Finished module 'Main'
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
- Posts: 17
- Joined: Thu May 08, 2014 2:07 am
Thanks, that helped a lot.
- Posts: 17
- Joined: Thu May 08, 2014 2:07 am
I did the above, but except for Row[1], all other values are returning as null. Eg. Row[2] , Row[3]..Row[28]. But I do have data in the input xml file for Row[2] and many other elements in the rowset. Please help.
- Posts: 17
- Joined: Thu May 08, 2014 2:07 am
I found out the error, it was a typo on the xml path to get the data.
5 posts
Page 1 of 1