[jboss-user] [JBoss Web Services] - Re: How to set new SoapHandler for each invocation?

Scale It do-not-reply at jboss.com
Tue Apr 17 10:41:22 EDT 2012


Scale It [https://community.jboss.org/people/meselfe] created the discussion

"Re: How to set new SoapHandler for each invocation?"

To view the discussion, visit: https://community.jboss.org/message/730602#730602

--------------------------------------------------------------
The problem is Im trying to figure out how to build a web service client that will be running in a web application and will be used by hundreds of threads concurrently. It must set various security aspects uniquely on every invocation. The security is more customized than what is usually set through the BindingProvider thus Im using a SoapHandler.

So correct me if Im wrong: what I should do is create one Service instance and set the HandlerResolver only once? Each thread should use the same Service instance to create a Port instance confined to the thread?

The SoapHandler is thus used by all threads concurrently because its bound to the Service instance?

But then what about the SOAPMessageContext passed to the SoapHandler - is that unique to the thread? I would like to do something like this in the SoapHandler:

public boolean handleMessage(SOAPMessageContext msgContext)  {
   ...
  msgContext.put(MessageContext.HTTP_REQUEST_HEADERS,Collections.singletonMap(MY_HTTP_HEADER,Collections.singletonList(resolver.getUserCredentials())));

The "resolver" above will get the users credentials from the FacesContext in a way that would unique to the thread. I have this working but is this solution correct - Is the use of the SoapHandler and SOAPMessageContext correct from a thread safety perspective?


BTW where do you find this information about the SoapHandler - Ive been scouring through jsr 181,224,109 and various javadoc but theres hardly any info on the SoapHandler.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/730602#730602]

Start a new discussion in JBoss Web Services at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20120417/ae1867f5/attachment-0001.html 


More information about the jboss-user mailing list