note 101258 added to class.soapserver
| From: | Guile at osu1 dot php dot net | Date: | Mon, 06 Dec 2010 09:27:04 +0000 |
| Subject: | note 101258 added to class.soapserver | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-174638@lists.php.net to get a copy of this message | ||
Here is simple class that allows to use Zend_Soap_Server with Soap headers
<?php
/**
* Class extending the Zend_Soap_Server that allow to add customized header
* It overloads the constructor and the __getSoap method
*/
class My_SoapServer extends Zend_Soap_Server {
/**
*
* @var array Array of SoapHeader to add to the SoapServer instance
*/
protected $headers;
/**
* Instanciate an instance
* @param string $wsdl URL of the WSDL where services are described
* @param array $options Options that SoapServer instance will handle
*/
public function __construct($wsdl = null, array $options = null) {
$this->headers = array();
parent::__construct($wsdl, $options);
}
/**
* Add a SoapHeader to the soap answer
* @param SoapHeader $header Header to send with the SOAP answer inside the XML
*/
public function addSoapHeader(SoapHeader $header) {
$this->headers[] = $header;
}
/**
* Method overload that adds SoapHeader to the SoapServer instance
* @return SoapServer The instance of the SoapServer use for handling response
*/
protected function __getSoap() {
$soap = parent::__getSoap();
foreach ($this->headers as $header) {
$soap->addSoapHeader($header);
}
return $soap;
}
}
?>
----
Server IP: 89.31.146.176
Probable Submitter: 83.142.146.171
----
Manual Page -- http://www.php.net/manual/en/class.soapserver.php
Edit -- https://master.php.net/note/edit/101258
Del: integrated -- https://master.php.net/note/delete/101258/integrated
Del: useless -- https://master.php.net/note/delete/101258/useless
Del: bad code -- https://master.php.net/note/delete/101258/bad+code
Del: spam -- https://master.php.net/note/delete/101258/spam
Del: non-english -- https://master.php.net/note/delete/101258/non-english
Del: in docs -- https://master.php.net/note/delete/101258/in+docs
Del: other reasons-- https://master.php.net/note/delete/101258
Reject -- https://master.php.net/note/reject/101258
Search -- https://master.php.net/manage/user-notes.php