WebSphere Application Server Version 6.1 Feature Pack for Web Services
             Operating Systems: AIX, HP-UX, i5/OS, Linux, Solaris, Windows, z/OS

             Personalize the table of contents and search results
             New or updated topic for this feature pack

Example: Code for creating a sequence

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.

Before you begin

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.

Example

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;



Related tasks
Learning about WS-ReliableMessaging
Controlling WS-ReliableMessaging sequences programmatically
Related reference
Example: Code for sending an acknowledgement request
Example: Code for closing a sequence
Example: Code for terminating a sequence
Example: Code for waiting for a sequence to complete
Reference topic    

Terms of Use | Feedback

Last updated: Nov 25, 2008 2:35:59 AM CST
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.wsfep.multiplatform.doc/info/ae/ae/rwbs_wsrm_prog_seq_create.html