I generated client classes from wsimport for a wsdl I am supposed to interface with. When I invoke a method on the web service, e.g. public FooResponse getFoo(FooRequest request), is there a way to view the xml that is being sent to the service?
This tool, wsmonitor, is a light-weight, easy to use SOAP and HTTP traffic monitoring tool. This tool uses port forwarding to capture the SOAP messages and HTTP headers between a sender and a receiver and displays them nicely formatted in a graphical user interface.
I too would like to know how to log the xml request and response (and preferably intercept it so I can scrub it). I am just using the client I generated from wsimport. I don't believe I am using cxf or metro or axis, but I am not that experienced with web services. The client is running out of a Tomcat instance.
Can you create a javax.xml.ws.handler.LogicalHandler and use that to act as a filter?
It worked. I created a class that implements LogicalHandler<LogicalMessageContext> and cast the service stub to a javax.xml.ws.BindingProvider and added handler to the binding provider's binding's handler chain.
Well the way it works is that I created a class which implements javax.xml.ws.handler.LogicalHandler<javax.xml.ws.handler.LogicalMessageContext>. In the handleMessage method, I take the LogicalMessageContext and extract the javax.xml.ws.LogicalMessage from it and use a javax.xml.transform.Transformer to transform javax.xml.ws.LogicalMessage.getPayload() into a StreamResult (which is wrapping a ByteArrayOutputStream().