+

Search Tips   |   Advanced Search

Use the JAX-WS asynchronous response servlet

Java API for XML-Based Web Services (JAX-WS) includes an asynchronous response servlet, which is used within the application server environment to receive responses for JAX-WS requests invoked asynchronously.

JAX-WS provides support for invoking web services using an asynchronous client invocation 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 a JAX-WS client running within the application server environment uses an asynchronous client invocation, the responses are received by the asynchronous response servlet. To learn how to use the asynchronous client invocation model, read about invoking JAX-WS web services asynchronously.

Liberty does not support JAX-WS programming model for asynchronous request and response message exchange. Alternatively, we can use Web Services Addressing (WS-Addressing) for the message exchange.

The asynchronous response servlet is used within an application server to handle incoming asynchronous responses. The servlet uses the same secure and unsecure HTTP ports assigned to the application server. The servlet starts automatically when the application server starts. Because the asynchronous response servlet does not perform role-based authorization checks, only user authentication checks are performed.

The asynchronous response servlet supports both the HTTP and HTTPS protocols. Since the servlet inherits the SSL configuration of the application server, configuring the application server also configures the servlet. The asynchronous response servlet is not affected by the custom HTTP and SSL port properties used by the asynchronous response listener and only runs on the application ports for the application server.


Tasks

  1. Determine if we want the JAX-WS client to use the HTTP or HTTPS transport mechanism.

  2. Configure the web container transport chains to modify the SSL configuration of the application server. The servlet inherits these settings. Read about configuring transport chains to learn how to configure the web container transport chains.

The asynchronous response servlet is configured to enable the JAX-WS clients to receive asynchronous responses on the HTTP or HTTPS transport protocol.

When we add a new application server to the environment, the asynchronous response servlet is automatically restarted so the deployment.xml file can be updated for the new application server. If the application receives an incoming response when the asynchronous response servlet is restarting, the incoming response might fail with an HTTP 404 error.

If the clients are installed in application security-enabled WebSphere Application Servers, we need to follow these steps to configure the service provider to make JAX-WS services return asynchronous responses:

  1. Expand Services > Policy Sets and click Application policy sets > New to create a new policy set.

  2. On the General Properties panel, specify a name and a short description for the new policy set.

  3. Under Policies, click Add and select HTTP transport from the drop-down list. Click Save.

  4. Expand Services > Policy Sets and click General provider policy set bindings > New.

  5. Specify the Bindings configuration name and the Description fields. Click Add and select HTTP transport from the drop-down list.

  6. Under Basic authentication for outbound asynchronous service responses, input the user name and password for our authenticated user. Click Apply, then click Save.

  7. Expand Applications > Application Types and click WebSphere enterprise applications > your_application_name. Under Web Services Properties, click Service provider policy sets and bindings.

  8. Select your_web_service, click Attach and select the policy sets we created in step 3. Select your_web_service again, click Assign Binding and select the binding we created in step 6. Click Save.

  • Use HTTP to transport web services
  • Invoking JAX-WS web services asynchronously
  • Running an unmanaged web services JAX-WS client
  • Use the JAX-WS asynchronous response listener
  • Configure transport chains