Skip to main content

On demand business process life cycle, Part 11: Integrate business processes with CICS transaction servers

Joshy Joseph, Senior Engineer, IBM
Joshy Joseph is a Software Engineer working in IBM Software Group in the IBM On Demand Architecture and Development organization. He is an architect and programmer with primary skills and expertise in the areas of distributed computing, Grid computing, Web services, Business Process, and workflow development. He is the author of the book Grid Computing from Prentice Hall, 2003. In addition, he has written numerous technical articles about grid computing, Business Process development, and Web services.
Douglas Griswold (griswold@us.ibm.com), I/T Specialist, IBM
Douglas Griswold is an IBM Global Services I/T Specialist focused on delivering On Demand solutions. He is part of the IBM Enterprise Component Business Architecture (ECBA) team using WebSphere Process Choreographer and Java 2 Platform, Enterprise Edition (J2EE) Web Services to implement flexible applications capable of responding quickly to a dynamic business environment.

Summary:  Learn how to generate service requester-side artifacts and integrate them with Business Process Execution Language (BPEL) workflow processes. Joshy Joseph and Douglas Griswold provide step-by-step methods for developing service requester-side artifacts needed to invoke legacy Customer Information Control System® (CICS) business logic from a workflow process using the Simple Object Access Protocol (SOAP) for CICS feature, which the CICS Transaction Server (TS) Version 2.3 provides.

Date:  03 May 2005
Level:  Advanced
Activity:  913 views

Introduction

In an on demand business, enterprise-level applications need to integrate with services provided by other applications, both inside and outside the enterprise. In this article, we illustrate how to use the new SOAP for CICS feature offered by the CICS TS to integrate legacy applications with business processes running in IBM® WebSphere® Business Integration Server Foundation.

In Part 10 of this series, we showed how to create a message adapter in CICS TS for XML to COMMAREA conversion and other service provider-side artifacts. In this article, we illustrate how to create the service requester-side artifacts, and we include the step-by-step methods needed to integrate the legacy services with a BPEL workflow process.


Service requester-side changes

We used WebSphere Studio Application Developer Integration Edition and WebSphere Studio Enterprise Developer (Enterprise Developer) tools to generate the requester-side artifacts that are needed to integrate the services provided by the CICS SOAP-enabled transactions. We used WebSphere Studio Application Developer Integration Edition for workflow artifacts development and Enterprise Developer for converting COBOL copybooks to XML schema elements. See Resources for more information on the WebSphere Studio Application Developer Integration Edition and Enterprise Developer.

A Web service consumer/client uses a Web Services Description Language (WSDL) file that describes the services exposed by the CICS server and the definition of data exchanged between the client and the service.

You can use Enterprise Developer for performing the following steps:

  1. Create XML schema files from the COBOL copybook ,which represents the input and output business logic program COMMAREA (see the sidebar Limitations of Enterprise Developer tools -- generated COMMAREA XML schema).
  2. Generate a WSDL file for the services exposed by the CICS server that includes the XML schema elements from the above step.

Note that in a top-down approach, in addition to Enterprise Developer, you could use IBM WebSphere Business Integration Server Foundation to build a WSDL file that represents the services provided by the CICS SOAP-enabled transactions.

Listing 1 shows the WSDL file that represents the CICS order validation program.


Listing 1. WSDL file
				


<wsdl:definitions name="CoatsCicsServices" 
           targetNamespace=http://tempuri.org/CoatsCicsServices/ 
xmlns:tns="http://tempuri.org/CoatsCicsServices/" 
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xsd1="http://www.coats.com/schemas/ValidateOrderIInterface" 
xmlns:xsd2="http://www.coats.com/schemas/ValidateOrderOInterface">
<wsdl:types>
   <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <xsd:import namespace="http://www.coats.com/schemas/ValidateOrderOInterface"     
schemaLocation="../www/schemas/ValidateOrderOInterface/ValidateOrderResponse.xsd">
      </xsd:import>
      <xsd:import namespace="http://www.coats.com/schemas/ValidateOrderIInterface" 
schemaLocation="../www/schemas/ValidateOrderIInterface/ValidateOrderRequest.xsd">
      </xsd:import>
   </xsd:schema>
</wsdl:types>
<wsdl:message name="ValidateOrderIMessage">
    <wsdl:part name="ValidateOrderRequest" type="xsd1:ValidateOrderRequest">
          </wsdl:part>
</wsdl:message>
<wsdl:message name="ValidateOrderOMessage">
    <wsdl:part name="ValidateOrderResponse" type="xsd2:ValidateOrderResponse">
          </wsdl:part>
</wsdl:message>
<wsdl:portType name="ValidateOrderPortType">
    <wsdl:operation name="ValidateOrderOperation">
       <wsdl:input message="tns:ValidateOrderIMessage" 
                  name="ValidateOrderOperationInput">
         </wsdl:input>
       <wsdl:output message="tns:ValidateOrderOMessage" 
                  name="ValidateOrderOperationOutput">
       </wsdl:output>
    </wsdl:operation>
</wsdl:portType>
<wsdl:binding name="CoatsSOAPBinding" type="tns:ValidateOrderPortType">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
    <wsdl:operation name="ValidateOrderOperation">
        <soap:operation 
              soapAction="http://tempuri.org/CoatsCicsServices/ValidateOrderOperation" />
        <wsdl:input name="ValidateOrderOperationInput">
            <soap:body use="literal" parts="ValidateOrderRequest"/>
        </wsdl:input>
        <wsdl:output name="ValidateOrderOperationOutput">
            <soap:body use="literal" parts="ValidateOrderResponse"/>
        </wsdl:output>
    </wsdl:operation>
</wsdl:binding>
<wsdl:service name="CoatsSOAPService">
    <wsdl:port name="CoatsSOAPServicePort" binding="tns:CoatsSOAPBinding">
        <soap:address 
              location="http://cics.server.host:5432/CICS/XWBA/DFHWSDSH/ORDVLDT" />
     </wsdl:port>
</wsdl:service>
</wsdl:definitions> 

The following sections illustrate the steps needed to integrate the CICS services represented in the WSDL file (Listing 1) with a workflow. WebSphere Studio Application Developer Integration Edition Version 5.1.1 was used to develop a WebSphere Process Choreographer BPEL workflow. The major steps are:

  1. Set up the WebSphere Studio Application Developer Integration Edition workspace with CICS service WSDL and XML schema files
  2. Create client-side proxies from WSDL.
  3. Create a wrapper service implementation, WSDL, and binding for the client proxy.
  4. Create a business process workflow to invoke the CICS service.
  5. Generate the BPEL deploy code.

Step 1. Set up the WebSphere Studio Application Developer Integration Edition workspace with CICS service WSDL and XML schema files

If the WSDL was created outside Step 1, import it. You also need to import the XML schema files referenced by the WSDL file that specify the request and response message formats.

As shown in Listing 1, the service port address specified in the WSDL file is: location=http://cics.server.host:5432/CICS/XWBA/DFHWSDSH/ORDVLDT. Your CICS host is located at cics.server.host and is listening on port 5432 for incoming HTTP requests. The CICS region specified is XWBA and the message adapter program is called ORDVLDT. This is a fictitious URL, so the sample application below demonstrates a technique and is not intended to produce a working CICS service.

Figure 1 shows the workspace after creating or importing the CICS service WSDL file and the XML schema for its input and output. The XML schema package names reflect those specified by the type of WSDL namespaces. As mentioned in Part 10 of this series, these namespace declarations are required to map the request/response to the correct proxy code used for marshalling/unmarshalling XML to native runtime classes.


Figure 1. WebSphere Studio Application Developer Integration Edition workspace with CICS service WSDL and XML schema files
WebSphere Studio Application Developer Integration Edition workspace with CICS service WSDL and XML schema files

Limitations of Enterprise Developer-generated COMMAREA XML schema

The CICS service-side COBOL XML request message parser we developed in Part 10 of this series is SAX-based (non-validating), and the response message is built as a text string (also without XML validation). In addition to this problem, when Enterprise Developer is used to generate the XML schema from a COBOL COMMAREA, any arrays contained within the COMMAREA structure must occur the maximum times. For example, your order validation results response COMMAREA structure specifies 100 returned elements: 03 VALIDATION-RESULTS-ARRAY OCCURS 100 TIMES.. The generated XML schema for this element specify minOccurs="100" maxOccurs="100".

Although the CICS service side is non-validating, the WebSphere client proxy validates against the schema. Using the example above, you should always expect 100 search results. This is also probably not the desired behavior.

To avoid these limitations, you can use Enterprise Developer to generate an XML schema that you'll use as a starting point or template. Furthermore, you can make the following modifications:

  1. Adjust the array minOccurs/maxOccurs values to reflect the ranges supported in the message adapter.
  2. Implement other XML schema supported data integrity restrictions, such as enumeration lists.
  3. Give more meaningful names to the XML elements instead of using the COMMAREA names that are automatically generated.

Step 2. Create the client proxy

The WebSphere Application Server Enterprise Process Choreographer workflow acts as the Web service client/consumer by setting up and calling the SOAP CICS Web service. It also uses the returned results in the workflow activities that follow. In WebSphere Studio Application Developer Integration Edition, the Web service client code can be automatically generated from the WSDL file. To complete this step, right-click on the WSDL file and choose Enterprise Services-Generate Service Proxy. This option launches a wizard, as shown in Figure 2. For your example scenario, you need to select the Web Services Invocation Framework (WSIF) proxy type.


Figure 2. Proxy selection wizard
Proxy Selection Wizard

This option displays another dialog box, as shown in Figure 3. You need to make sure to select Generate helper classes. This generates the Java™ classes needed to marshall and unmarshall the SOAP XML for the CICS SOAP request and response. Also, select a package name for the generated proxy class.


Figure 3. Generate service proxy wizard
Generate service proxy Wizard

Click Next to display another dialog, as shown in Figure 4. Select Client stub proxy style and select the WSDL operations that will be accessed from the workflow. Click Finish.


Figure 4. Service operations selection wizard
Service operations selection wizard

Figure 5 shows the newly generated Web service proxy files. Before generating the proxy, only the highlighted WSDL and XML schema existed. After the generation, the proxy and helper classes have been created.


Figure 5. WebSphere Studio Application Developer Integration Edition workspace after client proxy generation
WebSphere Studio Application Developer Integration Edition workspace after client proxy generation

Step 3. Create a wrapper service, WSDL, and service binding for the client proxy

Create a new Java class with methods for each of the WSDL operations. In this example, you'll only have one method. The helper classes you generated in the previous step are used to map data elements between XML and Java. Figure 6 shows a view of this mapping to the request message. The response message is mapped in a similar fashion.


Figure 6. Mapping of request XML schema elements to Java helper class
Mapping of request XML schema elements to Java helper class

The implementation code of your wrapper Web service client uses the Java classes corresponding to the XML schema to build the SOAP CICS request.

Listing 2 shows sample code that builds the Java classes for the SOAP message and calls the proxy to invoke the CICS service. You have one method, ValidateOrder, that corresponds to the WSDL operation you have selected. You build the request XML document starting from the innermost element and work your way out to the root element. You also use the generated helper classes to process the response. As shown in Listing 2, the response message works the opposite way. Here you start at the root XML element and work your way down through the elements it contains.


Listing 2. Service wrapper
				
public class COATSAccess {
  public void ValidateOrder(String requestType) {
    // set up CICS SOAP request 
    ValidateOrderPortTypeProxy aProxy = new ValidateOrderPortTypeProxy();
    FeatureList.FeatureListItemElementLocal featureListElement1 = new
    FeatureList.FeatureListItemElementLocal();
    featureListElement1.setFeatureCode("Storage");
    featureListElement1.setQuantity(2);
    FeatureList featureList = new FeatureList();
    featureList.setFeatureListItem(0, featureListElement1);
    FeatureList.FeatureListItemElementLocal featureListElement2 = new
    FeatureList.FeatureListItemElementLocal();
    featureListElement2.setFeatureCode("Memory");
    featureListElement2.setQuantity(6);
    featureList.setFeatureListItem(1, featureListElement2);
    
    ValidateOrderRequest validateOrderRequest = new ValidateOrderRequest();
    validateOrderRequest.setOrderNumber("1234567");
    validateOrderRequest.setType("Online");
    validateOrderRequest.setFeatList(featureList);
    
     // call the CICS SOAP web service
    ValidateOrderResponse validateOrderResponse = 
aProxy.ValidateOrderOperation(validateOrderRequest);

    // process CICS SOAP response  
   OrderMessages orderResponse = validateOrderResponse.getMessages();
   OrderMessageElementLocal[] orderMessages = orderResponse.getOrderMessage();
    System.out.println("CICS Web Service SOAP Response: " +
                       "Return Code:" + validateOrderResponse.getReturnCode() );
    for (int i = 0; i < orderMessages.length; i++) {
        System.out.println("Message Prefix: " + orderMessages[i].getMessagePrefix() +
			  ", Text: " + orderMessages[i].getMessageText());
    }
  }
}

Now generate a service WSDL from this Java class. Right-click the wrapper class and select the New-Service Built From tool option. Select the correct options and generate the WSDL for the exposed service methods, as shown in Figure 7.


Figure 7. New Java service
New Java service

This creates a COATSAccessJavaService.wsdl file. Now, you need to generate the binding and deployment files from the WSDL. Right-click on this WSDL file and select Enterprise Services-Generate Deploy Code. As shown in Figure 8, choose SOAP as the inbound binding and click Finish.


Figure 8. Generate deploy code
Generate deploy code

Step 4: Create a business process workflow to invoke the CICS service

This section illustrates how to create a simple business process to invoke the CICS service wrapper created in Step 3. This service wrapper in turn calls the CICS service using the SOAP client proxy created in Step 2.

Select File > New > Business Process from the WebSphere Studio Application Developer Integration Edition workbench. Figure 9 shows a dialog to provide a name and package for the new BPEL process.


Figure 9. New business process
New business process

As shown in the Figure 10, choose a Sequence-based BPEL and click Finish. This generates a BPEL and opens the BPEL editor in WebSphere Studio Application Developer Integration Edition.


Figure 10. Process type
Process type

As shown in Figure 11, insert a new partner link named ValidateOrder. On the Implementation tab, click New next to Partner Link Type.


Figure 11. Insert PartnerLink
Insert PartnerLink

This option displays a dialog box, as shown in Figure 12. Choose One Role. Name the role "validate" and click Browse. Locate your service wrapper WSDL file (COATSAccess.wsdl) and click OK.


Figure 12. New PartnerLink
New PartnerLink

As shown in Figure 13, create two process variables -- one for input (ValidateIn) into the service invoke and one for the output (ValidateOut).


Figure 13. Create new variables
Create new variables

Click the "ValidateIn" variable and then click Browse to the right of file in the Message tab. Locate the WSDL for the wrapper service and then choose the input request, as shown in Figure 14.


Figure 14. Select a message from WSDL
Select a message from WSDL

Follow the same process for ValidateOut and point it to the "ValidateOrderResponse" part in the WSDL file.

Now, add an invoke activity between "Receive" and "Reply" activities to call the CICS service from the process. Wire the new InvokeOrderValidation activity to the partner link and operation and to the input and output process variables you created above, as shown in Figure 15.


Figure 15. Invoke order validate service
Invoke order validate service

Step 5. Generate the BPEL deploy code

Right-click the process BPEL file (OrderValidate.bpel) and select Enterprise Services-Generate Deploy Code.

Click the Referenced Partners (ValidateOrder) and click "Browse" to locate the service WSDL file ("COATSAccessJavaService.wsdl") for the Java service wrapper you created in Step 3. Then click OK to generate BPEL deploy code.


Figure 16. Generate BPEL deploy code
Generate BPEL deploy code

You're now ready to run the process, which calls the CICS Web service.


Conclusion

In this article, we showed step-by-step methods for developing the artifacts needed to invoke legacy CICS business logic from a workflow process using the SOAP for CICS feature. We showed how to develop service requester-side artifacts and how to integrate the CICS services with the workflow. In addition, we described the use of various tools including Enterprise Developer, WebSphere Studio Application Developer Integration Edition, and runtime environments, such as WebSphere Business Integration Server Foundation and CICS.


Resources

About the authors

Joshy Joseph is a Software Engineer working in IBM Software Group in the IBM On Demand Architecture and Development organization. He is an architect and programmer with primary skills and expertise in the areas of distributed computing, Grid computing, Web services, Business Process, and workflow development. He is the author of the book Grid Computing from Prentice Hall, 2003. In addition, he has written numerous technical articles about grid computing, Business Process development, and Web services.

Douglas Griswold is an IBM Global Services I/T Specialist focused on delivering On Demand solutions. He is part of the IBM Enterprise Component Business Architecture (ECBA) team using WebSphere Process Choreographer and Java 2 Platform, Enterprise Edition (J2EE) Web Services to implement flexible applications capable of responding quickly to a dynamic business environment.

Comments (Undergoing maintenance)



Trademarks  |  My developerWorks terms and conditions

Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=SOA and Web services
ArticleID=82523
ArticleTitle=On demand business process life cycle, Part 11: Integrate business processes with CICS transaction servers
publish-date=05032005
author1-email=
author1-email-cc=
author2-email=griswold@us.ibm.com
author2-email-cc=flanders@us.ibm.com

My developerWorks community

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere).

My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Rate a product. Write a review.

Special offers