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?

查看全部
dongyong3223
dongyong3223
2013/12/10 07:24
  • php
  • soap
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

2个回复