How to Create Webservice in CICS

Using the CICS web services assistant utility, you can allow business logic( in Mainframe) to the applications Java/.Net or other.

Web Service utility

IBM has provided a utility called Web services assistant, with which you can create web service. Suppose that you have a CICS program that sends information to the screen. You can create a Web service on top of that CICS program. So the same CICS program can interact with other interfaces(Java/.Net etc.).

The architecture of Web service

Below is the architecture and internal mapping of the Web service.

The architecture of Web service
CICS web service architecture

Steps you need

Suppose that you have an existing CICS application that you wish to expose as a Web service that uses HTTP transport. Suppose also that you wish to use the Web services assistant rather than taking control of the processing yourselves.

CICS service provider
CICS as a service provider

You would perform the following steps:

Generate the wsbind and WSDL files.

a. Create an HFS directory in which to store the generated files. For example, you might create a directory named /u/SharedProjectDirectory/MyFirstWebServiceProvider.

b. Run the DFHLS2WS program. The input you provide to the program includes the following:

  • The names of the partitioned data set members that contain the high-level language structures the application program uses to describe the Web service request and the Web service response
  • The fully qualified HFS names of the wsbind file and the file into which the Web service description is to be written (the WSDL file)
  • The relative URI that a client will use to access the Web service
  • How CICS should pass data to the target application program (COMMAREA or container)

Create a TCPIPSERVICE resource definition.

The resource definition should specify PROTOCOL(HTTP) and supply information about the port on which inbound requests are received.

Create a PIPELINE resource definition.

a. Create a service provider pipeline configuration file.

A pipeline configuration file is an XML file that describes, among other things, the message handler programs, and the SOAP header processing programs that CICS invokes when it processes the pipeline.

b. Create an HFS directory in which to store installable wsbind and WSDL files.

Note: Typically, an application developer would perform this step.
Note: Typically, a systems programmer would perform this step and the subsequent steps. We call this directory the “pickup” directory since CICS will pick up the wsbind and WSDL files from this directory and store them on a “shelf” directory.

c. Create an HFS directory for CICS to store installed wsbind files in. We call this directory the “shelf” directory.

d. Create a PIPELINE resource definition to handle the Web service request.

  • Specify the CONFIGFILE attribute to point to the file created in step 3a.
  • Specify the WSDIR attribute to point to the directory created in step 3b.
  • Specify the SHELF attribute to point to the directory created in step 3c.

e. Copy the wsbind and WSDL files created in step 1 to the pickup directory created in step 3b.

Install the TCPIPSERVICE and PIPELINE resource definitions.

  • When the CICS system programmer installs the PIPELINE definition, CICS scans the pickup directory for wsbind files.
  • When CICS finds the wsbind file created in step 1, CICS dynamically creates and installs a WEBSERVICE resource definition for it.
  • CICS derives the name of the WEBSERVICE definition from the name of the wsbind file. The WEBSERVICE definition identifies the name of the associated PIPELINE definition and points to the location of the wsbind file in the HFS.

Sleeping Wedge to Sleep Comfortably

During the installation of the WEBSERVICE resource:

CICS dynamically creates and installs a URIMAP resource definition. CICS bases the definition on the URI specified in the input to DFHLS2WS in step 1 and stored by DFHLS2WS in the wsbind file.

CICS uses the wsbind file to create main storage control blocks to map the inbound service request (XML) to a COMMAREA or a container and to map to XML the outbound COMMAREA or container that contains the response data.

Note: As an alternative to using the PIPELINE scanning mechanism to install URIMAP resources, you can create and install them using Resource Definition Online (RDO).

Publish the WSDL files to the service requester clients.

a. Customize the location attribute on the element in the WSDL file so that its value specifies the TCP/IP server name of the machine hosting the service and the port number defined in the TCPIPSERVICE defined in step 2.

b. Publish the WSDL to any parties wishing to create clients for this Web service

Get new content delivered directly to your inbox.

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.