Converting output from Rollbase SOAP API calls into ABL temp

Posted by mopfer on 20-Dec-2013 10:09

Is there anything in the ABL for converting the arrays that are returned from some of the Rollbase SOAP API methods into ABL structures like a temp-table or ProDataSet? 

For instance, the selectQuery method returns a LONGCHAR that contains XML with a 2 dimensional array of <item> within <arr>, without any of the table or column tags that would be needed for the ABL READ-XML methods to work.

I'm getting ready to write something to parse the query results into a dynamic temp-table, but I'd rather not re-invent the wheel if this functionality already exists and I'm just not looking in the right place for it.

Thanks

All Replies

Posted by Shelley Chase on 20-Dec-2013 10:18

I am forwarding this to the OE engineer that would know the answer. It would be helpful to have a sample XML to look at.
 
Robin – Once we get sample XML, can you take a look and see if we have anything that can import it into a TT?
 
Thanks
-Shelley
 
[collapse]
From: mopfer [mailto:bounce-mopfer@community.progress.com]
Sent: Friday, December 20, 2013 11:10 AM
To: TU.Rollbase@community.progress.com
Subject: [Technical Users - Rollbase] Converting output from Rollbase SOAP API calls into ABL temp-table or ProDataSet
 

Is there anything in the ABL for converting the arrays that are returned from some of the Rollbase SOAP API methods into ABL structures like a temp-table or ProDataSet? 

For instance, the selectQuery method returns a LONGCHAR that contains XML with a 2 dimensional array of <item> within <arr>, without any of the table or column tags that would be needed for the ABL READ-XML methods to work.

I'm getting ready to write something to parse the query results into a dynamic temp-table, but I'd rather not re-invent the wheel if this functionality already exists and I'm just not looking in the right place for it.

Thanks

[/collapse]

Posted by Mike Fechner on 20-Dec-2013 10:19

I used the JSON output and had to populate the table myself.

There is a pitfull with date fields in the JSON output: Those are represented in the Form of

NEW Date (2013/12/24)

unquoted.... No need to mention, that they fail to translate easy into an ABL date.

Posted by mopfer on 20-Dec-2013 10:34

This is the code that creates the output:

DEFINE VARIABLE in1        AS CHARACTER   NO-UNDO INIT "".

DEFINE VARIABLE in2        AS LOGICAL NO-UNDO.

DEFINE VARIABLE lcLongChar AS LONGCHAR   NO-UNDO INIT "".

/* note that the value of streetAddr2 is nil for these records - that is reflected accurately in the results*/

ASSIGN in0 = cSessionID.

ASSIGN in1 = "SELECT city, name, annual_revenue, streetAddr2 FROM account1". /* this does work for some reason */

RUN selectQuery IN hIWebServices(in0, in1, 3, OUTPUT lcLongChar).

This is what is in the longchar result:

<selectQueryReturn xmlns:xsi="www.w3.org/.../XMLSchema-instance" xmlns:xsd="www.w3.org/.../XMLSchema" xmlns:soapenv="schemas.xmlsoap.org/.../item><item>Bluth Company</item><item>10000.00000000</item><item xsi:nil="true"></item></arr></item><item><arr><item>Omaha</item><item>Bob's House of Toothpicks</item><item>10000.00000000</item><item xsi:nil="true"></item></arr></item><item><arr><item>Omaha</item><item>Beef Jerky R Us</item><item>1000000.00000000</item><item xsi:nil="true"></item></arr></item></arr></selectQueryReturn>

Posted by mopfer on 20-Dec-2013 10:39

Please ignore the /* this does work for some reason */  That was just a note for myself as I was using to learn how to call the API the right way that I forgot to clean up before I posted the code - it has nothing to do with the current question.

Posted by mopfer on 20-Dec-2013 13:06

Thanks for the note about the date Mike.  With the SOAP calls that I'm using the dates come back in this format:

2013-10-15 00:00:00.0

We'll have to do a little adjusting with those to map them to ABL date or datetime also.

This thread is closed