Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Digital signature in SOAP XML

 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 43026
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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. ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic