CICS meets XML: Using CICS Web Servives with DB2 pureXML
February 25, 2011
Ok, the readers who are not from the mainframe world may wonder what “CICS” means. According to IBM’s official web site, CICS is defined as follows: “CICS (Customer Information Control System) is a family of application servers and connectors that provides industrial-strength, online transaction management and connectivity for mission-critical applications.” There you have it.
So, CICS is a transaction server (plus tools and extensions) that runs on IBM mainframes on the z/OS and z/VSE operating systems. It is commonly used for high-volume online transaction processing applications. CICS applications are typically written in COBOL, PL/1, or C.
CICS Version 3.1 has introduced support for web services and SOAP, which enables CICS applications to be web service providers or web service consumers (requester). The transport mechanism used is typically HTTP or MQ message queues, and the web service messages are (almost always) in XML format.
Applications that use web services, e.g. in service-oriented architectures, often have the need to store incoming and/or outgoing messages in a database. Sometimes this is needed for compliance reasons or simply to have a “log” of the information that is being exchanged. This log can be indexed and queried efficiently.
Since the web service message are in XML and their content and structure may vary, storing them in their original XML format is a natural choice and a very common use case for the XML databases, including DB2 pureXML.
With the pureXML support in DB2 9 for z/OS it becomes straight forward to combine CICS web services with XML management in DB2. For example, XML messages of varying format can be stored in the same XML column, exploiting the support for schema variability in DB2. Here are some examples of what you can do:
Receive and store web service messages in a CICS application (in-bound):
- Store incoming SOAP messages as-is in an XML column in a DB2 table
- Extract the payload from incoming SOAP messages and insert this payload into an XML column
- Shred the payload of an incoming SOAP message to a set of relational tables, using SQL/XML
Produce and sent web service messages in a CICS application (out-bound):
- Retrieve an XML document from an XML column in a DB2 table and send it out
- Extract pieces from one or multiple XML documents in an XML column and combine them to an outbound message
- Retrieve an XML document from an XML column and modify it with XQuery update expressions before sending it out (DB2 10 for z/OS)
- Constructing outbound XML messages from traditional relational data, using SQL/XML functions (DB2 V8 for z/OS and higher)
All of the XML-related processing such as extracting, shredding, modifying, or constructing XML can be accomplished by DB2 pureXML features that can be invoked from the CICS application.
If you want to know how to put it all together, I’ll refer you to two articles written by people who know a lot more about CICS than I do:
Using CICS with DB2 pureXML, Part 1: Perform basic XML storage and retrieval through CICS Web services
Using CICS with DB2 pureXML, Part 2: Perform advanced XML storage and retrieval through CICS Web services
These articles describe how to implement most of the scenarios that I have listed above.