Announcement Announcement Module
Collapse
No announcement yet.
Help needed in Spring WS for WS-Addressing Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Help needed in Spring WS for WS-Addressing

    Hi friends,

    I have two major issues
    1. Is there a standard way to change 'mustunderstand' to false in ActionCallback without writing any custom classes? (I did a workaround which you can see below)
    2. I am not able to see ActionCallback working. I run a http server at localhost:90 which dumps any requests but I can't see spring replying to localhost:90. Instead it is replying back to source. I tried modfifying 'from' in ActionCallback and nothing seems to work. The request is going to the server and server is responding back to the same source but i need server to respond to another address (The way WS-Addressing works).(I may be missing something)

    SOAP Request [Header]:
    <SOAP-ENV:Header>
    <wsse:Security xmlns:wsse="http*//docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" SOAP-ENV:mustUnderstand="1">
    <xenc:ReferenceList xmlns:xenc="http*//ww*.w3.org/2001/04/xmlenc#">
    <xencataReference URI="#XWSSGID-1212370614765-1416871038"/>
    </xenc:ReferenceList>
    <wsse:BinarySecurityToken xmlns:wsu="http*//docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" EncodingType="http*//docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" ValueType="http*//docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" wsu:Id="XWSSGID-1212370614187-1301167008">MIIC0jCCAbqgAwIBAgIESD9gqDANBgkqhkiG9w 0BAQUFADAhMQswCQYDVQQGEwJBVTESMBAGA1UE
    AwwJbG9jYWxob3N0MB4XDTA4MDUzMDAyMDQyNFoXDTMzMDUyND AyMDQyNFowITELMAkGA1UEBhMC
    QVUxEjAQBgNVBAMMCWxvY2FsaG9zdDCCASIwDQYJKoZIhvcNAQ EBBQADggEPADCCAQoCggEBAKJ1
    yW7PvwHj3Ij+jt6thqTYBLIWja/YWEpsLGR/NB5zKM6B1my7b1PHwp+IoazQJmrlElZbKc3E4g+w
    Jurc1Ikf5u7A4mq+AyTQHdVovms0F8dZUeka/fX/8zMK+rd6bEdxGgnpjsAMyfH2Poun9nl1FrmG
    hJOtdFTLlmrRZfmjQOIaeFyaPgQf27ltTeiWI+DuZMgR8cI4qW YQ6fxI8w2hqv2VlBg5rhZHu4ER
    hLL5M4dKexnYJqV/LVtpjAIc8/DjTz+ABA6duHhhoKtJTiqom2Wwk7Y5/oXXLed5HLzBnQxWZ8BN
    6ajPZyi5mEsld7HnyEG1mHeJe02fmgyogsECAwEAAaMSMBAwDg YDVR0PAQH/BAQDAgSwMA0GCSqG
    SIb3DQEBBQUAA4IBAQB1hAojuDowHh1NM0vA3UCOA4W9f0elAB 0HWDUrIdDwxLornXgTfWgyaZ7b
    bWy0V9IdrkZpIlhM9spTVTzc2/y/bIS+XU37T7oBZjVFsEBTmBc3p0n8i8jFJ/ED64bv52xYIydl
    5wU6Rpvn2QiNTCZvjqtdZHEJVdTyVze/XX+HzJK91jJoXac6jINRwPjnZ3mM94+SPch0zF4OoCBc
    xpc4ZQCKuvuJHSmknd+ltsinMOiQXFUGPt8tr9SpdEXkZhiL89 YOnXCYLebWdxuD46SMrNyQiK78
    0BdNYeur+tvFcg4tJwnGquuMu0qbjZxrvnPpODau3x/jSphaatPrMfsi</wsse:BinarySecurityToken>
    <ds:Signature xmlns:ds="http*//ww*.w3.org/2000/09/xmldsig#">
    <ds:SignedInfo>
    <ds:CanonicalizationMethod Algorithm="http*//ww*.w3.org/2001/10/xml-exc-c14n#">
    <InclusiveNamespaces xmlns="http*//ww*.w3.org/2001/10/xml-exc-c14n#" PrefixList="wsse SOAP-ENV"/>
    </ds:CanonicalizationMethod>
    <ds:SignatureMethod Algorithm="http*//ww*.w3.org/2000/09/xmldsig#rsa-sha1"/>
    <ds:Reference URI="#XWSSGID-1212370614234-177677053">
    <dsigestMethod Algorithm="http*//ww*.w3.org/2000/09/xmldsig#sha1"/>
    <dsigestValue>ONEoMJ/Ifgp3taGcWDlyzzoUEFs=</dsigestValue>
    </ds:Reference>
    <ds:Reference URI="#XWSSGID-1212370614234-1944602553">
    <dsigestMethod Algorithm="http*//ww*.w3.org/2000/09/xmldsig#sha1"/>
    <dsigestValue>fJ22C17Amj768gmfPjvU5fNQ0UU=</dsigestValue>
    </ds:Reference>
    </ds:SignedInfo>
    <ds:SignatureValue>dUU+Zf1VkF7tZWcW/YXqwvOFbS/VizITFuQl8g9F8e/I969wIN80fsWt6KU97tQqJih4NCgEb8UT
    4FJro5Nm5WYwscqABKGsO1mL/ZF6dbWdgHmyV+VYPBMRTE0Zjehol4tpNWK+11RnYeSzYkuPo28 z
    SyxBYADsrBsr2xlqwyjTI4YjH8Ug/sHqaIDbFmoz868BDPoZwd/U8K0lJC9OT3UxMWvUraP2QI5t
    Lz/kWpSETdEXSJgA4LBsuoLCxXbbfiWfHpsJhCoLsLdga0ouFONNa CbC5IKNIHSPS3tHJtrGDxWd
    xi+XnOI4iJikFeXxr2yWA+ipRoh4ywH0BDnQKw==</ds:SignatureValue>
    <ds:KeyInfo>
    <wsse:SecurityTokenReference xmlns:wsu="http*//docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="XWSSGID-1212370614187-2102225156">
    <wsse:Reference URI="#XWSSGID-1212370614187-1301167008" ValueType="http*//docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3"/>
    </wsse:SecurityTokenReference>
    </ds:KeyInfo>
    </ds:Signature>
    <wsu:Timestamp xmlns:wsu="http*//docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="XWSSGID-1212370614234-1944602553">
    <wsu:Created>2008-06-02T01:36:54Z</wsu:Created>
    <wsu:Expires>2008-06-02T01:36:59Z</wsu:Expires>
    </wsu:Timestamp>
    <wsse:UsernameToken xmlns:wsu="http*//docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="XWSSGID-1212370613531247997592">
    <wsse:Username>felix</wsse:Username>
    <wsse:Password Type="http*//docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">****</wsse:Password>
    <wsse:Nonce EncodingType="http*//docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">GiVmRu1HPcn9bSJBUrez/mrp</wsse:Nonce>
    <wsu:Created>2008-06-02T01:36:54Z</wsu:Created>
    </wsse:UsernameToken>
    </wsse:Security>
    <wsa:To xmlns:wsa="http*//ww*.w3.org/2005/08/addressing" SOAP-ENV:mustUnderstand="0">http*//localhost/suppliersim</wsa:To>
    <wsa:ReplyTo xmlns:wsa="http*//ww*.w3.org/2005/08/addressing">
    <wsa:Address>http*//localhost:90/replyTo</wsa:Address>
    </wsa:ReplyTo>
    <wsa:Action xmlns:wsa="http*//ww*.w3.org/2005/08/addressing">purchaseorder</wsa:Action>
    <wsa:MessageID xmlns:wsa="http*//ww*.w3.org/2005/08/addressing">urn:uuid:943a6392-3145-4e10-9066-15d9a631e24e</wsa:MessageID>
    </SOAP-ENV:Header>


    WSClient Side code:
    wsc.wsaddressing = new WSAddressingCallback("purchaseorder");

    EndpointReference replyTo = new EndpointReference(new URI(
    "http*//localhost:90/replyTo"));
    wsc.wsaddressing.setReplyTo(replyTo);

    wsc.getWebServiceTemplate().sendSourceAndReceiveTo Result(source,
    wsc.wsaddressing, result);
    WSAddressingCallback.java
    -------------------------
    //Used to change mustunderstand to false...
    public class WSAddressingCallback extends ActionCallback {

    public WSAddressingCallback(String action) throws URISyntaxException {
    super(action);
    }

    public void doWithMessage(WebServiceMessage message) throws IOException,
    TransformerException {
    super.doWithMessage(message);
    SaajSoapMessage msg=(SaajSoapMessage) message;
    SoapHeader sh=msg.getSoapHeader();
    Iterator i= sh.examineAllHeaderElements();
    while(i.hasNext())
    {
    SoapHeaderElement elmt=(SoapHeaderElement) i.next();
    if(elmt.getName().getLocalPart().equals("To") && elmt.getName().getNamespaceURI().endsWith("address ing"))
    {
    elmt.setMustUnderstand(false);
    }
    }
    }
    }
    Server side code:
    ----------------
    <bean id="payloadMapping"
    class="org.springframework.ws.server.endpoint.mapp ing.PayloadRootQNameEndpointMapping">
    <property name="defaultEndpoint" ref="suppliersimEndpoint" />
    <property name="interceptors">
    <list>
    <ref local="loggingInterceptor" />
    <ref local="wsSecurityInterceptor" />
    </list>
    </property>
    <property name="mappings">
    <props>
    <prop key="purchaseorder">
    suppliersimEndpoint
    </prop>
    </props>
    </property>
    </bean>
    I also tried other endpointmappings and it doesn't seems to work.

    FYI, I use xwss security conf with Sign/Encrypt/UserToken
    Am I missing anything? Any help will be of great use to me.

    Thanks,
    Felix
    Last edited by fjeyar; Jun 1st, 2008, 09:48 PM. Reason: Some nice formatting for code

  • #2
    Solved myself...

    Hi,

    I actually missed the messageSenders.. in SimpleActionEndpointMapping when added, it worked!

    Best regards,
    Felix Jeyareuben

    Comment


    • #3
      messageSenders configuration

      Hi,

      Could you please post the configuration for configuring messageSenders.

      Thanks,

      Comment

      Working...
      X