WS-RM Demo
==========

This demo shows how to enable WS-ReliableMessaging support in $SUBSTITUTE_NAME$.  

The client and server both use interceptor configuration to install the
WS-RM interceptors, comprising logical interceptors 
(RMInInterceptor/RMOutInterceptor) responsible for managing the reliability 
properties of the current message, and a protocol interceptor 
(RMSoapInterceptor) responsible for encoding/decoding these properties as SOAP 
Headers.

As WS-RM is dependent on WS-Addressing, the configuration uses the same approach 
as the ws_addressing sample to enable this functionality. However, notice that 
the WS-Addressing namespace URI is different in this case 
(http://schemas.xmlsoap.org/ws/2004/08/addressing instead of
http://www.w3.org/2005/08/addressing). This is because the WS-RM
specification is still based on an older version of WS-Addressing.

Three additional interceptors are configured: 

- LoggingInInterceptor is used on both the client and server side to log the 
  inbound SOAP messages and display them to the console. Notice the usage of 
  out-of-band RM protocol messages (CreateSequence and CreateSequenceResponse)
  and the WS-RM headers in application-level messages (Sequence,
  SequenceAcknowledgement, AckRequested etc.)  

- LoggingOutInterceptor is used on both the client and server side to log the 
  outbound SOAP messages and display them to the console.

- MessageLossSimulator is used on the client side only to simulate message 
  loss by discarding every second application-level message. This simulated 
  unreliability allows the retransmission of unacknowledged messages to be 
  observed.

This demo also illustrates usage of the decoupled HTTP transport, whereby
a separate server->client HTTP connection is used to deliver responses
to (application or RM protocol) requests and server-side originated 
standalone acknowledgments.

The "partial response" referred to in the log output is the payload of
the HTTP 202 Accepted response sent on the back-channel of the original 
client->server connection. 

Please review the README in the samples directory before continuing.


Prerequisite
------------

$SUBSTITUTE_PREREQ$

Building and running the demo using ant
---------------------------------------

From the samples/ws_rm directory, use the following commands to build and 
run the demo on either UNIX or Windows:

  ant build
  ant server
  ant client

On startup, the client makes a sequence of four oneway invocations.
The output of the logging interceptors will show that only the first and third
reach their destination. Notice how after about two seconds the
messages that have arrived at the server are acknowledged, and how after about 
four seconds the client resends the second and fourth application messages. 
These are acknowledged a further two seconds later so that there are no further 
retransmissions from the client.

To remove the code generated from the WSDL file and the .class files, run:

  ant clean


Building the demo using wsdl2java and javac
-------------------------------------------

From the samples/ws_rm directory, first create the target directory
build/classes and then generate code from the WSDL file.

For UNIX:
  mkdir -p build/classes

  wsdl2java -d build/classes -compile ./wsdl/hello_world_rm.wsdl

For Windows:
  mkdir build\classes
    (Use back slashes.)

  wsdl2java -d build\classes -compile .\wsdl\hello_world_rm.wsdl
    (Use either forward or backslashes.)

Now compile the provided client and server applications with the commands:

For UNIX:  
  
  export CLASSPATH=$CLASSPATH:./build/classes
  javac -d build/classes src/demo/ws_rm/common/*.java
  javac -d build/classes src/demo/ws_rm/client/*.java
  javac -d build/classes src/demo/ws_rm/server/*.java

For Windows:

  set classpath=%classpath%;.\build\classes
  javac -d build\classes src\demo\ws_rm\common\*.java
  javac -d build\classes src\demo\ws_rm\client\*.java
  javac -d build\classes src\demo\ws_rm\server\*.java

Running the demo using java
---------------------------

From the samples/ws_rm directory run the commands (entered on a single command 
line):

For UNIX (use forward slashes):

    java -Djava.util.logging.config.file=./logging.properties
         demo.ws_rm.server.Server &

    java -Djava.util.logging.config.file=./logging.properties
         demo.ws_rm.client.Client ./wsdl/hello_world_rm.wsdl

The server process starts in the background.

For Windows (use either forward or backslashes):
  start 
    java -Djava.util.logging.config.file=.\logging.properties
         demo.ws_rm.server.Server

    java -Djava.util.logging.config.file=.\logging.properties
         demo.ws_rm.client.Client .\wsdl\hello_world_rm.wsdl

The server process starts in a new command window.

After running the client, terminate the server process.
