From the JBossWS FAQ it appears that the Service object is thread safe:
JAX-WS (JBossWS-Native)
javax.xml.ws.Service - Thread safe
The port proxy returned by getPort(..) methods of Service is not thread safe instead.
But I need to set a new SoapHandler for each invocation because it is used to set security stuff that unique to each and every invocation:
Service service = Service.create(someWsdlUrl, someQName);
MyHandlerResolver resolver = new MyHandlerResolver();
resolver.addHandler(new MySoapHandler(usercredentials));
service.setHandlerResolver(resolver);
Since the SoapHandler is set on the Service object it seems Im therefore forced to create a new instance of Service for each invocation? I assume theres a performance penalty associated with creating the Service object. Is there some other way I can set credentials uniquely to the invocation without creating a new Service instance every time?
I should mention that the SoapHandler that deals with security supports many security protocols including one thats home grown.
Using JBoss 5.1.0GA.