Web Services Overview
Web services allow client programs, such as Web applications, to request server applications to carry out the operation. HCI Licensing-as-a-Service offering provides Web services to control license checking and transaction auditing. The Job Entry Subsystem is controlled by Web services to define job classes and submit jobs. The Heirloom Dashboard issues Web services against the cloud-controlling services for everything from backup/restore of data to starting/stopping of application instances. CICS transactions running within the Elastic Transaction Platform can be controlled through Web services as well.
RESTful Web Services Overview
Representational State Transfer (REST) is the technique used in modern Web 2.0 applications to connect to backend services. It is a hallmark of Software-as-a-Service applications are built today. In order to scale-up to large numbers of clients REST allows the clients themselves to maintain state such as the current customer record or the current bill-of-material being processed by the client. It does so by transferring the state to and from the client across a secure HTTP connection in addition to data sent or received from the application.
REST is actually a very old idea. The concept was first used in pseudo-conversational transactions used with CICS programming. CICS transaction can either be conversational, in which case the mainframe COBOL program is responsible for displaying a question and then accepting a response from the user (tying up resources waiting for the user's data entry) or pseudo-conversational in which the application sends a screen to the user and then disconnects, allowing the mainframe scheduler and telecommunications handlers to process other user's requests. Data entry is performed in the local terminal environment and when the user is ready they send an attention interrupt (Enter key) along with the data and any currency or state information to the application. It is only then that a new transaction is started up to process the user's response. It still appears to the end user as if they are in constant contact, i.e., having a conversation, with the program but it allows the system to process other users' work in between data entry cycles making it pseudo-conversational.
Thus, REST is identical in many ways with traditional programming techniques used in CICS COBOL applications. In REST, state is preserved in browser cookies and sent back in hidden HTML form fields. With pseudo-conversational programming, state is hidden in the "black" areas of a green-on-black 3270 display as sections with the modified-data-tag (MDT) bit only to be returned when the user hits the Enter key.
Elastic Transaction Platform RESTful CICS transactions
CICS transactions with traditional "green screen" BMS maps are rendered by ETP as XHTML Web pages delivered over hypertext transfer protocol (HTTP), possibly encrypted via TLS 1.0/SSL 3.0 (HTTPS). A pseudo-conversational transaction invocation is performed by the HTTP POST operation while passing the state information through an HTTP session cookie. The initial transaction is requested through an HTTP GET operation. Data for a BMS transaction is sent via HTTP POST operation. Transactions that invoke one another through distributed program link (DPL) can invoke the transaction with HTTP GET operation passing transid and commarea.
ETP runs under Java containers (Apache Tomcat, vmWare tcServer) or via JEE Application Servers (Apache Geronimo, IBM Websphere, Oracle Weblogic, Red Hat JBOSS). The REST transaction invocation involves the 4-character transaction id (tran id) and the arbitrarily large communication area (commarea).
- GET http://server-address:8080/sysid/servlet - request the INIT transaction form data
- POST http://server-address:8080/sysid/servlet - submit the most recent data entry information
- GET http://server-address:8080/sysid/servlet?transid=xxxx&commarea=yyyyyyyy - invoke a DPL transaction
The response is and XML packet that often contains the XHTML representation of the web page. Embedded within the page are <INPUT> tags representing the modifiable components of the page. When pages are POSTed the www-url-encoded encoding must be used to send all of these input values back to the next transaction.
Programmatic Access to Transaction Services
Any library that submits HTTP v1.1 over TCP/IP can be used to invoke ETP transactions through the REST. In the Java class structure that is the HttpUrlConnection object.
Command Line Access to CICS Transactions
A variety of command-line utilities are available to issue HTTP requests and capture the output. The tools have facilities to maintain the RESTful (application cookie) state between invocations.
- wget http://localhost;8080/SYS1/servlet?transid=TRN1&commaread=hi
- curl http://localhost;8080/SYS1/servlet?transid=TRN1&commaread=hi