Announcement Announcement Module
Collapse
No announcement yet.
What's the easiest way to pass a usernametoken from a Spring WS client ? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • What's the easiest way to pass a usernametoken from a Spring WS client ?

    Hi.

    I want to use a WebserviceTemplate to call a web service secured using Spring Security.

    Below is the soap message I send when testing from SoapUI. This works perfectly.

    Now I want to do this programmatically. I've seen documentation about having to set up security interceptors and callbacks. Is there are really simple example that shows how to add a security header to the message resulting in the soap message shown below ?

    Code:
    <soapenv:Envelope xmlns:sch="http://mycompanyl/schemas" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
       <soapenv:Header>
          <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
             <wsse:UsernameToken wsu:Id="UsernameToken-17" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
                <wsse:Username>testuser</wsse:Username>
                <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">testuser</wsse:Password>
                <wsu:Created>2011-03-24T13:36:51.192Z</wsu:Created>
             </wsse:UsernameToken>
          </wsse:Security>
       </soapenv:Header>
       <soapenv:Body>
          <sch:myRequest>
             <sch:myData>1140785</sch:myData>
          </sch:myRequest>
       </soapenv:Body>
    </soapenv:Envelope>
Working...
X