update : 2015.11.03
php.shukuma.com

검색:
 
 
Sets SOAP headers for subsequent calls

SoapClient::__setSoapHeaders

(PHP 5 >= 5.0.5)

SoapClient::__setSoapHeadersSets SOAP headers for subsequent calls

설명

public bool SoapClient::__setSoapHeaders ([ mixed $soapheaders ] )

Defines headers to be sent along with the SOAP requests.

Note:

Calling this method will replace any previous values.

인수

soapheaders

The headers to be set. It could be SoapHeader object or array of SoapHeader objects. If not specified or set to NULL, the headers will be deleted.

반환값

성공 시 TRUE를, 실패 시 FALSE를 반환합니다.

예제

Example #1 SoapClient::__setSoapHeaders() example

<?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);
?>

Example #2 Set Multiple Headers

<?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);
?>