# Java TM API for XML Web Services
(JAX-WS)
AsyncProvider

Specification Version: 2.2
Implementation Version: 2.2.5

- Overview
- Provider
- AsyncProvider
- Dispatch
- Asynchronous Client
- Handler
- MTOM and Swaref
- SOAP 1.2
- WSDL Customization
- Annotations
- WS-Addressing
- Stateful Webservice
- Catalog
- Interoperability

Web Service endpoints may choose to work at the XML message level by implementing the `Provider` interface. The related information about `Provider` endpoints is documented in provider page. However `Provider` endpoints are synchronous i.e. they receive XML requests and they return XML responses synchronously in invoke() method. If the endpoint wants to spawn a thread to process the request, it would block the jax-ws runtime thread and has to manage all the low details synchronizing the threads when the response is available. Also blocking a thread doesn't really scale well especially when the underlying transport is capable of handling asynchronous request and responses. RI provides an implemention specific solution to this problem by introducing `AsyncProvider.` This is similar to `` `Provider` endpoints but the difference is that the endpoint implementations have to implement `AsyncProvider` interface.

## `AsyncProvider Example` ``

The following example shows an `AsyncProvider` example that accesses the payload of the request.

For example:

    @WebServiceProvider
    public class AsyncProviderImpl implements AsyncProvider<Source> {
        public void invoke(Source source, AsyncProviderCallback cbak, WebServiceContext ctxt) {...}
    }

## `AsyncProvider` sample

See a sample that illustrates `` `AsyncProvider` endpoints.

## `AsyncService` sample

See another sample that illustrates `` `AsyncProvider` endpoint that uses asynchronous servlet as the transport to bring true asynchronity on the server-side. See New Asynchronous Servlet Transport in JAX-WS RI for mroe details on this feature.