aspose file tools*
The moose likes Web Services and the fly likes Digital signature in SOAP XML Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Digital signature in SOAP XML" Watch "Digital signature in SOAP XML" New topic
Author

Digital signature in SOAP XML

az ziz
Ranch Hand

Joined: Dec 17, 2008
Posts: 50
dear all,

i need to append the digital signature to the soap message that is sent to the server. the service is run in https (ssl). i have coded the client in the axis java, i have also created the stubs from wsdl using wsdl2java program. now how do i insert the signature to the soap xml. i read some docs in the web but it didnt show the implementation of this in axis...

Thanks in advance to the help


Vijay Veeraraghavan
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42601
    
  65
The standard for using digital signatures in XML is called XML-Signature; if you install the Rampart module for Axis 2 you'll have all the libraries that are needed to use it.

But you should really use WS-Security, which is the standard for securing web services. It includes signatures, and is also implemented by Rampart.


Ping & DNS - my free Android networking tools app
sara sara
Greenhorn

Joined: Feb 11, 2009
Posts: 1

public SOAPElement stringToSOAPElement(String xmlText) {
try {
SOAPMessage message = null;
InputStream is = new ByteArrayInputStream(xmlText.getBytes());
org.w3c.dom.Document doc =XMLUtils.newDocument(is);
MessageFactory factory = MessageFactory.newInstance();
message = factory.createMessage();
SOAPElement element = message.getSOAPBody().addDocument(doc);

// This returns the SOAPBodyElement
// that contains ONLY the Payload
return (element);

} catch (SOAPException e) {
System.out.println(”SOAPException : ” + e);
return null;

} catch (IOException e) {
System.out.println(”IOException : ” + e);
return null;

} catch (ParserConfigurationException e) {
System.out.println(”ParserConfigurationException : ” + e);
return null;

} catch (SAXException e) {
System.out.println(”SAXException : ” + e);
return null;

}
}

[ UD: Please post in English only. Also, you may have missed that we have a policy on screen names here at JavaRanch. It must consist of a first name and a last name, and not be obviously fictitious. Since yours does not conform with it, please take a moment to change it, which you can do using the "My Profile" link at the top of the page. ]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Digital signature in SOAP XML