How to do HTTP GET and POST in Progress/OpenEdge ABL

openedge, progress-4gl

The Progress docs spill plenty of ink on SOAP, but I'm having trouble finding the example for a simple HTTP GET/POST with Progress ABL.

How do I GET and POST strings to/from a URL?

Can the URL be https://?

Can Progress provide HTTP Basic or HTTP Digest authentication?

Best Solution

For future onlookers at this question:

Openedge now (since 11.5.1 I believe) has built in support for calling REST based webservices. These are enclosed in a provided .pl archive that is not in your PROPATH by default so that needs to be handled first (or the archive can be moved to a "better location").

The propath can be set in a number of ways, init files, registry, programatically etc. This is how it can be done in ABL (if done this way it must be repeated for each new session).

PROPATH = PROPATH + ",c:\pathtoprogress\OpenEdge\gui\OpenEdge.Net.pl".

There's also a version in "tty" directory, as well as an archive containing source code in the "src" directory.

Here's a very basic example:

USING OpenEdge.Net.HTTP.IHttpRequest.USING OpenEdge.Net.HTTP.IHttpResponse.USING OpenEdge.Net.HTTP.ClientBuilder.USING OpenEdge.Net.HTTP.RequestBuilder. DEFINE VARIABLE oRequest  AS IHttpRequest NO-UNDO.DEFINE VARIABLE oResponse AS IHttpResponse NO-UNDO.oRequest = RequestBuilder:Get('http://stackoverflow.com/'):Request. oResponse = ClientBuilder:Build():Client:Execute(oRequest).MESSAGE    oResponse:StatusCode SKIP       oResponse:StatusReason SKIP    VIEW-AS ALERT-BOX.

Documentation for 11.6 can be found here.