Using Web Services with Cobol or RPG on IBM iSeries

by Mario Pesce - http://www.datamission.co.uk

1. Introduction

Web Services and SOAP (or REST) are rapidly becoming state-of-art architecural approaches to allow the access of multiplatform and multilanguage systems,

Many companies have legacy applications which represent a high investment and Web Services promise to allow their access from the web without extensive modifications.

On the Internet there are many tutorials and documents on Web Services and we have collected a few interesting ones the refer to the IBM iSeries systems.

2. An Introduction to Web Services

Web services consist of a group of standards intended to make it possible for diverse systems to communicate, without requiring a particular type of middleware, programming language or even operating system. They can be based on SOAP, REST or XML-RPC,.

SOAP is an open source message standard, based on an XML dictionary, that uses standard tranport protocols widely used over the Internet such as HTML or SMTP. It represents a paradigm shift in the way applications communicate with each other, because it does not require any special middleware to allow diverse applications to communicate. The messages are text based and accessible by any application over the network. They are described by using a special XML based language called WSDL.

REST is a simpler type of Web Service where the user simply accesses a URL to obtain back an XML document without any standard specification.

XML-RPC is a way to send commands to another system by using and XML document.

A good introduction on the concepts and techniques can be found in a series of three tutorials written by Nicholas Chase which starts with the documents Understanding Web Services specification .

3. Consuming Web Services from Cobol or RPG

If you need to access a Web Service from a Cobol or RPG program, you can use the IBM Web Services Client for C++ toolkit as discussed in the tutorial Consuming Web Services from RPG or Cobol programs on System i .

4, Exposing Legacy programs in Cobol or RPG as Web Services

If you want to access legacy Cobol or RPG programs as Web Services, you can use the IBM Toolbox for Java or JTOpen to develop a Java Web Service which calls the Cobol or RPG program and return the results as a SOAP message, as discussed in the tutorial at Access an enterprise application from a PHP script .

5. Using PHP with Web Services

PHP has recently been ported to the IBM iSeries systems as discussed in the tutorial at Use PHP on System i - Part 1 and Use PHP on System i - Part 2 .

PHP has a good support for Web Services and SOAP especially in the PHP 5 version, as discussed in the tutorial Access an enterprise application from a PHP .

Another useful tutorial is Build a Web service with PHP

Notice the PHP services can call also programs written in other languages such as Cobol or RPG and therefore PHP can be an alternative to the approach of the previous point.

6. DB2 Web Services

Data in relational database can be accessed though end-user queries in SQL or other interfaces or by applications that use programming interfaces such as JDBC and SQLJ.

DB2 allows also to use Web services to query the database and to obtain the results as standard SOAP messages as described in DB2 Web Services .