SOAP
PHP Manual

SoapClient->__setSoapHeaders

(No version information available, might be only in CVS)

SoapClient->__setSoapHeaders Sets SOAP headers for subsequent calls.

Beschreibung

SoapClient
bool __setSoapHeaders ([ mixed $headers ] )

Defines headers to be sent along with the SOAP requests.

Hinweis: Calling this method will replace any previous values.

Parameter-Liste

headers

The headers to be set. If not specified, the headers will be deleted.

Rückgabewerte

Gibt bei Erfolg TRUE zurück, im Fehlerfall FALSE.

Beispiele

Beispiel #1 Set A Single Header

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

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


SOAP
PHP Manual