"If a worker wants to do his job well, he must first sharpen his tools." - Confucius, "The Analects of Confucius. Lu Linggong"
Front page > Programming > How Can I Trace XML Requests and Responses in JAX-WS Without Using Proxies?

How Can I Trace XML Requests and Responses in JAX-WS Without Using Proxies?

Published on 2024-11-17
Browse:937

How Can I Trace XML Requests and Responses in JAX-WS Without Using Proxies?

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:

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");

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.

Latest tutorial More>

Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.

Copyright© 2022 湘ICP备2022001581号-3