php-doc-en/reference/soap/functions/soap-soapfault-construct.xml
Dmitry Stogov f08186baa1 1. New function SoapClient->__callSoap() is a replacement for old derecated SoapClient->__call().
2. Description of SoapClient->__doRequest() method.
3. Description of additional options for SoapClient and SoapServer constructors.


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@178444 c90b9560-bf6c-de11-be94-00142212c4b1
2005-01-28 14:02:11 +00:00

164 lines
4.5 KiB
XML

<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.2 $ -->
<refentry id="function.soap-soapfault-construct">
<refnamediv>
<refname>SoapFault->__construct()</refname>
<refpurpose>
SoapFault constructor
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<classsynopsis>
<ooclass><classname>SoapFault</classname></ooclass>
<constructorsynopsis>
<methodname>__construct</methodname>
<methodparam><type>string</type><parameter>faultcode</parameter></methodparam>
<methodparam><type>string</type><parameter>faultstring</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>faultactor</parameter></methodparam>
<methodparam choice="opt"><type>mixed</type><parameter>detail</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>faultname</parameter></methodparam>
<methodparam choice="opt"><type>SoapHeader</type><parameter>headerfault</parameter></methodparam>
</constructorsynopsis>
</classsynopsis>
<para>
This class is useful when you would like to send SOAP fault responses from
the PHP handler. <parameter>faultcode</parameter>, <parameter>faultstring</parameter>,
<parameter>faultactor</parameter> and <parameter>details</parameter> are
standard elements of SOAP Fault;
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>faultcode</parameter></term>
<listitem>
<para>
The error code of the <classname>SoapFault</classname>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>faultstring</parameter></term>
<listitem>
<para>
The error message of the <classname>SoapFault</classname>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>faultactor</parameter></term>
<listitem>
<para>
A string identifying the actor that caused the error.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>detail</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>faultname</parameter></term>
<listitem>
<para>
Can be used to select the proper fault encoding from WSDL.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>headerfault</parameter></term>
<listitem>
<para>
Can be used during SOAP header handling to report an error in the
response header.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Some examples</title>
<programlisting role="php">
<![CDATA[
<?php
function test($x)
{
return new SoapFault("Server", "Some error message");
}
$server = new SoapServer(null, array('uri' => "http://test-uri/"));
$server->addFunction("test");
$server->handle();
?>
]]>
</programlisting>
</example>
</para>
<para>
It is possible to use PHP exception mechanism to throw SOAP Fault.
</para>
<para>
<example>
<title>Some examples</title>
<programlisting role="php">
<![CDATA[
<?php
function test($x)
{
throw new SoapFault("Server", "Some error message");
}
$server = new SoapServer(null, array('uri' => "http://test-uri/"));
$server->addFunction("test");
$server->handle();
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><xref linkend="function.soap-soapclient-construct" /></member>
<member><xref linkend="function.soap-soapclient-soapcall" /></member>
<member><xref linkend="function.soap-soapvar-construct" /></member>
<member><xref linkend="function.soap-soapparam-construct" /></member>
<member><xref linkend="function.soap-soapfault-construct" /></member>
<member><function>is_soap_fault</function></member>
</simplelist>
</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
-->