SoapClient::__setSoapHeaders

Sets SOAP headers for subsequent calls

&reftitle.description; public `bool` `SoapClient::__setSoapHeaders` ``SoapHeader``array``null```headers`&null;

Defines headers to be sent along with the SOAP requests.

Calling this method will replace any previous values.

&reftitle.parameters;

`headers`

- 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.

&reftitle.returnvalues;

&return.success;

&reftitle.examples;

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

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