Invoking a web service from an application deployed with the web services assistant

A service requester application that is deployed with the web services assistant uses the EXEC CICS INVOKE SERVICE command to invoke a web service. The request and response are mapped to a data structure in container DFHWS-DATA. This method of invoking a service is not supported for JSON.

Procedure

  1. Create a channel and populate it with containers.
    At the minimum, container DFHWS-DATA must be present. DFHWS-DATA holds the top level data structure that CICS® will convert into a SOAP request. If the SOAP request contains any arrays that have varying numbers of elements, they are represented as a series of connected data structures in a series of containers. These containers must also be present in the channel.
  2. Invoke the target web service.
    Use the following command:
    EXEC CICS INVOKE SERVICE(webservice)
                     CHANNEL(userchannel)
                     OPERATION(operation)
    where:
    • webservice is the name of the WEBSERVICE resource that defines the web service to be invoked. The WEBSERVICE resource specifies the location of the web service description and the web service binding file that CICS uses when it communicates with the web service.
    • userchannel is the channel that holds container DFHWS-DATA and any other containers associated with the application's data structure.
    • operation is the name of the operation that is to be invoked in the target web service.
    For more information, see Local optimization for web services.
  3. If the command was successful, retrieve the response containers from the channel.
    At the minimum, container DFHWS-DATA will be present. It holds the top level data structure that CICS created from the SOAP response. If the response contains any arrays that have varying numbers of elements, they are a represented as series of connected data structures in a series of containers. These containers will be present in the channel.
  4. If the service requester receives a SOAP fault message from the invoked web service, you must decide if the application program should roll back any changes.
    If a SOAP fault occurs, an INVREQ error with a RESP2 value of 6 is returned to the application program. However, if optimization is in effect, the same transaction is used in both the requester and provider. If an error occurs in a locally optimized web service provider, all of the work done by the transaction rolls back in both the provider and the requester. An INVREQ error is returned to the requester with a RESP2 value of 16.