PHP SOAP error catching

后端 未结 7 1313
北恋
北恋 2020-12-14 07:49

I\'m getting desperate, all I want is simple error handling when the PHP SOAP Web Service is down to echo an error message login service down. Please help me!

相关标签:
7条回答
  • 2020-12-14 08:24

    SoapFault doesn't extends Exception, catch the especific type works:

    try {
      $client = new SoapClient("http://192.168.0.142:8080/services/Logon?wsdl",array(
        'exceptions' => true,
      ));
    }
    catch ( SoapFault $e )
    {
        echo 'sorry... our service is down';
    }
    
    0 讨论(0)
提交回复
热议问题