Home >Java >javaTutorial >How to Trace XML Request/Responses with JAX-WS without Proxies?

How to Trace XML Request/Responses with JAX-WS without Proxies?

Susan Sarandon
Susan SarandonOriginal
2024-10-29 10:52:021050browse

How to Trace XML Request/Responses with JAX-WS without Proxies?

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn