Does web service via jax ws support multithreading

I wrote a webservice using spring, cxf and jax ws and I have a basic question about WS. How does the web service endpoint handle concurrent requests? Does it create a new thread for every request, like a servlet, or is it a single threaded model? Since we expect a huge volume for each web service, does it matter to split the WSDL into multiple WSDLs in order to have different endpoints?


source to share

3 answers

The web service is of course hosted on a web server (e.g. Glassfish) that is multithreaded while receiving multiple concurrent requests at the same time.



From the point of view of your client and your service, there is no such thing as "multithreading". Your client triggers a request and receives a response (possibly an error response). The server receives the request and the services it requests. Period.

How the request is sent is an implementation detail.

And WSDL is just a "contract". The service "publishes" what operations it supports and what data types it uses with WSDL; the client packages and unpacks its SOAP request and response messages, respectively. But WSDL does not play any direct role in any web service call.



Late, but might help.

Endpoint.publish (Url, ServiceImplObj) publishes a web service at the specified URL. Not. the threads assigned to handle requests are indeed under the control of the jvm, because it is a lightweight deployment that is handled by the jvm itself.

For a better explanation, you can print out the current thread name on the service side and you can see that the service threads are assigned from the thread pool managed by jvm.

[pool-1-thread-1]: Response[57]:
[pool-1-thread-5]: Response[58]:
[pool-1-thread-4]: Response[59]:
[pool-1-thread-3]: Response[60]:
[pool-1-thread-6]: Response[61]:
[pool-1-thread-6]: Response[62]:


I tried this on jdk 1.6.0_35.

xjc -version xjc version "JAXB 2.1.10 in JDK 6" Implementation of JavaTM Architecture for XML Binding (JAXB), (creating JAXB 2.1.10 in JDK 6)



All Articles