Updated soap-soapheader-construct.xml with an example that explains the necessary steps to generate attributes in the SOAP Header xml.

Added soap-soapclient-setsoapheaders.xml for missing SoapClient->__setSoapHeaders method.


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@269496 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Herman J. Radtke III 2008-11-21 23:09:40 +00:00
parent adcaa3649e
commit 099d4688bf
2 changed files with 155 additions and 2 deletions

View file

@ -0,0 +1,122 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.1 $ -->
<refentry xml:id="function.soap-soapclient-setsoapheaders" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>SoapClient->__setSoapHeaders</refname>
<refpurpose>
Sets SOAP headers for subsequent calls.
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<classsynopsis>
<ooclass><classname>SoapClient</classname></ooclass>
<methodsynopsis>
<type>bool</type>
<methodname>__setSoapHeaders</methodname>
<methodparam choice="opt"><type>mixed</type><parameter>headers</parameter></methodparam>
</methodsynopsis>
</classsynopsis>
<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. If not specified, 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>Set A Single Header</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:"../../../../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
-->

View file

@ -1,5 +1,5 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.5 $ -->
<!-- $Revision: 1.6 $ -->
<refentry xml:id="function.soap-soapheader-construct" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>SoapHeader->__construct</refname>
@ -78,7 +78,7 @@
&reftitle.examples;
<para>
<example>
<title>Some examples</title>
<title>Basic Example</title>
<programlisting role="php">
<![CDATA[
<?php
@ -89,6 +89,37 @@ $client->__soapCall("echoVoid", null, null,
'echoMeStringRequest',
'hello world'));
?>
]]>
</programlisting>
</example>
</para>
<para>
<example>
<title>Complex Type With Attributes</title>
<programlisting role="php">
<![CDATA[
<?php
$client = new SoapClient('http://example.com/webservice.asmx?wsdl');
$attributes = array('attr1' => 'value1', 'attr2' => 'value2');
// the type_name and type_namespace parameters must be specified
// when specifying attributes
$complex_type = new SOAPVar($attributes,
SOAP_ENC_OBJECT,
'ComplexType', // type_name
'http://www.example.com/namespace', // type_namespace
'complex_type',
'http://www.example.com/namespace');
$header = new SOAPHeader('http://www.example.com/namespace',
'ComplexType',
$complex_type,
true);
$client->__soapCall("someFunc", null, null, $header);
?>
]]>
</programlisting>
</example>