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
The SoapHeader class
(No version information available, might only be in SVN)
Introdução
Represents a SOAP header.
Sinopse da classe
SoapHeader
{
/* Métodos */
__construct
( string $namespace
, string $name
[, mixed $data
[, bool $mustunderstand
[, string $actor
]]] )
SoapHeader
( string $namespace
, string $name
[, mixed $data
[, bool $mustunderstand = false
[, string $actor
]]] )
}Índice
- SoapHeader::__construct — SoapHeader constructor
- SoapHeader::SoapHeader — SoapHeader constructor
jstilow at mobileobjects dot de
10-Oct-2011 01:03
