• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

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

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 215
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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


 
Are you okay? You look a little big. Maybe this tiny ad will help:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic