REST Web Services

Posted by atulp16 on 12-Dec-2013 11:03

Hi,

I have been looking at consuming some REST WebServices in ABL, but cannot find any code, functions or samples. Is this possible and if so, how?

Thanks,

Atul

Posted by mallen on 18-Dec-2013 07:09

Unfortunately, there's no built in REST client in the 4GL. You'd have to use Sockets to implement an HTTP request/response. I think OEHive still has some sample code to be inspired by.

All Replies

Posted by Mike Fechner on 12-Dec-2013 11:06

You need to code your own http client using sockets in the ABL.

When on Windows, you may be using the .NET httpClient class: msdn.microsoft.com/.../system.net.http.httpclient(v=vs.110).aspx

Posted by Jens Dahlin on 12-Dec-2013 12:51

I've used READ-XML and READ-JSON with datasets. Using a URL works perfectly fine with "file" as type. One problem is that only HTTP and not HTTPS is accepted. There's no way of making the call async either.

Example using an X-DOCUMENT:

CREATE X-DOCUMENT ghXmlResponse.

ghXmlResponse:LOAD( "FILE" , "http://ecetc" , FALSE ).

Then you manually need to parse the XML document.

Using temp-tables or datasets has a similar syntax. Read up on datasets specifically!

DATASET dsQuery:READ-XML( "FILE"
, "http://etcetc"
, "EMPTY"
, ?
, ?
, ?
, ?) NO-ERROR.


Most logic is stored in the definition of the datasets and/or temp-tables. Check the manual for more information.

Posted by Phillip Molly Malone on 17-Dec-2013 01:13

(Disclaimer: Although I am a Progress Employee, the following thoughts are my own and as a user of OpenEdge and I have no pull in this area)

I wondered about the .Net integration to obtain this for a while. I have wondered if a class could not be written to provide an easy interface between OpenEdge and .Net classes to get this (and frankly other web calls) done. When Community was being worked on, I wondered if things like this (and maybe other utility type code) couldn't be worked on by the community in a shared manner in a way that would allow everyone to improve it bit by bit and then have a very useful set of classes that provide useful enhancements ontop of OpenEdge. Sort of community libraries.

If I ever get the free time (at home) to look at this again, I will be sure to share my code.

Just a thought.

Posted by mallen on 18-Dec-2013 07:09

Unfortunately, there's no built in REST client in the 4GL. You'd have to use Sockets to implement an HTTP request/response. I think OEHive still has some sample code to be inspired by.

This thread is closed