Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Introducing the Sample

This sample demonstrates how JAX-WS handlers are used in the WSO2 Application Server. The server uses a SOAP protocol handler, which logs incoming and outgoing messages to the console. The server code registers a handler using the @HandlerChain annotation within the service implementation class. In this sample, LoggingHandler is the SOAPHandler that logs the entire SOAP message content to stdout.

The client includes a logical handler that checks the parameters on outbound requests and short-circuits the invocation in certain circumstances. This handler is specified programmatically.

Building and Running the Sample 

Using Maven

1. Install and run the WSO2 Application Server. Refer to the  Installation Guide for instructions.

2. From the base directory of this sample (<CARBON_HOME>\samples\Jaxws-Jaxrs\handlers_jaxws), the maven pom.xml file can be used to build and run the sample using either UNIX or Windows.

3. To build the sample and create a WAR file, run mvn clean install command.

4. Start the Application Server (run bin/wso2server.sh/.bat).

  • mvn -Pdeploy (deploys the generated WAR file on WSO2 AS with related logs on the console)
  • mvn -Pclient (runs the client)

Using Apache Ant 

1. Run "ant" on <CARBON_HOME>\samples\Jaxws-Jaxrs\handlers_jaxws directory to deploy the "handlers_jaxws" service on the server.

2. Start the application server and access its Management Console at https://localhost:9443/carbon.

3. Go to "Services -> List" menu to find the "handlers_jaxws" service listed on the "Deployed Services" window.

4. Execute "sh run-client.sh" or "run-client.bat" to run the client.

5. Try the sample with different QoS options which appear on its dashboard. Run "sh run-client.sh -help" for different options.

When specifying the handler file path in the @HandlerChain annotation, the complete path from root should be given as: 

Code Block
@HandlerChain(file = "/demo/handlers/common/demo_handlers.xml")

Relative paths such as "../common/demo_handlers.xml" do not render in WSO2 Carbon. The full package hierarchy should be used.

Excerpt
hiddentrue

Sample on JAX-WS Handlers in WSO2 Application Server.