jQuery in Action, 2nd edition*
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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: 349
Tested:

Untested:


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

Joined: Feb 16, 2007
Posts: 349
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?

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How can convert SOAP Message to Document?
 
Similar Threads
WSWS3192E: Error: return code: ( 400 ) Bad Request when trying to invoked webservice
Binding XML to Java from SOAP message
Question about SOAP.
IllegalArgumentException while creating SOAP message
Sign soap header with handler in WebSphere 6.1