简体   繁体   中英

SOAP: Invalid HTTPS client certificate path

When I run the below-given code, the error ERROR: Invalid HTTPS client certificate path is generated. I checked that the path to certificate.pem and test.wsdl is correct. What might be the reason of such error?

$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());
}

The value for the option local_cert must be a file path instead of an URL. Change the code to this for $options :

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

Since the documentation for Zend_Soap_Client isn't complete, you can look at PHP: SOAP - Manual for more information, because this what Zend_Soap_Client uses under the hood. In my opinion the possible arguments are better described at PHP: SoapClient::SoapClient - Manual (especially look at the example).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM