Consuming A Web Service

jdpjamesp

ProgressTalk.com Moderator
Staff member
So I've been asked to see if I can work out how to connect to a webservice using ABL. I've been given the security information and the process to create a token for authentication, but I've no idea how to even go about doing the rest.
The URL of the webservice is https://rbacuat.eu.joneslanglasalle.com/RbacService.svc/rbacservice/
Any thoughts? Or if I can't do it from there what sort of questions do I need to be asking?
Never had to deal with this sort of thing.
 
I can't really help you, but I'm working on this exact thing right now. I'm perhaps crippled by being bound to 10.1c. At the moment I'm using raw sockets and parsing the output JSON with perl. This seems to work OK but I'm worried about certificates, which (a) are required for the final solution, I don't need to worry about them for now, (b) I have no clue how they work, (c) I vaguely recall RHD or MadDBA or someone in the past asserting that ABL doesn't support certificates well/at all. Anyway, getting sockets to work was no problem, and depending on how complex the incoming XML/JSON is, turning it into TT's or whatever may or may not be a big deal, I guess.
 
I'm working in 11.5 so I'd have thought JSON support should be easier. But who knows.
 
When you say "web service" I think SOAP and WSDL. Ugh. The provided link is a REST service. Which is much simpler.

As for "how to do it"... I need to support ancient, obsolete and unsupported releases so I currently write socket code for that sort of thing. So far I have not had my arm twisted into supporting https so I've been able to avoid certificates.

Writing JSON isn't too hard. Reading it is something that I have mostly avoided.

With 11.5 the "REST adapter" or the "dot net class" should be what you need. (I may have the wrong class name -- Peter Judge created it and I mostly remember that the name of it seemed very confusing...)
 
Ah it's REST is it. Hmmm. As you can see I have 0 knowledge of these things. I think SOAP and immediately think of suds.
 
I'm currently consuming REST services from a couple of sources (we are curently on OE10.2B08 RedHat and Centos) with a move to 11.5 or latest by years end).

I ended up doing the JSON using input-output with a curl script for writing and perl script for the incoming queries that works well, both for http and https (we have both). Let me know if you want that sort of script. There is a few things you need to be aware of, but all in all it's pretty straightforward.

As to the read/write, there is a READ-JSON and WRITE-JSON methods, but tbh I didn't go there yet (still need to do testing on the how-to get it to work properly before I incorporate it). Reading and writing is not all that difficult, just XML with a different format.
 
READ-JSON is not directly useful for pretty much any real-world third-party JSON that I've seen, because it presumes a structure that is basically a series of temp-tables. In my experience there are always scalar variables that live outside of temp-tables (arrays in JSON), or complex nestings that defy READ-JSON. Same thing for READ-XML.

If anybody has any advice about certificates in Progress, especially in 10.1c, I'd appreciate it.
 
Greg. Download cURL and use that to interact with the web service. It will handle all of your ssl needs.

I think there is a perl module for cURL as well.

In new versions you have the json object which makes working with real world json much easier.
 
Thank you. So is that to say that ABL sockets can't handle certificates and SSL, end of story? (I'm using perl anyway, so it's not a big deal, I just like to know).

Unfortunately, 'new versions' are dead to me. I agree, the 11.x JSON object would be helpful ;)

--

We have a lot of worries about the thing we're reading from not responding fast enough for our liking. With sockets, WAIT-FOR ... PAUSE (in 10.1c) handles this perfectly, as far as I can tell.

However, there is no such option on INPUT-OUTPUT THROUGH, which is the simplest way to interact with perl. CANCEL-REQUEST and STOP-AFTER in particular don't work (from experimenting and implied by documentation also).

I suspect this will require using ABL sockets to interact with perl, rather than stdin/stdout. Do you have any thoughts on this? I hope this question makes sense.
 
As far as I know you can't do SSL socket connections.. especially not in an easy way through the 4GL.

cURL has two different options to control how long it waits... a connection timeout and a total time limit before it will return control. It also supports unbuffered output, every flavor of authentication and certs, return codes for various errors, proxies, sftp, ftp, telnet and on and on. Really hard to beat and recreate all of this yourself.

cURL - How To Use
 
1. My issue with STOP-AFTER isn't ABL versions; it is that it doesn't STOP-AFTER everything. I believe it STOPs-during an unbounded query, but it definitely doesn't STOP a PAUSE, and in general it doesn't STOP any sort of external calls. I believe the same is true of the otherwise promising CANCEL-REQUEST, which also doesn't work on synchronous calls. Finally, in the ABL KB, there are several distressing-looking apparently unresolved complaints about these functions (ie. that they break AIA). All in all, they look not useful to us.

2. Thanks a lot for the info, Mad ... I would never recreate any of that, my thought was that ABL might support it natively. Apparently not ... cheers & thanks ... have a good weekend.
 
I've never done the SSL handshake with a socket connection but I know of somebody who tried ... and, gave up on it some 5 years ago. Nevertheless, I've you're on Windows .Net offers a bunch of objects that work perfectly for me. On Unix/Linux I either use wget as HTTP/S client.

Heavy Regards, RealHeavyDude.
 
Back
Top