You might be asking yourself “What is a webservice?” or “What is an AS400 webservice?”. First of all, I am not going to rant about how its not an AS400 webservice, nor is it an iSeries webservice — it’s an IBM i webservice. IBM dont make the old AS400 and iSeries machines anymore, so stop calling the IBM i System that #endofmessage.
Anyway, lets look at what a webservice is and perhaps do a quick, high level overview to explain the basics.
Here is a question frequently asked in IBM i programming forums:
How do I write (an IBM-i program) RPG, to talk to the internet and receive or send parms to a website or webservice? For example, how can I receive an order number and return the order line information in XML?
Sounds kind of complicated, doesnt it?
Actually, its not 🙂
Luckily for us, this is an area where the bods at IBM have implemented a really cool server on our beloved IBM I operating system that makes this process so simple, it’s really quite astounding. All we have to do is write a program that does the business logic (for example, receive an order number parameter, read the order line details and return those parameters back). Then we can simply use the IWS* (Integrated Web Server) to share that information with the world wide web.
The IWS is easily used from any web browser that can talk to your IBM i Server and it has a very simple wizard that will create a webservice from your RPG program. Not only that, but it will automagically create a WSDL*, and deploy the webservice to its application server. The IWS is free and comes automatically with the system.
There are lots of ways to do this and its much easier than you may think.
*What is the IWS? The integrated Web services server for IBM i enables the deployment of ILE-based program objects as Web services. The IWS is free and comes included with IBM i you simply need to start the server and start using it.
*What is a WSDL? A WSDL is an XML document that describes a web service. It actually stands for Web Services Description Language.
*What is SOAP? SOAP is a technique that lets you exchange info over a particular protocol (can be HTTP or SMTP, for example) between applications.
*What is a XML and JSON? Think of these as the language of the webservice. Webservices write their messages in JSON or XML so that the program (or browser) the other end can easily read what they are sending or receiving over the web.
Don’t get scared by all the buzzwords like server, serving, consuming, publishing, soap, rest, xml, json…. take a deep breath and dont panic.
If this is the first time you have written a webservice, or if you just want to see some alternative RPG code examples then look at these blogs
Does this make sense? Still with me? Then lets read a Primer on Webservices
IBM i Software Developer, Digital Dad, AS400 Anarchist, RPG Modernizer, Alpha Nerd and Passionate Eater of Cheese and Biscuits. Nick Litten Dot Com is a mixture of blog posts that can be sometimes serious, frequently playful and probably down-right pointless all in the space of a day. Enjoy your stay, feel free to comment and in the words of the most interesting man in the world: Stay thirsty my friend.
JSON versus JSONP Tutorial – Resurrected
RPG Example reading JSON using JSON_TABLE from IFS
RPG Example reading JSON using YAJL from IFS
RPG example: Talk to a Webservice and store reply XML or JSON in IFS
What is JSON_TABLE on IBM i?
JSON Plugin for RDI
IBM i Webservices Primer – SOAP or REST?
Web Services for Dummies
An introduction to iSeries webservices