It's not a secret anymore!
The moose likes Web Services and the fly likes How to print SOAP response as XML in AXIS 1... Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Web Services
Reply Bookmark "How to print SOAP response as XML in AXIS 1..." Watch "How to print SOAP response as XML in AXIS 1..." New topic
Author

How to print SOAP response as XML in AXIS 1...

Raffi McGregor
Greenhorn

Joined: Apr 19, 2010
Posts: 2
I am using Axis (not Axis 2) in a web service client. Everything works fine in the code below but I am trying to get the response as an XML string. The service class does not provide a method to get the SOAP response part as a XML string.



Thank you
R Srini
Ranch Hand

Joined: Feb 19, 2010
Posts: 215
Hi Raffi,

I have no Axis experience, but I did some digging. Here is what I found:

Axis user guide
The message context from which you can get everything else
Similar question posed in this forum

The following should work. Please give it a try.

//org.apache.axis.MessageContext
MessageContext context = MessageContext.getCurrentContext();
//javax.xml.soap.SOAPMessage
SOAPMessage message = context.getMessage();
// print the message to stdout
message.writeTo(System.out);

Srini
Raffi McGregor
Greenhorn

Joined: Apr 19, 2010
Posts: 2
Hi Srini,

thanks, I found that code yesterday.
I also figured out how to do it using handlers on the client:

Put this file in your client's JVM working directory




SOAPResponseHandler.java


 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: How to print SOAP response as XML in AXIS 1...
 
Similar Threads
How to order the elements in soap message?
my webservice supports Axis1.x but not Axis2.x ,so is it the compatibility issue?
calling web service with input soap xml file
Getting SOAP response as XML string
my webservice supports Axis1.x but not Axis2.x ,so is it the compatibility issue?