This is probably an easy question for anyone with any moderate expertise with web services using Apache Axis.
I have a web service client that was generated by wsdl2java in Axis 1.4. I am writing unit tests that need to access the actual SOAP message itself, and do a comparison to the client side java classes which are generated by Axis. (don't ask)
How can I retrieve the actual SOAP message from a response from the service?
From what I can gather from searching around is that I have to get the MessageContext. I have tried something along these lines...
MessageContext mc = MessageContext.getCurrentContext(); String message = mc.getCurrentMessage().getSOAPPartAsString();
But mc is null in this case....
Any help is appreciated!
Axis is essentially a SOAP engine -- a framework for constructing SOAP processors such as clients, servers, gateways, etc. The current version of Axis is written in Java, but a C++ implementation of the client side of Axis is being developed.
This step is extremely simple: just copy (recursively) the webapps/axis directory under the webapps directory of your Tomcat installation (i.e., $TOMCAT_HOME\webapps). Next, copy the XML parser libraries (such as the 3 Xerces JAR files mentioned above) to the $TOMCAT_HOME\webapps\axis\lib directory.
Apache Axis2/C can be used to provide and consume WebServices. It has been implemented with portability and ability to embed in mind, hence could be used as a Web services enabler in other software. Rampart is the security module of Axis2.
This is how it's done.
http://users.skynet.be/pascalbotte/rcx-ws-doc/jaxrpchandler.htm
When _call
object is filled calling the line below gives it.
String request=_call.getMessageContext().getRequestMessage()
.getSOAPPart().getEnvelope().toString();
For response use the below one
_call.getMessageContext().getResponseMessage()
.getSOAPPart().getEnvelope().toString()
Call
is a org.apache.axis.client.Call
as you know.
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