Today, I have faced a problem with SOAP client constructor. I have used an invalid URL to check the SOAP Client constructor. It should return some exceptions or error response if the URL is invalid. But unfortunately it returned nothing. I did not get any handler or exceptions. Then I have found XDEBUG EXTENSION for PHP which really helps to generate some exceptions or SOAP fault responses.

Here is sample code of XDEBUG functions with SOAP:

<code>

$nfxweb_url = 'http: //wrong-url------';
 try {
        if (function_exists('xdebug_disable')) {
            xdebug_disable();
        }
        return new SoapClient($nfxweb_url, Array('trace'=>true, 'exceptions'=>true));
 }
 catch(Exception $exception) {
       var_dump($exception);
 }
    
 if (function_exists('xdebug_enable')) {
       xdebug_enable();
 }

</code>
    
For more you can explore the followings:

http://xdebug.org/docs/
http://xdebug.org/docs/all_functions

Add new comment