| JAX-WS 2.1.1 | Users Guide | Tools | JAXWS RI Extensions | Samples | JAXWS 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
Providerendpoints 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
Providerendpoints but the difference is that the endpoint implementations have to implement
AsyncProviderinterface.
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
AsyncProviderendpoints.