Using the JAX-WS asynchronous response listener
Java™ API for XML-Based Web Services (JAX-WS) includes an asynchronous response listener, which is used within the Thin Client for JAX-WS and application client environments to receive responses for requests that are invoked asynchronously.
Before you begin
JAX-WS provides support for invoking web services using an asynchronous client invocation by using either a callback or polling model. Both the callback model and the polling model are available on the Dispatch client and the dynamic proxy client. When the JAX-WS client uses an asynchronous client invocation, the responses are received by the asynchronous response listener. To learn how to use the asynchronous client invocation model, read about invoking JAX-WS web services asynchronously.
About this task
The asynchronous response listener is used within a Web services client to handle incoming asynchronous responses. You can use the listener in Thin Client for JAX-WS environments and application client environments. By default, the listener opens a random port to listen for asynchronous responses or you can optionally configure a specific port for the listener to use. The listener starts automatically in the JAX-WS run time when the JAX-WS client is configured to expect an asynchronous response.
There are two versions of the asynchronous response listener. The unsecure version of the asynchronous response listener supports the HTTP protocol, and the secure version of the asynchronous response listener supports the HTTPS protocol. The correct asynchronous response listener is automatically started based on the particular transport used by the JAX-WS client. To ensure that the correct Secure Sockets Layer (SSL) handshaking occurs between the asynchronous response listener and the application server, configure the SSL properties using the SSL transport policy or the Java system properties.
For web services clients running in the application server environment, use the asynchronous response servlet for receiving asynchronous responses.
Procedure
Results
Example
- Use the following Java command
to configure the custom HTTP port for the asynchronous response listener
in a thin client environment:
- java.exe -Dcom.ibm.websphere.webservices.http.listenerPort=9999 com.ibm.websphere.my_program
- Use the following launchClient command to configure the custom
HTTP port for the asynchronous response listener in an application
client container:
- launchClient.bat MyClient.ear -CCDcom.ibm.websphere.webservices.http.listenerPort=9999
- The following is an excerpt from an HTTPTransport policy binding.xml
file that includes the asynchronous response listener properties:
</wsp:Policy> </wsp:ExactlyOne> </wsp:All> <wshttp:outAsyncResponseProxy> <wshttp:connectInfo host="" port=""></wshttp:connectInfo> <wshttp:basicAuth userid="" password=""></wshttp:basicAuth> </wshttp:outAsyncResponseProxy> <wshttp:properties> <wshttp:customProperty name="com.ibm.websphere.webservices.http.listenerPort" value="9999" /> </wshttp:properties> </wsp:All> </wsp:ExactlyOne> </wsp:Policy>