[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can HTTPAPI be used to consume a REST type Web Service?



Ack!  I forgot to provide a link to my sample program.  Here's a link to a 
sample program that consumes the Yahoo! Geocoding web service:

http://www.scottklement.com/httpapi/geocode.txt

-- 
Scott Klement  http://www.scottklement.com

On Tue, 30 Jan 2007, Scott Klement wrote:

> Hello Tomas,
>
>> Now to the question.  Can HTTPAPI be used to consume a REST type Web
>> service?  I'm confused how to go about it and I'm having a hard time
>> making the program work.
>
> Absolutely.   To be honest, HTTPAPI doesn't know that it's consuming a web
> service.  It's just communicating with a HTTP server.  The part that makes
> it a web service (SOAP or REST or whatever) is your RPG code.
>
> For your example, you'll want to use HTTPAPI's URL Encoder utility to
> create a URL that has all of the correct parameters embedded into it.
> Then you'll use HTTP_url_get() to send that URL to the server and download
> the response.  The response, of course, will be XML and you can ask
> HTTPAPI to help you parse that XML.
>
> So basically, you have these steps:
>
>  a) Create a URL Encoder
>  b) Use the encoder to encode your parameters.
>  c) Create a URL from the base URL and the parameters.
>  d) Free up the URL Encoder
>  e) Send Request to Yahoo, receive response in XML file.
>  f) Parse XML file
>
> The most irritating part of this is that you have to sign up as a
> developer with Yahoo.  I think they do this to prevent abuse of their
> service, but that's really the hardest part of the process!
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------