How can IBM i Talk to Internet Webservices?

IBM i Webservice Techniques

There are many ways to do everything. 

With the rapid evolution of web technology this list will be obsolete the moment I click SAVE and PUBLISH. Please bear that in mind, when reading these recommended webservice techniques; there is always a better way of doing something just around the corner.

We have three main ways of letting our IBM i System talk to internet webservices:

  • IBM i SQL - will let you connect and read from internet webservices
  • HTTPAPI (LIBHTTP) - will let you connect and read from internet webservices
  • IBM AXIS REST API - IBM's version of RPG API very similar to HTTPAPI -- but not nearly as friendly 😉

What do we use when we want to let external systems, on the internet, talk to programs running on our IBM i System?

  • IBM i IWS (Integrated Web Server) will let us host webservices, allowing internet systems to communicate with our IBM i program directly handling all XML/JSON conversion at interface level. (This means our RPG program will be called by the HTTP Server and receive the JSON/XML Data as program parameters that look completely normal to it for example. Any response parameters will be automatically converted back to JSON/XML to be returned to the caller)
  • Common Gateway Interface (CGI) - we use the IWS to create a HTTP Server and call our *PGM direct. Then our RPG program can programmatically convert JSON/XML and handle logic ourselves.
  • NOTE - we have many ways of manually handling the webservice data payload. IBM i port of YAJL, a very fast JSON parser/generator converts to/from JSON with ease. IBM i SQL also does this using its table functions.

Of course, there are also many third-party tools that offer similar functionality. But in the immortal words of Sweetie Brown: "Aint nobody got time for that"

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}