I am using Apache Axis for web service automation.
I am preparing SOAP requests via Axis and hitting the web service further. What I am looking for is how to print the SOAP request content which is getting compiled and hitting the webservice.
I found that log4j can help but I am struggling how to use it.
The Body element contains the message payload. In the case of a request message the payload of the message is processed by the receiver of the message and is typically a request to perform some service and, optionally, to return some results.
A SOAP message is encoded as an XML document, consisting of an <Envelope> element, which contains an optional <Header> element, and a mandatory <Body> element. The <Fault> element, contained in <Body> , is used for reporting errors.
Introduction. Apache Axis is an implementation of the SOAP ("Simple Object Access Protocol") submission to W3C. From the draft W3C specification: SOAP is a lightweight protocol for exchanging structured information in a decentralized, distributed environment.
A SOAP message is an XML document that consists of a SOAP envelope, an optional SOAP header, and a SOAP body. The SOAP message header contains information that allows the message to be routed through one or more intermediate nodes before it reaches its final destination.
You probably don't need this answer anymore, but stays here for anyone else that ends right up here with the same problem.
The easiest way to retrieve both the request and the response is to get them from the call you are making. In the axis generated stub, after invoking a call do this:
String requestXML = _call.getMessageContext().getRequestMessage().getSOAPPartAsString();
String responseXML = _call.getMessageContext().getResponseMessage().getSOAPPartAsString();
Hope it helps. It helped me when I needed to print the request too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With