Rest Client in OE 11.5?

Posted by chrisrichardson on 30-Mar-2015 14:32

Is there a REST client in OE now (in 11.5)?

The documentation below talks about the rest adapter for the appserver.  

http://documentation.progress.com/output/ua/OpenEdge_latest/index.html#page/pdsoe/introducing-openedge-rest.html#

But I want to connect to external rest services from within OE.  Is it possible or do I need to create my own (possibly .net)?

Posted by Peter Judge on 30-Mar-2015 14:41
The TL:DR version is there will be a supported one in the 11.5.1 service pack. There is one (a 'tech preview' version) in 11.5.0.
 
-- peter
 
 
[collapse]
From: chrisrichardson [mailto:bounce-chrisrichardson@community.progress.com]
Sent: Monday, 30 March, 2015 15:33
To: TU.OE.Development@community.progress.com
Subject: [Technical Users - OE Development] Rest Client in OE 11.5?
 
Thread created by chrisrichardson

Is there a REST client in OE now (in 11.5)?

The documentation below talks about the rest adapter for the appserver.  

http://documentation.progress.com/output/ua/OpenEdge_latest/index.html#page/pdsoe/introducing-openedge-rest.html#

But I want to connect to external rest services from within OE.  Is it possible or do I need to create my own (possibly .net)?

Stop receiving emails on this subject.

Flag this post as spam/abuse.

[/collapse]

All Replies

Posted by Peter Judge on 30-Mar-2015 14:41
The TL:DR version is there will be a supported one in the 11.5.1 service pack. There is one (a 'tech preview' version) in 11.5.0.
 
-- peter
 
 
[collapse]
From: chrisrichardson [mailto:bounce-chrisrichardson@community.progress.com]
Sent: Monday, 30 March, 2015 15:33
To: TU.OE.Development@community.progress.com
Subject: [Technical Users - OE Development] Rest Client in OE 11.5?
 
Thread created by chrisrichardson

Is there a REST client in OE now (in 11.5)?

The documentation below talks about the rest adapter for the appserver.  

http://documentation.progress.com/output/ua/OpenEdge_latest/index.html#page/pdsoe/introducing-openedge-rest.html#

But I want to connect to external rest services from within OE.  Is it possible or do I need to create my own (possibly .net)?

Stop receiving emails on this subject.

Flag this post as spam/abuse.

[/collapse]
Posted by chrisrichardson on 30-Mar-2015 15:22

Ah OK Peter, thanks for the info.

Any documentation around so I can have a play? - I see in a few of your other posts it's part of the ESAP - is that still available?

Posted by Peter Judge on 31-Mar-2015 12:28
Hi,
 
The ESAP for 11.5 is closed since 11.5 has been released. I've attached the doc that was provided with the ESAP, which will work with 11.5.0. Note that the API has changed slightly between 11.5.0 and 11.5.1 (primarily via refactoring the various types to use interfaces, which the 11.5.0 code does not).
 
If you have 11.5.0 then you should be able to start playing with the HTTP library.
 
-- peter
 
[collapse]
From: chrisrichardson [mailto:bounce-chrisrichardson@community.progress.com]
Sent: Monday, 30 March, 2015 16:24
To: TU.OE.Development@community.progress.com
Subject: RE: [Technical Users - OE Development] Rest Client in OE 11.5?
 
Reply by chrisrichardson

Ah OK Peter, thanks for the info.

Any documentation around so I can have a play? - I see in a few of your other posts it's part of the ESAP - is that still available?

Stop receiving emails on this subject.

Flag this post as spam/abuse.

[/collapse]
Posted by chrisrichardson on 01-Apr-2015 03:04

Thanks Peter, will check this out.

In the mean time I put this together based on some examples on here and elsewhere.  This has got me going for now (I didn't want to go down to socket route!)

using System.*.

def var HttpClient as class System.Net.WebClient.
def var webResponse as longchar no-undo.
fix-codepage (webResponse) = "UTF-8". 

def var appKey as char no-undo initial "MyAppKey".

HttpClient = new  System.Net.WebClient().

HttpClient:Proxy:Credentials = System.Net.CredentialCache:DefaultNetworkCredentials.

HttpClient:Headers:Add("key",'"' + appKey + '"' ).

webResponse = HttpClient:DownloadString("http://api.worldbank.org/countries?format=json"). 

HttpClient:Dispose().
delete object HttpClient.

message string(webResponse) view-as alert-box.


Posted by Peter Judge on 01-Apr-2015 07:48
This will work , of course, but only on Windows .
 
Note that the design of the HTTP library completely hides the fact that you're using sockets. The API used to make requests is completely technology-agnostic (so one could switch out the socket-based engine with something else).
 
-- peter
 
[collapse]
From: chrisrichardson [mailto:bounce-chrisrichardson@community.progress.com]
Sent: Wednesday, 01 April, 2015 04:06
To: TU.OE.Development@community.progress.com
Subject: RE: [Technical Users - OE Development] Rest Client in OE 11.5?
 
Reply by chrisrichardson

Thanks Peter, will check this out.

In the mean time I put this together based on some examples on here and elsewhere.  This has got me going for now (I didn't want to go down to socket route!)

using System.*.
 
def var HttpClient as class System.Net.WebClient.
def var webResponse as longchar no-undo.
fix-codepage (webResponse) = "UTF-8". 
 
def var appKey as char no-undo initial "MyAppKey".
 
HttpClient = new  System.Net.WebClient().
 
HttpClient:Proxy:Credentials = System.Net.CredentialCache:DefaultNetworkCredentials.
 
HttpClient:Headers:Add("key",'"' + appKey + '"' ).
 
webResponse = HttpClient:DownloadString("http://api.worldbank.org/countries?format=json"). 
 
HttpClient:Dispose().
delete object HttpClient.
 
message string(webResponse) view-as alert-box.

 

Stop receiving emails on this subject.

Flag this post as spam/abuse.

[/collapse]
This thread is closed