PHPWales 2020 - June 3rd to June 4th

SoapServer::addSoapHeader

(PHP 5 >= 5.1.3, PHP 7)

SoapServer::addSoapHeaderSOAP ヘッダをレスポンスに追加する

説明

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

現在のリクエストから返されるレスポンスに SOAP ヘッダを追加します。

パラメータ

object

返すヘッダ。

返り値

値を返しません。

add a note add a note

User Contributed Notes 1 note

up
1
vladimir at bashkirtsev dot com
3 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"));
$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