如何捕获Uncaught SoapFault异常

时间:2013-07-01 09:44:48

标签: soap codeigniter-2 soap-client

我收到以下错误。怎么了?如何捕获或解决此异常。

  

致命错误:未捕获的SoapFault异常:[a:InternalServiceFault]由于内部错误,服务器无法处理请求。有关错误的更多信息,请在服务器上启用IncludeExceptionDetailInFaults(来自ServiceBehaviorAttribute或配置行为)以将异常信息发送回客户端,或者根据Microsoft .NET Framework 3.0 SDK文档启用跟踪并检查服务器跟踪日志。在G:\ work \ htdocs \ Robi_Francis_API \ application \ controllers \ mirsValidation.php:117堆栈跟踪:#0 G:\ work \ htdocs \ Robi_Francis_API \ application \ controllers \ mirsValidation.php(117):SoapClient-> __ call( 'processPayment',Array)#1 G:\ work \ htdocs \ Robi_Francis_API \ application \ controllers \ mirsValidation.php(117):SoapClient-> processPayment(Array)#2 [内部函数]:MirsValidation-> process(' 13774373733576')#3 G:\ work \ htdocs \ Robi_Francis_API \ system \ core \ CodeIgniter.php(359):call_user_func_array(Array,Array)G:\ work \ htdocs \ Robi_Francis_API中的#4 G:\ work \ htdocs \ Robi_F第117行上的\ application \ controllers \ mirsValidation.php

1 个答案:

答案 0 :(得分:9)

试试这个:

<?php

    try {
        $url = "/api/TestService.asmx?wsdl";
        $client = new SoapClient($url, array("trace" => 1, "exception" => 0));
    } catch (SoapFault $exception) {
        echo $exception->getMessage();
    }
?>