Calling an URL

Posted by Jens Dahlin on 15-Aug-2012 04:59

I need to call a specific URL and then read and parse the XML-data returned by the server. As far as I know there isn't any built in way of doing this in ABL. Am I right?

I'm considering using a 3rd party program like for instance curl or wget. But that means calling the program, writing the data to disc and then reading the data and finally deleting the data. A bit of overhead.

Another solution could be to implement this using sockets, but since it's not 1992 I wan't to ask if I have any other options, clearly this has been done before!

OE10.2B on Suse Linux.

All Replies

Posted by jmls on 15-Aug-2012 05:07

"input through" curl would work well

also have a look at the ipworks toolset for linux

Posted by Jens Dahlin on 15-Aug-2012 05:22

Thanks!

Just discovered that the SAX-READER:SET-INPUT-SOURCE method does accept URL's as a file type so I could basically do

SAX-READER:SET-INPUT-SOURCE ("file","http://www.example.com/service.apsx?param=data&param2=ddd"). I'll play around with it a little and if it works I'll stick to this. Otherwise I'll go for input through curl...

Posted by rbf on 15-Aug-2012 07:51

Well there is a nifty httpget.i routine that you can download from this KB:

http://knowledgebase.progress.com/articles/Article/20011

But your SAX-READER-INPUT-SOURCE discovery sounds much better!

Let us know if that works for you.

Posted by Jens Dahlin on 15-Aug-2012 09:13

I haven't really worked with the SAX-READER before but after some initial testing it seems to work. I call the URL, receive the XML and can extract data! That's about all I need to do.

Posted by rbf on 15-Aug-2012 09:16

Well that is really good to know. Thanks for the hint!

Posted by Jens Dahlin on 15-Aug-2012 10:00

I checked the documentation and apparently the LOAD method of the x-document object does support the same syntax. Handy for us who haven't used SAX that much!

DEFINE VARIABLE hDoc AS HANDLE NO-UNDO.
 
CREATE X-DOCUMENT hDoc.
 
hDoc:LOAD("file", "http://www.bbb.com/service.exe?etc=etc", TRUE).

This thread is closed