(CakePHP & SoapClient) Can't catch(try-catch) the error

Question

I am trying to catch the exception of SoapClient error.

The error is below.

Warning: Warning (2): SoapClient::SoapClient(http://url.url.com/services/v1_1/urlService?wsdl): failed to open stream: HTTP request failed! HTTP/1.1 401 Bad credentials

my code is below.

try {
   $userClient = new \SoapClient(Configure::read('soapData.soapUrlUser'),array(
      'login' => $usrnm,
      'password' => $passwd,
      'trace' => false,
      'exceptions' => true,
      'soap_version' => SOAP_1_2,
      'features' => SOAP_SINGLE_ELEMENT_ARRAYS))
      or exit("Unable to create soap client!");
}catch (Exception $e){
    $this->log($e, LOG_DEBUG);
}

and also used SoapFault. But it doesn't work. please any idea.


Show source
| cakephp   | cakephp-3.0   | try-catch   | soap-client   2017-01-06 07:01 0 Answers

Answers ( 0 )

◀ Go back