SOAP:无效的HTTPS客户端证书路径

时间:2012-07-21 19:44:19

标签: php zend-framework soap https

当我运行下面给出的代码时,会生成错误ERROR: Invalid HTTPS client certificate path。我检查了certificate.pem和test.wsdl的路径是否正确。这种错误可能是什么原因?

$wsdl = 'http://localhost:10088/test/test.wsdl';

$options = array(
    'local_cert' => 'http://localhost:10088/test/certificate.pem',
    'soap_version' => SOAP_1_1
);


try {
    $client = new Zend_Soap_Client($wsdl, $options);
    $result = $client->getLastResponse();
    print_r($result);
} catch (SoapFault $s) {
    die('ERROR: [' . $s->faultcode . '] ' . $s->faultstring);
} catch (Exception $e) {
    die('ERROR: ' . $e->getMessage());
}

1 个答案:

答案 0 :(得分:0)

选项local_cert的值必须是文件路径而不是URL。将代码更改为$options

$options = array(
    'local_cert' => '/path_where_cert_is_stored/certificate.pem',
    'soap_version' => SOAP_1_1
);

由于Zend_Soap_Client的文档不完整,您可以查看PHP: SOAP - Manual以获取更多信息,因为这是Zend_Soap_Client在幕后使用的内容。在我看来,PHP: SoapClient::SoapClient - Manual更好地描述了可能的论点(特别是看这个例子)。