首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

is_soap_fault

(Unknown)

is_soap_fault — Checks if a SOAP call has failed

Description

代码语言:javascript
复制
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.

Parameters

object

The object to test.

Return Values

This will return TRUE on error, and FALSE otherwise.

Examples

Example #1 is_soap_fault() example

代码语言:javascript
复制
<?php
$client?=?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

代码语言:javascript
复制
<?php
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);
}
?>

See Also

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

use_soap_error_handler →

代码语言:txt
复制
 ? 1997–2017 The PHP Documentation Group

Licensed under the Creative Commons Attribution License v3.0 or later.

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com