To build the authentication headers like below FOR WSDL:
**NOTE** I cannot find documentation on the __setSoapHeaders() method, though it does work in 5.0.4
<?php
class MySoapClass
{
function __construct(){
$this->soap = new SoapClient($this->foo, $this->bar);
}
private function build_auth_header(){
$auth->username = $this->username;
$auth->password = $this->password;
$authvalues = new SoapVar($auth, SOAP_ENC_OBJECT);
$header = new SoapHeader($this->name_space, "Authentication", $authvalues, false);
$this->soap->__setSoapHeaders(array($header));
}
public function MySoapFunction($params){
$this->build_auth_header();
$this->soap->MySoapFunction($params);
}
}
?>