note 106101 modified in class.soapheader by danbrown
| From: | danbrown@php.net | Date: | Mon, 10 Oct 2011 15:44:01 +0000 |
| Subject: | note 106101 modified in class.soapheader by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-183766@lists.php.net to get a copy of this message | ||
It cost me some time to figure out how to add a SoapHeader to a server response. For me the
following solution works well enough:
<?php
class SoapService {
private $server = null;
public function __construct($server)
{
$this->server = $server;
}
public function soap($request) {
// do something useful
// These are the two "magic" lines:
$header = new SoapHeader("namespace", "name", new HeaderClass("possible
some parameters"));
$this->soap_server->addSoapHeader($header);
// do more useful stuff
}
}
$soap_server = new SoapServer("./your.wsdl");
$soap_server->setClass("SoapService", $soap_server);
$soap_server->handle();
?>
See also:
https://bugs.php.net/bug.php?id=32410
--was--
It cost me some time to figure out how to add a SoapHeader to a server response. For me the
following solution works well enough:
class SoapService {
private $server = null;
public function __construct($server)
{
$this->server = $server;
}
public function soap($request) {
// do something useful
// These are the two "magic" lines:
$header = new SoapHeader("namespace", "name", new HeaderClass("possible
some parameters"));
$this->soap_server->addSoapHeader($header);
// do more useful stuff
}
}
$soap_server = new SoapServer("./your.wsdl");
$soap_server->setClass("SoapService", $soap_server);
$soap_server->handle();
See also:
https://bugs.php.net/bug.php?id=32410
http://php.net/manual/en/class.soapheader.php