note 58245 added to function.soap-soapheader-construct
| From: | jaredDOTkuolt at gmail dot com | Date: | Fri, 28 Oct 2005 16:57:09 +0000 |
| Subject: | note 58245 added to function.soap-soapheader-construct | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-97748@lists.php.net to get a copy of this message | ||
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(){
// Blah blah blah
$this->soap = new SoapClient($this->foo, $this->bar);
}
// Build that header!
private function build_auth_header(){
// Build an object with parameters
$auth->username = $this->username;
$auth->password = $this->password;
$authvalues = new SoapVar($auth, SOAP_ENC_OBJECT);
$header = new SoapHeader($this->name_space, "Authentication", // Rename this
to the tag you need
$authvalues, false);
$this->soap->__setSoapHeaders(array($header));
}
// Wrapper so we can build auth header first
public function MySoapFunction($params){
$this->build_auth_header();
$this->soap->MySoapFunction($params);
}
}
?>
----
Manual Page -- http://www.php.net/manual/en/function.soap-soapheader-construct.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+58245
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+58245&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+58245&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+58245&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+58245&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+58245&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+58245&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+58245&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+58245&report=yes
Search -- http://master.php.net/manage/user-notes.php