SelectSQL Adapter service in a Flow Service

I am trying to query the database and make an xml document out of the resultSet received and write the same to a file. But it is not executing properly.

The flow I have designed is:

  • Adapter Service
  • LOOP over /results

startloop

  • Copy result to a tempDoc
  • Generate a XML String from tempDoc using pub.xml:documentToXMLString
  • Convert the said string to bytes using pub.string:stringToBytes
  • Write to a file using a Java Service called ISFileSystem.pub:putBytes

endloop
The adapter service is fetching the data correctly. Screenshot attached. But after that I think none of the steps are working. I am only getting the output of the Adapter Service. It seems that the results Document List is not getting copied as it should in the LOOP step.

I am fairly new in webMethods Development. Can you please help?


Hi Mainak,

if I understand your logic right, you want to have one file per record in the results array.

You can try to define the tempDoc as a DocumentList and specify this as the output Array for the loop when both list will have the same length. If the output length differ from the input length you can use pub.list:addToDocumentList service.
After that use documentToXMLString for the whole tempDocument list outside of the Loop and this will result in one file with all entries.

Please wrap the loop in a Try-Catch sequence to see if there is any step failing.


SEQUENCE (Exit on SUCCESS)
 SEQUENCE (Exit on FAILURE)
  Loop here
 SEQUENCE (Exit on DONE)
  pub.flow:getLastError
  pub.flow:debugLog (log the error message from getLastError here)

Which version of wM are you using?
Screenshots seems to be from an older version prior to the 9.x versions.

Regards,
Holger

Thank you Holger for your reply. The try-catch tip was really helpful. I’m using webMethods 6.5. I know, it’s very old.

But I am still facing the same problem. My logic, for now, is just to create a Document List from the result obtained from the JDBC Adapter service, in my case u5480070_POC:selectLongDescById.

Now that I can see the server logs, it is stating that:

[15]2018-02-12 08:11:24 CET [ISC.0050.0019V2] Copy failed: No source data available: to=/toList, from=/testDocList
[14]2018-02-12 08:11:24 CET [ISC.0050.0019V2] Copy failed: No source data available: to=/fromItem, from=/tempDoc
[13]2018-02-12 08:11:24 CET [ISC.0050.0019V2] Copy failed: No source data available: to=/tempDoc/ATP_PARAM_VALUE, from=/results[0]/ATP_PARAM_VALUE
[12]2018-02-12 08:11:24 CET [ISC.0050.0019V2] Copy failed: No source data available: to=/tempDoc/ATP_PARAM_NAME, from=/results[0]/ATP_PARAM_NAME
[11]2018-02-12 08:11:24 CET [ISC.0050.0019V2] Copy failed: No source data available: to=/tempDoc/DECOMP_AL_ID, from=/results[0]/DECOMP_AL_ID

but the Adapter Service is returning the valid output and the DocumentList remians EMPTY! PFB the screenshot.

So, can you please help me understand my error?



Hi,

please move the last two invokes into the Catch-Sequence.

Are you sure you are looking at the right level for the results array?
Shouldn´t it be “/selectLongDescByIDOutputt/results”?

To test this, jsut remove the explicit map in the output of the adapter service, select another step and return to the adapter service.
You will see real output structure of the adapter service then. Adjust your loop and the frist step in the loop accordingly.

Remember to drop tempDoc after appending it to the list to avoid data mess in the case one of the fields in the result is empty.

Regards,
Holger

Thanks Holger, it worked somewhat. PFB the result I’m getting.

I don’t know whether “testDocList” should come like that or not, but if the output is correct then how to create an XML from it?
I am unable to do so with “pub.xml.documentToXMLString”. No “xmldata” obtained in Results.