PHP 8.2.0 Alpha 2 available for testing


(PHP 5 >= 5.1.3, PHP 7, PHP 8)

SoapServer::addSoapHeaderДобавить заголовок SOAP в ответ


public SoapServer::addSoapHeader(SoapHeader $header): void

Добавляет заголовок SOAP в возвращаемый ответ на текущий запрос.

Список параметров


Возвращаемый заголовок.

Возвращаемые значения

Функция не возвращает значения после выполнения.

add a note

User Contributed Notes 1 note

vladimir at bashkirtsev dot com
5 years 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"));

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