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
SoapHeader クラス
(バージョン情報なし。おそらく SVN 版にしか存在しないでしょう)
導入
SOAP ヘッダをあらわします。
クラス概要
SoapHeader
{
/* メソッド */
__construct
( string $namespace
, string $name
[, mixed $data
[, bool $mustunderstand
[, string $actor
]]] )
SoapHeader
( string $namespace
, string $name
[, mixed $data
[, bool $mustunderstand = false
[, string $actor
]]] )
}目次
- SoapHeader::__construct — SoapHeader コンストラクタ
- SoapHeader::SoapHeader — SoapHeader コンストラクタ
jstilow at mobileobjects dot de
10-Oct-2011 07:03
