dongyong3223
2013-12-10 07:24
浏览 59
已采纳

PHP SOAP第二个请求不会引发异常

i am trying to connect to a webservice. My webserviceHelper is:

class webserviceHelper {
 public function __construct($params) {

        $this->service_url = $params['service_url'];

        try {
            $this->soap = new SoapClient($this->service_url, 
                                    array('exceptions' => true));
        } 
        catch (SoapFault $exc) {
            echo 'SoapFault<br />';
            die;
        }
        catch (Exception $exc) {
            echo 'Exception<br />';
            die;
        } 
    }

    ...
}

When the service is down, i make a request to the page where the webserviceHelper object created. Before the response i make second request to the same page. At first one, i got "soapFault" as output but at the second, i got a fatal error.

Fatal error: SOAP-ERROR: Parsing WSDL: Couldn't load from 'WebService?wsdl' : failed to load external entity "WebService?wsdl" in webserviceHelper.php on line 40

How can i prevent this error?

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • duanhuo3392 2013-12-10 12:28
    已采纳

    I handled it by using a hook in codeigniter. Thanks to the blogger. How To Catch PHP Fatal Error In CodeIgniter

    已采纳该答案
    打赏 评论
  • doumeilmikv7099 2013-12-10 08:12

    use error_get_last() after $this->soap = new SoapClient(..... to get potential errors

    打赏 评论

相关推荐 更多相似问题