How Do I: Use a Conversational Web Service With a Non-Conversational Web Service?

In a usecase where a conversational web service calls a non-conversational web service, the response message has to be correlated with the waiting callback. This topic discusses the best practice for doing this.

In the following scenario, CS is the Conversational Server and NCS is the Non-Conversational Server it communicates with. The web service client invokes the Conversational Server, sending its conversation ID. It expects a callback with that conversation ID.

When CS invokes NCS, it populates the message with the conversation ID that came from the web service client. NCS, in turn, sends a response message to CS over a non-conversational invocation. Now the response message must be correlated with the waiting callback at the JWS of CS. Since it is not a conversational invocation, the WSClient ID is not included.

The accepted best practice for solving this problem is as follows.

  1. When CS is invoked, the user code must capture the conversation ID.
  2. When CS invokes NCS, CS must send the captured id to the message flowing to NCS.
  3. When NCS responds to CS, it must set the conversation ID back to the SOAP header of the returned message.
  4. The ID in the callback to WSClient can now be correlated to conversation ID by using the ID embedded in the SOAP header.

Related Topics

Overview: Conversations

How Do I: Add Support for Conversations?

Building a JMS Client

Accessing SOAP Attachments in Web Services

Specifying SOAP Handlers for a Web Service

Conversing with Non-Workshop Clients

Specifying Message Headers and Properties