php-doc-en/reference/soap/functions/SoapFault-SoapFault.xml
Mehdi Achour 06c980ee99 See also
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@152556 c90b9560-bf6c-de11-be94-00142212c4b1
2004-02-27 16:36:36 +00:00

102 lines
3.1 KiB
XML

<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.5 $ -->
<refentry id="function.SoapFault-SoapFault">
<refnamediv>
<refname>SoapFault::SoapFault</refname>
<refpurpose>
SoapFault constructor
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>object</type><methodname>SoapFault::SoapFault</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>mixed</type><parameter>headerfault</parameter></methodparam>
</methodsynopsis>
<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; <parameter>faultname</parameter> is an
optional parameter that can be used to select proper fault encoding from
WSDL; <parameter>headerfault</parameter> is an optional parameter that
can be used during SOAP header handling to report an error in the response
header.
</para>
<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>
<para>
See also
<function>SoapClient::SoapClient</function>,
<function>SoapClient::__call</function>,
<function>SoapParam::SoapParam</function>,
<function>SoapVar::SoapVar</function>, and
<function>is_soap_fault</function>.
</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
-->