openedge.net http request - async request?

Posted by mill on 25-Jan-2016 08:50

Hi,

Is there any functionality in the http request library for doing async calls. The library seems quite slow anyway but you would want your process sitting round waiting for a response when it could be doing other stuff.

Thanks

Chris paulson

All Replies

Posted by Peter Judge on 25-Jan-2016 09:50

There isn't, today, other than what the client socket offers.
 
Earlier versions had a bug where the client would wait for the socket to time out rather than parsing the payload to determine when a response was complete.
 
 

Posted by mill on 25-Jan-2016 10:05

Thanks for the response.

I'm using 11.6 so I guess I have the latest version without the bug.

Could the client socket use the read-response callback to implement async functionality?

Chris

Posted by egarcia on 26-Jan-2016 08:51

Hello,

Yes, technically, you should be able to use sockets and use a read-response callback to implement asnyc functionality.

However, since sockets is a low level functionality, you would need to implement the HTTP protocol and it would take some work to do HTTPS and authentication.

Also, you need to consider and test what happens when the callback is called and the user is entering data or interacting with a widget. It might be possible that the UI is not prepared for this behavior.

Here is an old example from the the Knowledge Base:

knowledgebase.progress.com/.../20011

You can also find this example at src/samples/sockets/HTTP/ if you have installed the samples for OpenEdge.

This is a simple example that shows an implementation of HTTP which can give you an idea on how to get started implementing this.

With this program, I was able to type in the text editor while the request was executing in the background.

You can try the following URLs to access data return as REST (using  dynamic WebSpeed service in OpenEdge 11.6):

oemobiledemo.progress.com/.../State

oemobiledemo.progress.com/.../Order

When working with sockets, you need to check what type of WAIT-FOR you want to use, the example, uses WAIT-FOR GO OF CURRENT-WINDOW, but in other cases, you may want to use WAIT-FOR READ-RESPONSE OF hSocket or even WAIT-FOR CLOSE OF THIS-PROCEDURE. Working with one active WAIT-FOR is simpler.

There might be more advanced examples around.

I hope this helps.

Posted by Steve Croff on 26-Jan-2016 10:11

I found it very easy to use curl for http requests.  This doesn't do an async call back the way you might want, but the call to curl can be put in background and then you can periodically monitor for a response file.  At least your OE process can do other things instead of blocking on the http request.

Posted by mill on 26-Jan-2016 10:50

Thanks,

I've found a possible way around this. The people I'm interfacing with can do a http post of the data to me. This enables be to capture the data with a webspeed program and get a json object.

For reference I'm speaking to http://www.fastfieldforms.com/ as an easy way of collecting data on mobiles that supports offline.

This thread is closed