WS-Policy Demo
==============

This demo shows how the WS-Policy framework in $SUBSTITUTE_NAME$ uses WSDL 1.1 
Policy attachments to enable WS-Addressing.

While most of the demo is similar to the ws_addressing demo, there are two 
major differences:

1. A Policy element containing an Addressing assertion is attached to the port 
   element in the demo's WSDL.

2. The configuration files for the client and server specify that the 
   $SUBSTITUTE_NAME$ policy engine should be enabled. 

In addition, the configuration file for the server tells the policy engine where 
to look for external policy attachments. This is required since neither the 
implementor nor the interface specify wsdlLocation in their WebService 
annotation (the client could also use external policy attachments instead of 
WSDL 1.1 attachments).

Note: Apart from the decoupled HTTP endpoint on which the client receives 
responses from the server, you don't need to configure anything else. For 
example, there is no need to specify the WS-Addressing interceptors. The 
internals of ensuring that addressing headers are added to the messages (namely, 
adding two addressing interceptors to the inbound and outbound fault and message 
processing chains) are left to the policy framework's built-in support for the 
Addressing assertion.

Please review the README in the samples directory before continuing.


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

$SUBSTITUTE_PREREQ$

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

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

  ant build
  ant server
  ant client

Although not explicitly instructed to use these interceptors, both client and 
server use the MAPAggregator and MAPCodec interceptors to aggregate and encode 
the WS-Addressing MAPs.

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_policy directory, first create the target directory
build/classes and then generate code from the WSDL file.

For UNIX:

  mkdir -p build/classes
  $THE_TOOL$ wsdl2java -d build/classes -compile ./wsdl/hello_world_addr_policy.wsdl

For Windows:

  mkdir build\classes
    (Use back slashes.)

  $THE_TOOL$ wsdl2java -d build\classes -compile .\wsdl\hello_world_addr_policy.wsdl
    (Use either forward or back slashes.)

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_policy/common/*.java
  javac -d build/classes src/demo/ws_policy/client/*.java
  javac -d build/classes src/demo/ws_policy/server/*.java

For Windows:

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

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

From the samples/ws_policy directory run the following commands on a single 
command line:

For UNIX (use forward slashes):

    java -Djava.util.logging.config.file=./logging.properties
         -Dcxf.config.file=server.xml
         demo.ws_policy.server.Server &

    java -Djava.util.logging.config.file=./logging.properties
         -Dcxf.config.file=client.xml
         demo.ws_policy.client.Client

The server process starts in the background.

For Windows (use either forward or back slashes):

  start 
    java -Djava.util.logging.config.file=.\logging.properties
         -Dcxf.config.file=server.xml
         demo.ws_policy.server.Server

    java -Djava.util.logging.config.file=.\logging.properties
         -Dcxf.config.file=client.xml
         demo.ws_policy.client.Client

The server process starts in a new command window.

After running the client, terminate the server process.
