• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Digital signature in SOAP XML

 
az ziz
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
sara sara
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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. ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic