You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wss4j-dev@ws.apache.org by Shyam Shukla <sh...@persistent.co.in> on 2006/06/08 18:26:02 UTC

How to sign SOAP Envelop??

Hi

 

I have written following method to sign SOAP Envelop but it generates error
"java.lang.ClassCastException: org.apache.axis.message.SOAPHeader" at run
time although it is compiled successfully.

I am using jdk1.5.0_06 and OS is Windows 2000. 

 

public Message signSOAPEnvelope(SOAPEnvelope unsignedEnvelope)

      throws Exception

   {

      WSSecSignature signer = new WSSecSignature();

 

      String alias = "16c73ab6-b892-458f-abf5-2f875f74882e";

      String password = "security";

      signer.setUserInfo(alias, password);

 

      Document doc = unsignedEnvelope.getAsDocument();

      WSSecHeader wssecHeader = (WSSecHeader)unsignedEnvelope.getHeader();

            

      Document signedDoc = signer.build(doc, crypto,wssecHeader);

      Message signedSOAPMsg = new Message(signedDoc);

      return signedSOAPMsg;

   }

 

It is apparent that error is coming from WSSecHeader wssecHeader =
(WSSecHeader)unsignedEnvelope.getHeader(); step as we can not type cast
object of javax.xml.soap.SOAPHeader to
org.apache.ws.security.message.WSSecHeader.

 

So is there any way overcome from this problem?
<http://ws.apache.org/axis/java/apiDocs/javax/xml/soap/SOAPHeader.html> 

 

 

Thanks, 
Shyam Shukla



 


DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the property of Persistent Systems Pvt. Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Pvt. Ltd. does not accept any liability for virus infected mails.