SoapClient不发送证书 [英] SoapClient not sending certificate
问题描述
我一直在阅读所有的问题/答案,我可以找到,但没有一个解决了我的问题。
这里是使用cURL和证书($ pem = .pem文件的绝对路径)
此工程
$ 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);
这里是我试图通过SOAP连接到wsdl的代码
$ client = new SoapClient($ wsdl,array('local_cert'=> $ pem));
即使尝试在'local_cert'中加载证书的内容
$ client = new SoapClient($ wsdl,array('local_cert'=> file_get_contents($ pem)))
在两行soap代码中,我从服务器得到一个错误,
div>
您可能需要传送一些使用者名称和密码,请尝试:
curl -k -u user:password -d @ myRequestFile.xml uri
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?
There might be some username and password which you need to pass, try this:
curl –k –u user:password –d @myRequestFile.xml uri
这篇关于SoapClient不发送证书的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!