开发者

Soap Client dont throw on exception

开发者 https://www.devze.com 2023-03-28 02:19 出处:网络
i want when my wsdl server is down, SoapClient Throw to Exception, can any body help to me ? function a()

i want when my wsdl server is down, SoapClient Throw to Exception, can any body help to me ?

function a()
{
    try
    {
        $wsdl = @new SoapCli开发者_运维知识库ent( 'http://somedomain.com' );
        return true;
    } catch( Exception  $sf )
    {
        return false;
    }
}
var_dump( a() );

i want result of my code is : false but when server down, my page is only white and has not any output


Have you tried catching a SoapFault Exception instead of just a regular Exception?



    function a()
    {
        try
        {
            $wsdl = @new SoapClient( 'http://somedomain.com' );
            return true;
        } catch( SoapFault  $sf )
        {
            return false;
        }
    }
    var_dump( a() );

0

精彩评论

暂无评论...
验证码 换一张
取 消