PHP 5.6.29 Released

SoapServer::addSoapHeader

(PHP 5 >= 5.0.1, PHP 7)

SoapServer::addSoapHeaderAdd a SOAP header to the response

Beschreibung

public void SoapServer::addSoapHeader ( SoapHeader $object )

Adds a SOAP header to be returned with the response to the current request.

Parameter-Liste

object

The header to be returned.

R├╝ckgabewerte

Es wird kein Wert zur├╝ckgegeben.

add a note add a note

User Contributed Notes 1 note

up
0
vladimir at bashkirtsev dot com
17 days ago
Notably addSoapHeaders() must be called within handling class/object.

If you call addSoapHeaders() like this:

$server = new SoapServer("some.wsdl");
$server->setObject(new Service());
$server->addSoapHeaders(new SoapHeader("ns", "Header", "value"));
$server->handle();

Your SOAP header will not be added to the server response as it will be overwritten by result of handle() function.

If you want to add SOAP headers to the resulting response you should make $server global/static variable and then call addSoapHeaders() from within of the method of Service class which will handle the request.
To Top