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
La classe SoapHeader
(No version information available, might only be in SVN)
Introduction
Représente un entête SOAP.
Synopsis de la classe
SoapHeader
{
/* Méthodes */
__construct
( string $namespace
, string $name
[, mixed $data
[, bool $mustunderstand
[, string $actor
]]] )
SoapHeader
( string $namespace
, string $name
[, mixed $data
[, bool $mustunderstand = false
[, string $actor
]]] )
}Sommaire
- SoapHeader::__construct — Constructeur SoapHeader
- SoapHeader::SoapHeader — SoapHeader constructor
jstilow at mobileobjects dot de
10-Oct-2011 09:03
