Announcement Announcement Module
No announcement yet.
Problem producing valid signature with XWSS for WSS4j with spring ws version 1.0 Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem producing valid signature with XWSS for WSS4j with spring ws version 1.0

    I'm having problems with the signing of my Soap request client side with XWSS invoking a WSS4J (Axis 2 secured with rampart) webservice.
    Currently i need to use an older version of spring and spring webservices on an old application.
    My spring-version is 2.0.8 and 1.0.0
    This is probably related to and

    In the new application i will be able to use the latest version of spring and spring webservices.
    But first of course the old application needs to be able to handle it.

    Using Axis generated client code together with rampart i'm able to succesfully invoke the method.
    But i don't wish to use generated code.
    Using spring together with xwss and castor gives me a much cleaner solution.
    Apart from the fact that it won't work of course :-(

    The response i'm always receiving is :
    "Signature failed to validate. Reference: #XWSSGID-1247474613236121428576 does not validate."
    So i suspect something goes wriong with the digest value creation or transformation.

    In order to secure my message i use the following (no client side interceptors on webservice template yet).

    public class XwssMessageSecurerFactory {

    private final XWSSProcessor processor;

    public XwssMessageSecurerFactory(Resource policyFile, KeyStoreCallbackHandler keystoreHandler) throws Exception {
    InputStream in = null;
    try {
    in = policyFile.getInputStream();
    XWSSProcessorFactory factory = XWSSProcessorFactory.newInstance();
    processor = factory.createProcessorForSecurityConfiguration(in , keystoreHandler);
    finally {
    if (in != null) {

    * This is redudant for Spring webservices 1.5.
    * Then there are client side interceptors.
    * @return
    public WebServiceMessageCallback createSecurerCallback() {
    new WebServiceMessageCallback() {
    public void doWithMessage(WebServiceMessage message) throws IOException {
    SaajSoapMessage origSaajMessage = (SaajSoapMessage) message;
    SOAPMessage origSoapMessage = origSaajMessage.getSaajMessage();
    try {
    ProcessingContext context = processor.createProcessingContext(origSaajMessage. getSaajMessage());
    //Set security on message.
    SOAPMessage securedSoapMessage = processor.secureOutboundMessage(context);
    origSaajMessage.setSaajMessage(securedSoapMessage) ;
    catch (Exception exc) {
    throw new XwsSecuritySecurementException(exc.getMessage());

    And for completeness sake the XWSS client security policy file.

    <?xml version="1.0" encoding="UTF-8"?>
    <xwss:SecurityConfiguration dumpMessages="true" xmlns:xwss=""
    <xwss:Sign includeTimestamp="false">
    <xwss:X509Token certificateAlias="CertificateAlias"
    <xwss:CanonicalizationMethod disableInclusivePrefix="true" />
    <xwss:SignatureMethod algorithm=""/>
    <xwss:SignatureTarget type="xpath"
    value="./SOAP-ENV:Envelope/SOAP-ENV:Body"><!-- type="qname" value="SOAP-BODY" -->
    <xwssigestMethod algorithm=""/>
    <xwss:Transform algorithm="" disableInclusivePrefix="true" />
    <xwss:SignatureTarget type="xpath"
    <xwssigestMethod algorithm=""/>
    <xwss:Transform algorithm="" disableInclusivePrefix="true"/>
    <xwss:SignatureTarget type="xpath"
    <xwssigestMethod algorithm=""/>
    <xwss:Transform algorithm="" disableInclusivePrefix="true"/>

    Any ideas?
    Will i be able to get this to work easily with the latest version of spring webservices?

    Thanks in advance.

  • #2
    I did a test with spring 2.5.6 and spring webservices 1.5.7. using the XwsSecurityInterceptor and Wss4jSecurityInterceptor for invoking an Axis2 with rampart secured webservice. For the Xws interceptor the same error occurs. With the Wss4j interceptor the signature is valid and the request is accepted by the server.