SoapClient not sending certificate

2019-02-25 10:12发布

问题:

I've been reading all the questions/answers I could find but none have solved my problem..

here's the connection to the same url using cURL and a certificate($pem = absolute path to .pem file) this works

    $ch = curl_init($wsdl); 
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1); 
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1);
    curl_setopt($ch, CURLOPT_SSLCERT, $pem);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
    $response = curl_exec($ch);

End here is the code I tried to connect to the wsdl through SOAP

$client  = new SoapClient($wsdl, array('local_cert' => $pem));

Even tried loading the contents of the certificate in 'local_cert'

$client  = new SoapClient($wsdl, array('local_cert' => file_get_contents($pem)));

In both lines of soap code I get an error from the server saying that I'm not authorised...

do I need to enable something before the certificate is being sent?

回答1:

There might be some username and password which you need to pass, try this:

curl –k –u user:password –d @myRequestFile.xml uri


标签: php soap ssl curl