XMLSERVICE Offers New Life for RPG Programs
Web services are all the rage these days. In fact, one of the most common questions we’re asked by clients is, “How can I use my existing RPG programs as Web services?” Actually the question is more commonly phrased as, “I’ve been told I’ve got to supply X as a Web service; how can I do that?”
Until recently, we generally suggested three main options:
- Use the built-in IBM i Web service wizard to deploy your programs as Web services on the built-in Application Server
- Use PHP’s Web Service support and call into your back-end RPG code
- Use an Apache CGI-based approach using one of the many Web programming tool kits (CGIDEV2, openRPGUI, etc.)
Option A requires no programming. The wizard does it all, but limitations in the underlying Java toolbox (JT400) APIs mean that it’s restricted in the parameter data types it can handle. It also can’t really use existing subprocedures because the only type of return value it can handle is a four-byte integer, and that rules out more than 99 percent of all existing subprocedures.
Options B and C both require programming and, if you haven’t used these facilities before, perhaps a bit of a learning curve. Even then the PHP option suffers from the same restrictions as option A.
While each of these solutions has advantages and disadvantages, none allowed the simple deployment of any noninteractive program or service program. Now there is such an option—XMLSERVICE—and best of all it’s supplied by IBM and free. You know how we love free!
XMLSERVICE is an open-source project that’s the result of a collaborative effort between IBM, Zend, and the Young i Professionals group. It originated in part from Zend’s need for a new toolkit to replace the existing proprietary tooling. That tooling was also based on the Java toolbox APIs and therefore had the same aforementioned data type and parameter restrictions.
With the IBM i being increasingly used as the back-end data server for applications hosted on Windows, Linux and other platforms, IBM also had a need for tooling that would allow for simple deployment of programs and commands in the form of Web services or as a stored procedures. This is what XMLSERVICE gives us.
In this article, we’ll barely scratch the surface of what can be done with XMLSERVICE, but since it can be used to answer the big “Web service” question, we thought that was where we would start. Hopefully, this will be the first of several articles on the topic, including details of the new PHP interfaces.