I wish to gracefully fail connecting to a Soap source.

Here's a simple test:

class TestController extends AppController {
    public function get_soap_stuff(){
        $address = "http://noneexisteenat.com/wsdl.wsdl";;
        try {
            @$client = new SoapClient($address, array('exceptions' => 
true));
            $this->set('result', 'OK');
        }
        catch(SoapFault $e){
            trigger_error("Soap address $address unreachable", 
E_USER_NOTICE);
            $this->set('result', 'address unreachable');
        }
    }
}

The view only has  <?php debug($result); ?> in it.

I am *expecting* to see "address unreachable" nicely debugged in my layout 
and a Warning message (if in debug mode).

*What actually happens:*
The ErrorHandler prints out a

Fatal Error
Error: SOAP-ERROR: Parsing WSDL: Couldn't load from 
'http://noneexisteenat.com/wsdl.wsdl' : failed to load external entity 
"http://noneexisteenat.com/wsdl.wsdl"; 
File: C:\srv\zmt\app\Controller\TestingController.php 
Line: 16

AFTER my nicely printed-out layout. The layout is actually printed out 
twice, once for my view and once for the ErrorHandler.

How can I STOP the ErrorHandler from printing out (it happens inApp::shutdown() 
=> App::_checkFatalError()
).

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to