This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Web Services and the fly likes Jax-ws client can be a singleton? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Jax-ws client can be a singleton?" Watch "Jax-ws client can be a singleton?" New topic
Author

Jax-ws client can be a singleton?

Matteo Ferrari
Greenhorn

Joined: Apr 07, 2013
Posts: 1
I have to call a webservice using JAX-WS and I have to include a parameter in header of webservice xml. I've used wsimport to generate client classes and now I'm using them in this way (I use MyHandlerResolver to inject parameter in header):



My question is: can MyServiceService be a singleton? Are there issues with concurrent requests? I haven't found any clear answer on this argument. Is there any official documentation about this?
Thanks!
Tina Smith
Ranch Hand

Joined: Jul 21, 2011
Posts: 171
    
    5

My understanding is yes, and each webservice request will be processed in a separate thread (or thread pool). So you can make the service a singleton but you do need to handle concurrency within your application.


Everything is theoretically impossible, until it is done. ~Robert A. Heinlein
Tina Smith
Ranch Hand

Joined: Jul 21, 2011
Posts: 171
    
    5

And welcome to the ranch!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Jax-ws client can be a singleton?
 
Similar Threads
stateless endpoint, how to make soap-fault exeption rollback enabled
SCDJWS Beta : Some findings/points
Use a singleton for javax.xml.ws.Service instance
Convert SOAP response to SOAP XmL string using JAX WS
JAX WS URL mapping