使用Soapclient连接到Web服务

时间:2017-07-12 08:31:53

标签: php web-services ssl soap-client

我正在尝试使用php中的本地证书连接到Web服务。 Soapclient返回此错误:Warning: SoapClient::SoapClient(): Unable to set local cert chain file ***.p12'; Check that your cafile/capath settings include details of your certificate and its issuer in url on line 226。这个证书没有咖啡馆......我该怎么办?我的代码是这样的:

$wsdl       = 'url';

try {
    $soapClient = new SoapClient($wsdl, array(
        "trace"         => 1, 
        "exceptions"    => false, 
        "endpoint"      => $wsdl,
        "soap_version"  => SOAP_1_1 ,
        "location"      => "url",
        'stream_context' => stream_context_create(array(
            'ssl' => array(
                "verify_peer" => false,
                'verify_peer_name' => false,
                'allow_self_signed' => false,
                'ciphers' => 'DHE-RSA-AES256-SHA:DHE-DSS-AES256-SHA:AES256-SHA',
                'crypto_method' =>  STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT,
                "local_cert"    => '***.p12',
                "passphrase"    => ******,
            )
        )) 
    )
);
    echo "<pre>";
    print_r($soapClient);
    echo "</pre>";
} catch(Exception $e) {
    echo "<pre>";
    print_r($e);
    echo "</pre>";
}

在Java中,有必要使用truststore,但我不知道在php中做同等的事情。

非常感谢任何帮助。提前谢谢。

0 个答案:

没有答案