File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes SOAPMessage as String Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "SOAPMessage as String" Watch "SOAPMessage as String" New topic
Author

SOAPMessage as String

sweety kamal
Greenhorn

Joined: Feb 04, 2011
Posts: 4

public String getMessage(){
SOAPMessage message = messageFactory.createMessage();(line1)
............................some more code.....

//Save the message
message.saveChanges();(line 2)

message.writeTo(System.out);(line 3)

return String;}(line 4)

It prints the soap message to the console from line 3. I want the whole soap message as String as my function should return a String on line 4 which should be the whole soap message.
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
Have you tried to write to, for instance, a ByteArrayOutputStream instead of to System.out?
That way you will be able to retrieve the textual representation of the SOAP message.
Best wishes!


My free books and tutorials: http://www.slideshare.net/krizsan
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SOAPMessage as String
 
Similar Threads
SOAPMessage through ObjectInputStream
Display SOAP request line by line
Extract SOAP object from HttpServletRequest
SoapConnection timeout
creating soap requests in java