I'm starting studying java web services with JAX WS. The first chapter of the book I'm reading shows how to build and publish a simple jax ws web service using only java SE. In particular, the web service is published through the Endpoint class. After publishing the web service, the author specifies that
"Out of the box, the Endpoint publisher handles one client request at a time ... if the processing of a given request should hang, then all other client requests are effectively blocked. An example at the end of this chapter shows how Endpoint can handle requests concurrently so that one hung request does not block the others."
To see this, I tried to send two requests to a web service with 2 threads. Here is the code:
If I start MyClient class, the thread called "miao" sends its request and then goes to sleep. However, the thread called "bau" does not wait for the previous request and its request is immediately satisfied.
I get the same result if I call the WS with SoapUI using 2 different request instances.
Am I missing something? Can java threads be used to simulate multiple requests?
Thanks a lot for your help,
Joined: Jun 12, 2011
I downloaded jax-ws 2.0 specification and it disproves what the book I'm reading says:
"An endpoint consists of an object that acts as the Web service implementation (called here implementor) plus some configuration information ... An Endpoint will be typically invoked to serve concurrent requests, so its implementor should be written so as to support multiple threads. The synchronized keyword may be used as usual to control access to critical sections of code. For finer control over the threads used to dispatch incoming requests, an application can directly set the executor to be used"
The book speaks about jax-ws 2.1 but I didn't manage to download that version of the specification. Anyway, jax-ws 2.2 specification (current version) confirms the concurrent nature of the Endpoint class (it contains the same sentences as above).
I don't know what the author of the book means exactly.