Your client application can take programmatic control of WS-ReliableMessaging sequences. Use these code fragments as guidance for coding your reliable messaging client application to create a sequence.
For your client application to gain programmatic control over reliable messaging sequences, it needs access to a WSRMSequenceManager instance. The first of the following code examples includes code to create a WSRMSequenceManager object. If you need more information about working with this object, see Controlling WS-ReliableMessaging sequences programmatically.
To create a new reliable messaging sequence, first create a WSRMSequenceProperties object:
import com.ibm.wsspi.wsrm.WSRMSequenceProperties ......... WSRMSequenceManager sequenceManager = WSRMSequenceManagerFactory .getInstance().createWSRMSequenceManager(); WSRMSequenceProperties sequenceProperties = sequenceManager .createNewWSRMSequenceProperties();
To set the available properties use the following methods:
/** * Sets the target provider endpoint. * A null value will cause a NullPointerException when the WSRMSequenceProperties object is used. * * @param providerEndPoint The target service endpoint URI */ public void setTargetEndpointUri(String providerEndPoint); /** * This is used to indicate that a response flow is required between the provider and requester and the response * flow will be established at create sequence time * * By calling this method it will indicate that a response flow is required. */ public void setUseOfferedSequenceId(); /** * Set the Soap version for RM protocol messages. * The default value for this property is WSRMSequenceProperties.SOAP_11 * * @param soapVersion */ public void setSoapVersion(int soapVersion); /** * If the Sequence Acknowledgement messages are to be sent back asynchronously call this method. * */ public void useAsyncTransport();
To create the reliable messaging sequence use the createNewWSRMSequence method on the WSRMSequenceManager:
/** * Initiates a new sequence handshake between this client and the target EPR specified in the * WSRMSequenceProperties instance. * * This sequence will only be valid for the client issuing the createNewWSRMSequence call. * * When returning from this call, there is no guarantee that the sequence has been established. * * @throws NullPointerException if the sequenceProperties object is null, or the target EPR is null * * @param clientObject The JAX-WS Dispatch instance, or the Dynamic Proxy client instance. * @param sequencePropeties The properties for creating the reliable messaging sequence * @throws WSRMNotEnabledException * @throws WSRMSequenceAlreadyExistsException */ public void createNewWSRMSequence(Object clientObject, QName portQName, WSRMSequenceProperties sequencePropeties) throws WSRMNotEnabledException, WSRMSequenceAlreadyExistsException;