2004-02-24 14:31:49 +00:00
|
|
|
<?xml version='1.0' encoding='iso-8859-1'?>
|
2004-11-08 12:10:21 +00:00
|
|
|
<!-- $Revision: 1.7 $ -->
|
2004-02-24 14:31:49 +00:00
|
|
|
<refentry id="function.is-soap-fault">
|
|
|
|
<refnamediv>
|
|
|
|
<refname>is_soap_fault</refname>
|
|
|
|
<refpurpose>
|
2004-02-27 12:27:53 +00:00
|
|
|
Checks if SOAP call was failed
|
2004-02-24 14:31:49 +00:00
|
|
|
</refpurpose>
|
|
|
|
</refnamediv>
|
|
|
|
<refsect1>
|
|
|
|
<title>Description</title>
|
|
|
|
<methodsynopsis>
|
|
|
|
<type>bool</type><methodname>is_soap_fault</methodname>
|
|
|
|
<methodparam><type>mixed</type><parameter>obj</parameter></methodparam>
|
|
|
|
</methodsynopsis>
|
|
|
|
<para>
|
|
|
|
This function is useful when you like to check if the
|
2004-02-27 13:59:44 +00:00
|
|
|
SOAP call failed, but don't like to use exceptions.
|
2004-02-24 14:31:49 +00:00
|
|
|
To use it you must create a SoapClient object with
|
2004-02-27 13:59:44 +00:00
|
|
|
<literal>exceptions</literal> option set to zero or &false;.
|
|
|
|
In this case, the SOAP method will return a special SoapFault
|
|
|
|
object which encapsulates the fault details (faultcode,
|
2004-02-24 14:31:49 +00:00
|
|
|
faultstring, faultactor and faultdetails).
|
|
|
|
</para>
|
|
|
|
<para>
|
2004-02-27 13:59:44 +00:00
|
|
|
If <literal>exceptions</literal> is not set then SOAP call will throw
|
|
|
|
an exception on error.
|
2004-02-24 14:31:49 +00:00
|
|
|
<function>is_soap_fault</function> checks if the given
|
|
|
|
parameter is a SoapFault object.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
<example>
|
|
|
|
<title><function>is_soap_fault</function> example</title>
|
|
|
|
<programlisting role="php">
|
|
|
|
<![CDATA[
|
|
|
|
<?php
|
2004-07-15 23:00:52 +00:00
|
|
|
$client = new SoapClient("some.wsdl", array('exceptions' => 0));
|
2004-08-31 02:15:48 +00:00
|
|
|
$result = $client->SomeFunction();
|
2004-02-24 14:31:49 +00:00
|
|
|
if (is_soap_fault($result)) {
|
2004-07-15 23:00:52 +00:00
|
|
|
trigger_error("SOAP Fault: (faultcode: {$result->faultcode}, faultstring: {$result->faultstring})", E_ERROR);
|
2004-02-24 14:31:49 +00:00
|
|
|
}
|
|
|
|
?>
|
|
|
|
]]>
|
|
|
|
</programlisting>
|
|
|
|
</example>
|
|
|
|
<example>
|
|
|
|
<title>SOAP's standard method for error reporting is exceptions</title>
|
|
|
|
<programlisting role="php">
|
|
|
|
<![CDATA[
|
|
|
|
<?php
|
|
|
|
try {
|
2004-07-15 23:00:52 +00:00
|
|
|
$client = new SoapClient("some.wsdl");
|
2004-11-08 12:10:21 +00:00
|
|
|
$result = $client->SomeFunction(/* ... */);
|
2004-02-24 14:31:49 +00:00
|
|
|
} catch (SoapFault $fault) {
|
2004-07-15 23:00:52 +00:00
|
|
|
trigger_error("SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})", E_ERROR);
|
2004-02-24 14:31:49 +00:00
|
|
|
}
|
|
|
|
?>
|
|
|
|
]]>
|
|
|
|
</programlisting>
|
|
|
|
</example>
|
|
|
|
</para>
|
2004-02-27 16:36:36 +00:00
|
|
|
<para>
|
|
|
|
See also
|
|
|
|
<function>SoapClient::SoapClient</function>, and
|
|
|
|
<function>SoapFault::SoapFault</function>.
|
|
|
|
</para>
|
2004-02-24 14:31:49 +00:00
|
|
|
</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
|
|
|
|
-->
|