Loading ...
Sorry, an error occurred while loading the content.

SOAP WS-Security Header w/ Timestamp and UsernameToken nodes

Expand Messages
  • gcpochron
    Hello, I ve looked low and high and can t find any example code on how to construct a security header that contains both Timestamp and UsernameToken nodes. I
    Message 1 of 2 , Dec 9, 2009
    View Source
    • 0 Attachment
      Hello,

      I've looked low and high and can't find any example code on how to construct a security header that contains both Timestamp and UsernameToken nodes. I need to construct a header that looks like this:

      <soapenv:Header>
      <wsse:Security soapenv:mustUnderstand="1">
      <wsu:Timestamp wsu:Id="Timestamp">
      <wsu:Created>2009-12-09T16:34:34.990Z</wsu:Created>
      <wsu:Expires>2009-12-09T16:44:34.990Z</wsu:Expires>
      </wsu:Timestamp>
      <wsse:UsernameToken xsi:type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
      <wsse:Username>user</wsse:Username>
      <wsse:Password>2dqe1e123</wsse:Password>
      <wsse:Nonce>de87wdsd23d23e</wsse:Nonce>
      <wsse:Created>2009-05-19T16:02:45.168Z</wsse:Created>
      </wsse:UsernameToken>
      </wsse:Security>
      </soapenv:Header>

      Does anyone know of any code examples that demonstrate how to implement this? I've got everything except for the Timestamp node. Here is what I've done so far:

      my $authhash_ref = {
      Username => SOAP::Data->type( '' => $username )->prefix('wsse'),
      Password => SOAP::Data->type( $token => $pw_digest )->prefix('wsse'),
      Nonce => SOAP::Data->type( '' => $nonce)->prefix('wsse'),
      Created => SOAP::Data->type('' => $timestamp)->prefix('wsu'),
      };


      my $security_header = SOAP::Header->new(
      name => 'Security',
      prefix => 'wsu',
      uri => $wsu,
      value => \SOAP::Data->new(
      name => 'UsernameToken',
      prefix => 'wsse',
      type => $wsse,
      value => $authhash_ref,
      ),
      );

      Any help would be greatly appreciated.
    • martin.busik@busik.de
      Hi, ... take a look at: http://www.wlp-systems.de/soap-lite-and-ws-security.html There is no timestamp in the example, but with that example it should be
      Message 2 of 2 , Dec 10, 2009
      View Source
      • 0 Attachment
        Hi,

        > I've looked low and high and can't find any example code on how to construct a security header
        > that contains both Timestamp and UsernameToken nodes. I need to construct a header
        > that looks like this:

        take a look at:

        http://www.wlp-systems.de/soap-lite-and-ws-security.html

        There is no timestamp in the example, but with that example it should be straight forward to
        extend it.

        Cheers,
        Martin
      Your message has been successfully submitted and would be delivered to recipients shortly.