JAX-WS RI 2.1.5 | Users Guide | Tools | JAX-WS RI Extensions | Samples | JAX-WS Community |
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
AsyncProvider
endpoints.