验证SSL是否与肥皂直接相关?

时间:2015-09-28 18:35:21

标签: php ssl soap

我有以下PHP代码与Soap WSDL server来自客户:

进行通信
<?php
$url = "https://_SERVER_URL_:8086/erefill_bl/ETIServiceMerchant?wsdl";
$body = '<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:eref="http://erefill.nokia.com">
<soapenv:Header />
 <soapenv:Body>
.
.
.
.
.

 </eref:processRequest>
 </soapenv:Body>
</soapenv:Envelope>
'; //VAriable
    $headers = array(
        'Content-Type: text/xml; charset="utf-8"', 
        'Content-Length: '.strlen($body), 
        'Accept: text/xml', 
        'Cache-Control: no-cache', 
        'Pragma: no-cache', 
        'SOAPAction: "processRequest"'
    );
    $ch = curl_init(); 
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_URL, $url); 
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
    curl_setopt($ch, CURLOPT_TIMEOUT, 60); 
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36");
    // Stuff I have added
    curl_setopt($ch, CURLOPT_POST, true); 
    curl_setopt($ch, CURLOPT_POSTFIELDS, $body);  
    var_dump(curl_exec($ch));

服务器管理员为证书连接放置了*.crt文件但是当我把它连接丢失时!

curl_setopt($ch, CURLOPT_SSLCERT, realpath('./mycert.crt'));

当我使用转换*.pem文件时。
仅在一种情况下,当我使用以下源代码时我建立了连接:
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
我收到此回复

  

给定的SOAPAction processRequest与操作不匹配。

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>The given SOAPAction processRequest does not match an operation.</faultstring></soap:Fault></soap:Body></soap:Envelope>

现在:
问题是FOR XML代码?

发生此错误是因为SSL认证未使用?
哪个可能是问题?

1 个答案:

答案 0 :(得分:1)

它似乎不是SSL错误,因为该消息与SOAP有关。

您是否已连接到服务器管理员为SOAP服务指定的URL?

来自服务器的WSDL文件中的processRequest?据推测,服务器使用相同的WSDL文件运行SOAP服务以确保接口匹配?

您还应该能够使用curl命令从基于Linux的命令行使用curl测试SSL,这将澄清是否存在任何SSL问题:

curl https://_SERVER_URL_:8086/erefill_bl/ETIServiceMerchant?wsdl --verbose --cert ./mycert.crt