以降のコール用の SOAP ヘッダを設定する
$headers
null
SOAP リクエストで送信するヘッダを定義します。
注意: このメソッドをコールすると、それまでの値はすべて上書きされます。
注意:
このメソッドをコールすると、それまでの値はすべて上書きされます。
headers
設定したいヘッダ。SoapHeader オブジェクト、あるいは SoapHeader オブジェクトの配列です。 省略したり null を設定したりした場合はヘッダが削除されます。
成功した場合に true を、失敗した場合に false を返します。
true
false
例1 SoapClient::__setSoapHeaders の例
<?php $client = new SoapClient(null, array('location' => "http://localhost/soap.php", 'uri' => "http://test-uri/")); $header = new SoapHeader('http://soapinterop.org/echoheader/', 'echoMeStringRequest', 'hello world'); $client->__setSoapHeaders($header); $client->__soapCall("echoVoid", null); ?>
例2 複数のヘッダの設定
<?php $client = new SoapClient(null, array('location' => "http://localhost/soap.php", 'uri' => "http://test-uri/")); $headers = array(); $headers[] = new SoapHeader('http://soapinterop.org/echoheader/', 'echoMeStringRequest', 'hello world'); $headers[] = new SoapHeader('http://soapinterop.org/echoheader/', 'echoMeStringRequest', 'hello world again'); $client->__setSoapHeaders($headers); $client->__soapCall("echoVoid", null); ?>