0 Replies Latest reply on Oct 13, 2007 2:07 PM by InvestmentCafe

    UserNameToken

    InvestmentCafe
      I am trying to add a usernametoken to a webservice call. I found a good example on LiveDocs but can't seem to implement.

      ==========================
      public function toXML():XML{
      var usernameToken:XML =
      <wsse:Security xmlns:wsse=" http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu=" http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
      <wsse:UsernameToken>
      <wsse:Username>{this.username}</wsse:Username>
      <wsse:Password Type=" http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#Passwor dDigest">{this.password}</wsse:Password>
      <wsse:Nonce EncodingType=" http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Bi nary">{this.nonce}</wsse:Nonce>
      <wsu:Created>{this.created}</wsu:Created>
      </wsse:UsernameToken>
      </wsse:Security>
      return usernameToken;
      }

      Here is how I am using this:

      // Create username token.
      var usernameToken:UsernameToken = new UsernameToken("admin", "admin");
      var wsse:Namespace = new Namespace(" http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd");
      var wsseSecurity:QName = new QName(wsse.uri, "Security");
      var header:SOAPHeader = new SOAPHeader(wsseSecurity, {"wsse":"Security"});
      header.content = usernameToken.toXML();
      service.addHeader(header);
      ==========================

      I can't seem to find "this.nonce" or "this.created" does anybody know what base class these would be in?