I asked about this 6 months ago but haven't solved it - now the client is complaining

the site accesses a wsdl service via SOAP - which goes offline a lot - so url of wsdl is valid but wsdl is not there

am using Pear > SOAP

al I want to do is check if the wsdl exists and show a message if it is offline - what happens now is that I get soap errors dumped to screen if service is offline

try
	{
		$vies = new SoapClient($wsdl);
	}
	catch(SoapFault $e){
		$return_value = 'VAT check service is not available.';
		return $return_value;
	}

what seems to happen if the wsdl is offline is that at the 'try' statement, the soap code barfs ... and only then runs the 'catch' process

can I suppress these errors?
anything else I can do?

    9 days later

    Try this maybe.

    try
        {
            $vies = new SoapClient($wsdl, array('exceptions'=>false));
        }
        catch(SoapFault $e){
            $return_value = 'VAT check service is not available.';
            return $return_value;
        } 

      Another possibility is that you use [man]file_get_contents[/man] to fetch the WSDL url first and if it returns maybe feed it to your SOAP code. If your server setup prevents the fopen functions from opening urls (it's a php.ini setting) then you might try [man]cURL[/man] to fetch the remote WSDL.

      You might also try caching the WSDL. Or permanently writing it to a file or something.

        Write a Reply...