Search code examples
javaweb-servicestomcatjax-wsjava-metro-framework

Accessing XML payload of Metro 2.0 Request/Response Web Service


I am developing a web service, using Metro 2.0 and Tomcat 6, and I have a requirement to be able to log the XML payload of the request and response of a web method for development/support reasons. The payload would only be logged when in debug mode.

The Web Service uses a servlet implementation (com.sun.xml.ws.transport.http.servlet.WSServlet and .WSServletContextListener classes), if that affects the answer.

Is this even possible?

Thanks in advance, Andy


Solution

  • Try setting these system properties:

    -Dcom.sun.metro.soap.dump=true
    -Dcom.sun.xml.ws.assembler.client=true
    

    The SOAP messages go to system out, which I believe Tomcat logs.