JAX-WS Asynchronous Invocation
Introducing the Sample
This sample illustrates the use of JAX-WS asynchronous invocation model using Document/Literal Style.
Infor
For more information on asynchronous invocation, refer to the JAX-WS 2.0 specification here: http://jcp.org/aboutJava/communityprocess/pfd/jsr224/index.html)
The asynchronous model allows client threads to continue after making a two-way invocation, without being blocked while awaiting a response from the server. Once the response is available, it is delivered to the client application asynchronously, using one of two alternative approaches as follows:
- Callback: the client application implements the "javax.xml.ws.AsyncHandler" interface to accept notification of the response availability.
- Polling: the client application periodically polls a "javax.xml.ws.Response" instance to check if the response is available.
This Sample illustrates both approaches. Additional methods are generated on the Service Endpoint Interface (SEI) to provide this asynchrony, named by convention with the suffix "Async". As many applications will not require this functionality, the asynchronous variants of the SEI methods are omitted by default to avoid loading the SEI with unnecessary baggage. In order to enable generation of these methods, a bindings file (wsdl/async_bindings.xml) is passed to the wsdl2java generator.
Building and Running the Sample
Using Maven
1. Install and run the WSO2 Application Server. Refer to the Installing Features for instructions.
2. From the base directory of this sample ( <CARBON_HOME>\samples\Jaxws-Jaxrs\ async_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\ async_jaxws directory to deploy the " async_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 " async_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.