note 49151 deleted from soapheader.soapheader by googleguy
| From: | googleguy@php.net | Date: | Tue, 22 Oct 2013 10:14:11 +0000 |
| Subject: | note 49151 deleted from soapheader.soapheader by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-196921@lists.php.net to get a copy of this message | ||
Note Submitter: php dot net at sowen dot de
----
If you are trying to create a header like this:
<SOAP-ENV:Header>
<ns2:authenticate SOAP-ENV:actor="http://schemas.xmlsoap.org/soap/actor/next">
<username>myuser</username>
<password>secret</password>
</ns2:authenticate>
</SOAP-ENV:Header>
Try to use a class to create Header-vars:
class authentication_header {
private $username;
private $password;
public function __construct($username,$password) {
$this->username=$username;
$this->password=$password;
}
}
In your soap client program:
// generate new object
$auth=new authentication_header('myuser','secret');
// create authentication header values
$authvalues=new SoapVar($auth,SOAP_ENC_OBJECT,'authenticate');
// generate header
$header=new SoapHeader("myURN",
"authenticate",
$authvalues,
false,
"http://schemas.xmlsoap.org/soap/actor/next");
And do the request like this (non-WSDL version):
$client->__call('function', $params, null, $header);
Have fun,
Nils Sowen