SoapClient not sending certificate

元气小坏坏 提交于 2020-01-11 09:41:51

问题


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


来源:https://stackoverflow.com/questions/11187646/soapclient-not-sending-certificate

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!