Web Services With Cobol Or RPG on IBM ISeries – Restful Php Web Services
Web Services and SOAP (or REST) are rapidly becoming state-of-art architectural 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.
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 transport 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.
Web service allow to develop loosely coupled applications, by allowing systems based on different technologies and languages to communicate by using open standard largely based on XML.
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.
It uses extenal data structures to define the mappings between elements of an XML document and fields usable in Cobol or RPG applications and allows to generate C or C++ functions which can be called by the Cobol or RPG program to invoke the web service. The generation is based on the WSDL file which describes the Web service.
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.
It allows to develop clients in Java or other languages to call legacy Cobol or RPG program and return the results as XML messages according to the Web services specifications.
5. Using PHP with Web Services
PHP has recently been ported to the IBM iSeries systems.
PHP has a good support for Web Services and SOAP especially in the PHP 5 version.
Notice the PHP services can call also call 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.