On Mon August 24 2009 2:41:23 am Michael Berkowitz wrote:
> Can anyone provide sample code for a JAX-WS SOAPHandler that knows how to
> extract the operation and its arguments from the message?  I'm trying to
> write a handler that logs all the requests with their arguments.
>
> I've seen lots of examples of handlers that log the entire SOAP message,
> and I've figured out myself that the operation is always
> "context.getMessage().getSOAPBody().getFirstChild().getLocalName()", but a)
> I'd like to think there's a cleaner way of getting the operation and b)
> it'd be great to get the arguments as well.
 
There really isn't a way to do this from a JAX-WS handler without using a JAXB 
unmarshaller to unmarshal the contents of 
context.getMessage().getSOAPBody().getFirstChild() into an object yourself.  
Basically, the JAX-WS handlers run before we do any type of unmarshalling into 
the params that go into the message.

The only way to do this that is performant is to go with a CXF Interceptor 
that runs in the USER_LOGICAL phase.   The parameters are completely 
unmarshalled, the operation information has been determined, etc...


-- 
Daniel Kulp
[email protected]
http://www.dankulp.com/blog

Reply via email to