19.2.3. Client-Side Handler Configuration

XTS does not require the client application to use a specific API to perform invocations on transactional Web Services. The client is free to use any appropriate API to send SOAP messages to the server and receive SOAP responses. The only requirements imposed on the client are:
  • It must forward details of the current transaction to the server when invoking a web service.
  • It must process any responses from the server in the context of the correct transaction.
In order to achieve this, the client must insert details of the current XTS context into the headers of outgoing SOAP messages, and extract the context details from the headers of incoming messages and associate the context with the current thread. To simplify this process, the XTS module includes handlers which can perform this task automatically. These handlers are designed to work with JAX-WS clients.

Note

If you choose to use a different SOAP client/server infrastructure for business service invocations, you must provide for header processing. XTS only provides interceptors for or JAX-WS. A JAX-RPC handler is provided only for the 1.0 implementation.

19.2.3.1. JAX-WS Client Context Handlers

In order to register the JAX-WS client-side context handler, the client application uses the APIs provided by the javax.xml.ws.BindingProvider and javax.xml.ws.Binding classes, to install a handler chain on the service proxy which is used to invoke the remote endpoint. Refer to the example application client implementation located in the src/com/jboss/jbosstm/xts/demo/BasicClient.java file for an example.
You can also specify the handlers by using a configuration file deployed with the application. The file is identified by attaching a javax.jws.HandlerChain annotation to the interface class, which declares the JAX-WS client API. This interface is normally generated from the web service WSDL port definition.
You need to instantiate the com.arjuna.mw.wst11.client.JaxWSHeaderContextProcessor class when registering a JAX-WS client context handler.