[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: retrieving ABA routing number question
> I need to retrieve bank information based on ABA routing number. I wish
> to do this in my RPG pgm. I am on a 520 using 5.4.
With HTTPAPI, yes? Do you have the latest version (1.17)?
> Unfortunelty, it's a little greek to me.
>
> Is one of the examples provided in the LIBHTTP library close to what I need
> to do? Or does anyone have an example I may use.
Heh... You might look at EXAMPLE18 or EXAMPLE19, since they both
demonstrate examples that come from that particular site (webserviceX.net)
However, I glanced over that particular document -- and it does something
that none of the other examples do. The data that it returns is actually
an additional XML document that has been embedded inside the SOAP
document. I don't currently have any examples of that, so I took the time
to write a program that calls the ABA routing number service that you
found.
First of all, if you're not familiar with SOAP web services, let me give
you a REALLLLLLLY short introduction:
a) A web service is something like a library with programs in it. Each
one has a couple of routines you can call, called "operations".
b) Each operation can accept input and output parameters. If there
are any input parameters, they are passed in an XML document.
If there are any output parameters, they're returned to you in
an XML document.
In this example, the "program" (or "operation") is named
GetABADetailsByRoutingNumber, and it accepts an input parameter
and an output parameter.
c) A SOAP document is the format of XML document that you use to
encode the parameters.
d) A WSDL document ("or Service Description") is a blueprint for
the whole process. IT lists the available operations, and
explains how to encode the parameters, which parameters have
to be sent, etc, etc.
e) HTTPAPI contains routines that are able to send data over the
Internet using the HTTP protocol. It also has routines to
parse the XML documents you receive back. It does not have
a routine to CREATE an XML document to pass to the web srevice
but this is easy to do in an EVAL statement, so it's no real
big deal.
Hopefully that helps you understand what needs to be done. For more
details, see my article in the July 2006 issue of System iNEWS magazine
If you have a ProVIP subscription you can read it online:
http://www.systeminetwork.com/article.cfm?id=20590
You might also be interested in my Powerpoint presentation on HTTPAPI and
Web Services from RPG:
http://www.scottklement.com/presentations/
Okay, now to do the real work, we'll need these steps:
a) Create a SOAP document with the input parameters to be passed to the
Web service. This'll just be a big EVAL statement in the RPG program
that creates the XML document into a variable.
b) Call the HTTPAPI routine to POST it to a web service. This routine
is http_url_post().
c) Use the http_parse_xml_stmf() API from HTTPAPI to parse the XML that's
received in response. inside that response will be another XML doc,
that we'll write to the IFS using the IFS APIs (included w/HTTPAPI)
d) Call http_parse_xml_stmf() again, this time on the document that
was embedded in the other document :). This time, it should have
all of the bank info, so extract that info to a data structure.
e) Use the DSPLY op-code to display the bank info on the screen (For
the sake of demonstration, only)
For someone who has not worked with this before, this can be a pretty
complicated process. Especially if you're not only new to web services,
but are also new to XML, IFS, HTTP, etc. Lots of things to learn.
Anyway, I've written a sample program using the steps above. Please try
it out and see if you can figure out how it works. I tried to display
info at every step of the way so you can see what's happening at each
step...
Grab the sample program from the following link:
http://www.scottklement.com/httpapi/bankrout.txt
If you have questions, please ask.
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------