开发者

Soap Client dont throw on exception

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜