Tracing XML Request/Responses in JAX-WS without Proxies
Utilizing JAX-WS reference implementation, it is possible to access raw request/response XML for webservices without employing proxies. This can be achieved by setting system properties that enable logging communication. Here's the code to accomplish this:
<code class="java">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");</code>
Alternatively, these properties can be set via command line parameters using "-D" or through environment variables. By enabling these options, all communication will be logged to the console, providing insights into the XML request and response.
For additional details, refer to the StackOverflow discussion "Tracing XML request/responses with JAX-WS when error occurs." This method allows for simple and efficient tracing capabilities within JAX-WS without introducing additional framework overhead.
The above is the detailed content of How Can I Trace XML Requests and Responses in JAX-WS Without Using Proxies?. For more information, please follow other related articles on the PHP Chinese website!