Home  >  Article  >  Java  >  How can I access raw XML request and responses in JAX-WS without using a proxy?

How can I access raw XML request and responses in JAX-WS without using a proxy?

Mary-Kate Olsen
Mary-Kate OlsenOriginal
2024-10-29 07:36:30231browse

How can I access raw XML request and responses in JAX-WS without using a proxy?

Accessing XML Request/Responses with JAX-WS without Proxy

In JAX-WS, accessing the raw request and response XML during webservice communication can be achieved by enabling detailed logging. Here's how it can be done:

Set the following system properties in your code or environment:

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

The properties enable logging of all communication to the console. The "dumpTreshold" property ensures that the entire request and response XML is logged, regardless of its size.

Alternatively, you can also set these properties as command-line parameters using the "-D" flag or as environment variables.

Note that while this method is straightforward and less overhead-intensive than using frameworks like Axis or CXF, it does not provide additional features such as request interception or response modification.

The above is the detailed content of How can I access raw XML request and responses in JAX-WS without using a proxy?. 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