In this tutorial, you use the top-down method to create a Web service provider that sends one or more character strings in the form of a SOAP request to a generated CICS application. The application reads and then reverses each string, and sends the reversed strings back to the Web service as a SOAP response message.
To use the top-down method, you supply a WSDL file that describes the CICS application you want to access. The project template used in this tutorial to create your Enterprise Developer project contains the reverse.wsdl file for this purpose.
To complete this tutorial, you must first install the IBM CCSID Conversion Tables and configure accordingly. See CCSID Conversion Tables for more information.
To complete the Test the Reverse Web service provider section of this tutorial, we recommend that you download and install the SOAPui Eclipse plugin, available from sourceforge.net.
This tutorial assumes that your Enterprise Developer project is set to Build Automatically. If not, turn this feature on by clicking Project > Build Automatically from the main menu.
Use the CICSWebServicesTemplate template project to create a project for your CICS Web service provider.
The COBOL Explorer now shows the Reverse project, which is created in a Reverse subdirectory of your current Eclipse workspace, and is built automatically.
Use the New CICS Web Service wizard to generate the components of your Web service provider.
The Project field should already show the Reverse project name.
You need to provide a URI that Enterprise Server can use to identify and locate the appropriate Web service upon receiving a request or a response. This information goes into the Service location field.
The Request file prefix and Response file prefix fields are completed for you by default. These are the names of the generated copybooks that support the generated skeleton program file, one for request data structures, and one for response data structures.
The Program interface field enables you to specify the generation of either a COMMAREA or a CHANNEL interface in the skeleton program. In this tutorial, you want to generate a CHANNEL interface.
The default container name is DFHWS-DATA, which is the top-level container used in service provider applications for CICS Web services.
Enterprise Developer generates the following CICS Web service components:
The generated skeleton program, reverse.cbl, contains some basic functionality that is common to any CICS Web service that uses the Channel interface, such as:
To provide the required operation logic, you must code it manually by editing the program.
01 ws-string-len pic x(4) comp-5. 01 ws-reversedString-len pic x(4) comp-5.
copy 'revLogic.cpy'.
Perform reverse-logic
Eclipse automatically builds the project to include your changes.
Here you use the Server Explorer in Enterprise Developer to create an enterprise server region on which to run the Web service.
The Server Explorer should now show the CWSPROV enterprise server region listed under Local [localhost:86].
All enterprise server regions require access to certain resources, depending on the types of applications they run. Resources that are defined on a region's startup list are loaded during the startup routine, making them available for as long as the region is running.
CICS Web services use the underlying resources provided by the standard Enterprise Server CICS Web interface (CWI) and CICS Web Services (CWS) support. However, the CICSWebServicesTemplate used to create the CWSPROV region does not include these resources on the startup list; therefore, you need to add them manually. The CWI resources reside in a predefined resource group named DFHWEB. The CWS resources are in the predefined DFHPIPE group.
In addition, you need to create and define a resource group, MYCWSPRV, to contain the resources required by the Reverse program.
On the Home page, you should see the CWSPROV enterprise server region listed.
As the region is starting, the Enterprise Server Administration Home page should show log information in the region's Status Log column. When the region is fully started, this is indicated in the region's Status column.
The CWSPROV region uses the default startup list, named DEMOSTRT.
| Name | CWSTCPIP |
| Description | My TCP/IP Service |
| Port No | 5482 |
| Name | PROVPIPE | |
| Description | My CICS Provider Pipeline | |
| Resp Wait | DEFT | This is the number of seconds that an application waits for a response from the service. DEFT indicates the default value, which is 10 seconds for HTTP and 60 seconds for MQ. |
| Config file | $IDE_XML_LOC\basicsoap11provider.xml | The IDE_XML_LOC environment variable in CWSPROV points to the xml project folder.1 |
| WebSvc Dir | $IDE_LOADLIB\ | The IDE_LOADLIB environment variable points to the loadlib project folder.2 |
|
1 To see a list of environment variables defined for CWSPROV , from the Administration Home page, click the Edit button that corresponds to the CWSPROV region. The list appears in the Configuration Information field on the Server > Properties > General page. 2 The IDE_LOADLIB environment variable is set automatically when you start the enterprise server region from the Enterprise Developer Server Explorer. |
||
You can install the new resources by stopping and starting the region.
After CWSPROV is started, you can verify that the resources you have defined are installed and active.
Notice the value for WSBIND. This value is taken from the information you provided when you created the Web service.
Enterprise Server generates URIMAPs to provide CICS with the information it needs to process requests. The name of each generated URIMAP begins with a pounds sterling symbol (£).
To run your provider CICS Web service, you send a SOAP request to an endpoint URL that routes the request to your enterprise server region. The endpoint URL contains a URI value. The incoming request reads the installed URIMAPs to identify the map whose Path value matches the URI value of the endpoint URL. When the correct URIMAP is identified, CICS uses the data defined in the URIMAP, such as the name of the Web Service and its associated Pipeline, to process the request.
Now that you have your Web service provider running with all of its resources active, you are ready to send a SOAP request to run the Web service. You can do this using any SOAP requester tool such as the SOAPui Eclipse plug-in.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:cws="http://tempuri.org/reverse">
<soapenv:Header/>
<soapenv:Body>
<cws:reverseRequest>
<cws:InputStrings>
<cws:myString>dlroW olleH</cws:myString>
<cws:myString>esaelP eM esreveR</cws:myString>
</cws:InputStrings>
</cws:reverseRequest>
</soapenv:Body>
</soapenv:Envelope>
http://localhost:5482/cwsDemo/reverseMe
You should receive the following SOAP response:
<SOAP-ENV:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:cws="http://tempuri.org/reverse"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<reverseResponse xmlns="http://tempuri.org/reverse">
<OutputStrings>
<reversedString>Hello World</reversedString>
<reversedString>Reverse Me Please</reversedString>
</OutputStrings>
</reverseResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>