aspose file tools*
The moose likes Web Services and the fly likes How can convert SOAP Message to Document? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "How can convert SOAP Message to Document?" Watch "How can convert SOAP Message to Document?" New topic
Author

How can convert SOAP Message to Document?

Dave Trower
Ranch Hand

Joined: Feb 12, 2003
Posts: 86
I am trying to sign a SOAP message using wssj.
I need to pass the soap envelope as a Document type.
I tried doing this:
SOAPMessageContext soapCntxt = (SOAPMessageContext)context;
SOAPMessage message = soapCntxt.getMessage();
SOAPPart soapPart = message.getSOAPPart();
Document envelope = (Document)soapPart;

This compiles but I get run time error of

Service exception java.lang.ClassCastException: org.apache.axis.message.Text cannot be cast to org.apache.axis.message.SOAPHeaderElement
Roger F. Gay
Ranch Hand

Joined: Feb 16, 2007
Posts: 397
Tested:

Untested:


Correlation does not prove causality.
Roger F. Gay
Ranch Hand

Joined: Feb 16, 2007
Posts: 397
So the; how do you get it back into a SOAPMessage?
chaitu sravs
Greenhorn

Joined: Oct 21, 2009
Posts: 11
Also, if the SOAPMessage is created from a file input stream with the below content, the tested version of the code pasted above does not seem to work. Is there a way to just get the XML part ignoring the rest?

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How can convert SOAP Message to Document?