Tracing XML Request/Responses with JAX-WS without Proxies
For Java developers utilizing the JAX-WS reference implementation for web service publishing, the ability to directly access the raw XML request and response is crucial for debugging. This article presents a simple and code-based solution to achieve this without relying on external frameworks or proxies.
Solution
The following code properties enable logging of all communication to the console:
System.setProperty("com.sun.xml.ws.transport.http.client.HttpTransportPipe.dump", "true"); System.setProperty("com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.dump", "true"); System.setProperty("com.sun.xml.ws.transport.http.HttpAdapter.dump", "true"); System.setProperty("com.sun.xml.internal.ws.transport.http.HttpAdapter.dump", "true"); System.setProperty("com.sun.xml.internal.ws.transport.http.HttpAdapter.dumpTreshold", "999999");
By setting these properties, the raw XML request and response will be logged to the console for easy inspection. This solution allows developers to trace and debug communication without the overhead of additional frameworks.
The above is the detailed content of How to Trace XML Request/Responses with JAX-WS without Proxies?. For more information, please follow other related articles on the PHP Chinese website!