PHP SoapClient SSL连接超时错误


PHP SoapClient SSL connection timeout error

在启动PHPSOAP客户端Web服务时,我在生产中遇到了这些错误。

这是产生错误的代码行:

//the php soap server is at different server
$client = new SoapClient(SITE_ROOT . "locally hosted wsdl",
                         array("trace" => 1, "exception" => 1));

生成的错误为:

ERRNO: 2 'nTEXT: SoapClient::__doRequest() [<a href='soapclient.--dorequest'>soapclient.--dorequest</a>]: SSL: connection timeout 'nLOCATION:

因此,这些错误只发生在生产中,占总请求的2-3%。

此外,这是一个基于HTTPS的PHP SOAP Web服务,托管Web服务的服务器也有防火墙,但我们所有的前端服务器都可以通过防火墙访问。

此外,default_socket_timeout被设置为60秒,并且最大执行时间为30秒。

我的问题:

我想知道为什么会发生这种事。

试试这个:

    $client=new SoapClient(
        SITE_ROOT."your/wsdl.here.wsdl",
        array(
            "exceptions" => true, 
            "connection_timeout" => 60,
            "style" => SOAP_RPC, 
            "use" => SOAP_ENCODED, 
        )
    );
    $mxResponse=$client->__soapCall(
        "someFunctionName", 
        array("params", "here")
    );