<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="soapclient.setsoapheaders" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
 <refnamediv>
  <refname>SoapClient::__setSoapHeaders</refname>
  <refpurpose>Sets SOAP headers for subsequent calls</refpurpose>
 </refnamediv>

 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis role="SoapClient">
   <modifier>public</modifier> <type>bool</type><methodname>SoapClient::__setSoapHeaders</methodname>
   <methodparam choice="opt"><type class="union"><type>SoapHeader</type><type>array</type><type>null</type></type><parameter>headers</parameter><initializer>&null;</initializer></methodparam>
  </methodsynopsis>
  <para>
   Defines headers to be sent along with the SOAP requests.
  </para>
  <note>
   <para>
    Calling this method will replace any previous values.
   </para>
  </note>
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  <para>
   <variablelist>
    <varlistentry>
     <term><parameter>headers</parameter></term>
     <listitem>
      <para>
       The headers to be set. It could be <classname>SoapHeader</classname>
       object or array of <classname>SoapHeader</classname> objects.
       If not specified or set to &null;, the headers will be deleted.
      </para>
     </listitem>
    </varlistentry>
   </variablelist>
  </para>
 </refsect1>

 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   &return.success;
  </para>
 </refsect1>

 <refsect1 role="examples">
  &reftitle.examples;
  <para>
   <example>
    <title><function>SoapClient::__setSoapHeaders</function> example</title>
    <programlisting role="php">
<![CDATA[
<?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);
?>
]]>
    </programlisting>
   </example>
  </para>
    <para>
     <example>
      <title>Set Multiple Headers</title>
      <programlisting role="php">
<![CDATA[
<?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);
?>
]]>
      </programlisting>
     </example>
    </para>
 </refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
