Skip to main content

skip to main content

developerWorks  >  Rational | SOA and Web services  >

IBM Enterprise Modernization for System z: Wrap existing COBOL programs as Web Services with IBM Rational Developer for System z

Extend value of existing enterprise software assets

developerWorks
Go to the previous pagePage 5 of 10 Go to the next page

Document options
PDF format - Fits A4 and Letter

PDF - Fits A4 and Letter
1693 KB

Get Adobe® Reader®

Discuss


My developerWorks needs you!

Connect to your technical community


Rate this tutorial

Help us improve this content


Generate the required elements

Now you need to generate the converter driver, input and output converters, XML schemas, WSDL, and the required CICS file (WSBind).

  1. Right-click the LAB3POT.cbl program under the Lab3_CICS_Services project and select Generate Web Services for CICS resources, as shown in Figure 19.

This will launch the Web Service Runtime and Scenario Selection dialog, where you can specify the necessary options to start the Web service wizard.

Because you are starting from the COBOL program to create the Web services, this is called a bottom-up operation.


Figure 19. Selecting Generate Web Services for CICS resources
Selecting Generate             Web Services

  1. Also, because you want to select just one field as the input message (customer number), you will need to specify a Conversion type of Compiled XML Conversion.
  2. Accept all of the defaults and click Start to begin the Web service wizard, as shown in Figure 20.

Figure 20.Beginning the Web service wizard
Begining the wizard

Pros and cons of conversion types

There are two conversion types available for this scenario and runtime combination. You may select either Compiled XML Conversion or Interpretive XML Conversion from the Web Service Runtime and Scenario Selection dialog. The choice of conversion type involves considering the benefits and cost of either technology.

Compiled XML Conversion. A driver program interacts with the runtime and invokes bundled programs to provide conversion of XML to and from language structures. The compiled XML conversion type provides more extensive support for language structure data types and constructs than the interpretive XML conversion type; however, you have to compile XML Converters, and there are more artifacts to manage.

Interpretive XML Conversion: XML conversion is accomplished using generated metadata and an XML conversion component built into the runtime. Although the Interpretive XML Conversion type has limited support for language structure data types and constructs, it requires fewer artifacts and does not require you to compile XML converters.

  1. On the Web Services for CICS – Create New Service Interface wizard, make sure that the Inbound Language Structure tab is selected.
  2. Expand DFHCOMMAREA by clicking the + (plus) sign next to it, and then select CustNo as the only element that will form the data structure for the inbound XML converter, as shown in Figure 21.

Figure 21. Expanding DFHCOMMAREA
Expanding the data             structure

  1. Select the Outbound Language Structure tab. Click the checkbox next to DFHCOMMAREA to select all the data items as the data structure for the outbound XML converter, as shown in Figure 22. Click Next.

Figure 22. Selecting all the data items as the data structure
Selecting the data items

  1. On the Generation Options page, make sure that the XML Converter tab is selected.
  2. Type LAB324 as the Converter program name prefix (instead of LAB3POT), as shown in Figure 23.

Figure 23. Specify the identification attributes
Specifying the attributes

  1. Select the WSDL and XSD tab and specify the following as the endpoint URI, as shown in Figure 24: http://zserveros.dfw.ibm.com:3091/wdz/LAB3POT
    You can copy this from the file located at C:\RDz_POT_V7\LAB3\Lab3_CICS_Services_URI.txt . This will be the TCP/IP address that is used to reach the target CICS system where the conversion program (LAB324D) is deployed. The transport used is HTTP. The local URI portion (/wdz/LAB3POT) will be used to create the URIMAP on CICS for matching URI requests. The port number used for CICS Web Services is 3091.

Figure 24. Specifying the WSDL properties
Specifying the properties

  1. Click the Advanced Options tab.
  1. Expand Specify XML Schema generation options, clear Generate qualified elements in XML Schemas, and then click Next, as shown in Figure 25. (Normally you don’t need to worry about this choice, but you will invoke a CICS Web service deployed with Rational Developer for System z V7.0, a previous version that did not have this capability.)

Figure 25. Specify XML Schema generation options
Specifying the options

  1. On the Web Services for CICS page, select the Basic Options tab.
  2. Accept the default WSBind file name of LAB3POT, and the Program interface of COMMAREA, and then click Next, as shown in Figure 26.

    Figure 26. Selecting Basic Options
    Specifying the options

Can I use CHANNEL instead of COMMAREA to avoid the 32K limit?

Yes. CICS v3 and later allows the use of a channel (container) that solves the infamous 32K limit. The program interface can use either the COMMAREA or the new CHANNEL support in CICS. If the CICS application program communicates through a channel, you must specify the container name.

  1. On the File, data set, or member selection page, under the XML Converters tab, make sure that LAB324D is specified as the Converter driver file name.
  2. Also make sure that the checkbox to Generate all to driver is selected, as shown in Figure 27. This generates all of the components to the same file.

Figure 27. Selecting the Generate all to driver option
Selecting the checkbox

  1. Select the WSDL and XSD tab. No changes are required here. Note the WSDL and XSD (schemas) names that will be generated, as shown in Figure 28.

Figure 28. The generated WSDL and XSD schemas
The generated schemas

  1. Click Finish to complete the generation of the conversion program (converter driver and input and output converters), WSBind, XSD, and WSDL files.
  2. After the Web Services Enablement wizard completes its generation, you should see several additional artifacts in the LAB3_CICS_Services Project under the Generation folder, as shown in Figure 29:
    • The *.xml files are properties that will be used in the next wizard generation run.
    • LAB324.wsdl. This is the WSDL file that describes this CICS based Web service.
    • LAB324D.cbl. This is the conversion program, which is made up of the converter driver and input and output converters.
    • LAB324I.xsd and LAB324O.xsd. These are the XML Schema Definition files that describe the input and output XML documents, respectively.
    • The *.log file that is the generation log.
    • LAB3POT.wsbind. This is the WSBind file that tells CICS how conversion is to be performed, and what the URI map looks like.

Figure 29. Targets artifacts
The generated schemas

  1. Double-click LAB324D.cbl and use the z/OS LPEX Editor to explore the code, as shown in Figure 30. This will help you understand the productivity that you gained from not having to develop the message converter manually. Note that LAB324D.cbl file is in fact made of multiple programs. The main program calls the various subroutines. All will be deployed as a simple load module named LAB324D.

Figure 30. Explore the generated code
Exploring the code

  1. Remember that since you want to pass just the customer number as input, you need to select the compiled XML conversion type instead of the interpreted XML conversion type. When you specify the compiled conversion type, the XML parsing will be done by the COBOL converter program instead of by CICS.
  2. Use Ctrl+F and find the XML Parse command. This is an example of the parsing being done by the converter, as shown in Figure 31.

Note also that the converter driver for CICS Web Services is different from the driver for SOAP for CICS Version 2.2, specifically regarding its interaction with the original existing application program. The SOAP for CICS driver contains an EXEC CICS LINK to the original existing application program.

The CICS Web Services driver has no call at all to that program. This is because CICS Web Services is responsible for calling that application program. If you do a search for “EXEC CICS LINK” you will not find any instances.

What you have done so far

You have created a project to hold the Web Services components, imported the LAB3POT program, and generated the necessary components that will create the CICS Web Services. You are now ready to deploy the CICS Web Services. Note that in this case, the deployment has already been done for you: you will just test it using the WSDL generated.


Figure 31. An example of the parsing
An example of parsing

  1. Press Esc and Close the editor (Ctrl+F4).
  2. Verify the WSDL that was generated: double-click LAB324D.wsdl and use the WSDL Editor to visualize the input and output messages, as shown in Figure 32.

Figure 32. Using the WSDL Editor
Using the editor

  1. When you finish, Close this editor (Ctrl+F4).
  2. Double click LAB3POT.wsbind. Rational Developer for System z (Version 7.1 and later) has added the capability to visualize the binary contents of the WSBind file. Note the Service Interface and Pipeline properties, as well as the Target Server program to be invoked (LAB3POT) using COMMAREA., as shown in Figure 33.

Figure 33. Web Service binding file viewer
Web Service file

  1. Close the file being edited (Ctrl+F4)


Back to top



Go to the previous pagePage 5 of 10 Go to the next page