is_soap_fault Checks if a SOAP call has failed php函数



is_soap_faultChecks if a SOAP call has failed


bool is_soap_fault ( mixed $object )

This function is useful to check if the SOAP call failed, but without using exceptions. To use it, create a SoapClient object with the exceptions option set to zero or FALSE. In this case, the SOAP method will return a special SoapFault object which encapsulates the fault details (faultcode, faultstring, faultactor and faultdetails).

If exceptions is not set then SOAP call will throw an exception on error. is_soap_fault() checks if the given parameter is a SoapFault object.



The object to test.


This will return TRUE on error, and FALSE otherwise.


Example #1 is_soap_fault() example

= new SoapClient("some.wsdl", array('exceptions' => 0));
$result $client->SomeFunction();
if (
is_soap_fault($result)) {
trigger_error("SOAP Fault: (faultcode: {$result->faultcode}, faultstring: {$result->faultstring})"E_USER_ERROR);

Example #2 SOAP's standard method for error reporting is exceptions

try {
$client = new SoapClient("some.wsdl");
$result $client->SomeFunction(/* ... */);
} catch (
SoapFault $fault) {
trigger_error("SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})"E_USER_ERROR);


  • SoapClient::SoapClient() - SoapClient constructor
  • SoapFault::SoapFault() - SoapFault constructor

is_string 检测变量是否是字符串
is_subclass_of 如果此对象是该类的子类,则返回 TRUE
is_uploaded_file 判断文件是否是通过 HTTP POST 上传的
is_writable 判断给定的文件名是否可写
is_writeable is_writable 的别名
iterator_apply 为迭代器中每个元素调用一个用户自定义函数
iterator_count 计算迭代器中元素的个数
iterator_to_array 将迭代器中的元素拷贝到数组
JDDayOfWeek 返回星期的日期
JDMonthName 返回月份的名称
JDToFrench 转变一个Julian Day计数到French Republican历法的日期
JDToGregorian 转变一个Julian Day计数为Gregorian历法日期
jdtojewish 转换一个julian天数为Jewish历法的日期
JDToJulian 转变一个Julian Day计数到Julian历法的日期

Copyright © 2016 phpStudy |