You are here

public function WSSESecurityHeader::__construct in Web service client 7

Create the header block.

Parameters

string $username: Username.

string $password: Password.

File

wsclient_soap/wsclient_soap.module, line 159
Web service client SOAP support.

Class

WSSESecurityHeader
Class WSSESecurityHeader

Code

public function __construct($username, $password) {
  $wsse_ns = 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd';
  $security = new SoapVar(array(
    new SoapVar(array(
      new SoapVar($username, XSD_STRING, NULL, NULL, 'Username', $wsse_ns),
      new SoapVar($password, XSD_STRING, NULL, NULL, 'Password', $wsse_ns),
    ), SOAP_ENC_OBJECT, NULL, NULL, 'UsernameToken', $wsse_ns),
  ), SOAP_ENC_OBJECT);
  parent::__construct($wsse_ns, 'Security', $security, FALSE);
}