Exception Help!

Hi guys,

I’m having problems catching an exception with this method:

    public function newSoapClient($headers=array()){
        try {
            $headers    = array_merge($headers, array('trace' => 1, 'exceptions' => TRUE));
            $client     = NEW SoapClient($this->wsdl(), $headers);
        } catch (SoapFault $e) {
            die($e->getMessage());
        }
    }

The value $this->wsdl() is invalid at the moment (ie unavailable) so SoapClient appears to be throwing a fatal exception. I need to catch this if possible, but I can’t work out how. Any ideas please guys?

I dont know much about exceptions, but as far as I know you need to throw an exception before you can catch it…

so I guess it should be:

throw new SoapClient($this->wsdl(), $headers);

SoapClient() is throwing the exception. I think that because it’s a fatal error that there’s nothing I can catch :frowning:

What exactly is the fatal exception?

Couldn’t tell you right now as I left work 3 hours ago, but basically it’s because no WSDL could be loaded (the connection will time out). My concern is if this happens on the front end of the site that I can’t display a friendly error or fall back to an alternative.

Here you go:

Fatal error: SOAP-ERROR: Parsing WSDL: Couldn’t load from ‘…URL…’ in …FILENAME… on line 585