【问题标题】:SOAP: Invalid HTTPS client certificate pathSOAP:HTTPS 客户端证书路径无效
【发布时间】:2012-07-21 19:44:19
【问题描述】:

当我运行下面给出的代码时,会生成错误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());
}

【问题讨论】:

    标签: php zend-framework soap https


    【解决方案1】:

    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 更好地描述了可能的论点(特别是看示例)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-12-04
      • 1970-01-01
      相关资源
      最近更新 更多