Php 验证SSL是否与soap直接相关?
我有以下Php 验证SSL是否与soap直接相关?,php,ssl,soap,Php,Ssl,Soap,我有以下PHP代码与来自客户端的Soap WSDL服务器进行通信: <?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/" xmln
PHP
代码与来自客户端的Soap WSDL服务器进行通信:
<?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));
或者当我也使用转换的*.pem
文件时。
只有在一种情况下,我使用以下源代码建立了连接:
curl\u setopt($ch,CURLOPT\u SSL\u VERIFYPEER,false)代码>
我收到了这个回复
给定的SOAPAction processRequest与操作不匹配
soap:server给定的SOAPAction processRequest与操作不匹配。
现在:
问题在于XML代码?
或
发生此错误是因为SSL证书未使用?
问题出在哪里?这似乎不是SSL错误,因为消息与SOAP有关
您是否连接到服务器管理员为SOAP服务指定的URL
processRequest是否在来自服务器的WSDL文件中?假定服务器正在运行一个SOAP服务,使用相同的WSDL文件来确保接口匹配
您还应该能够从基于Linux的命令行使用curl命令测试SSL,这将澄清是否存在任何SSL问题:
curl https://_SERVER_URL_:8086/erefill_bl/ETIServiceMerchant?wsdl --verbose --cert ./mycert.crt
即将连接()到92.42.***8086端口(#0)*正在尝试92.42.***。。。已连接*已连接到92.42.***(92.42.****)端口8086(#0)*正在使用certpath:sql:/etc/pki/nssdb*CAfile:/etc/pki/tls/certs/ca-bundle初始化NSS。crt CApath:无*无法加载客户端密钥-8178.*NSS错误-8178*正在关闭连接#0 curl:(58)无法加载客户端密钥-8178代码>这是Curl响应您的crt文件是否同时包含证书和密钥?它应该有两行代码,如“----开始私钥------”和“----开始证书------”否!我只有一个.crt
文件,管理服务器不支持;(好的,我们不知道您的服务器要求。要将客户端证书与CURLOPT_SSLCERT一起使用,您还需要一个显然您没有的密钥。也许值得向服务器管理员澄清,为什么他们给您一个没有密钥的证书文件。例如,它也可能是CA证书,这意味着您不需要设置CURLOPT_SSL_VERIFYPEER为false。考虑一下,它很可能是CA证书。尝试替换CURLOPT_SSLCERT,realpath('./mycert.crt')
。使用CURLOPT_CAINFO,realpath('./mycert.crt')
并将CURLOPT_SSL_VERIFYPEER设置为true。我不确定XML是否可以工作,但连接也不应该丢失。
<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>
curl https://_SERVER_URL_:8086/erefill_bl/ETIServiceMerchant?wsdl --verbose --cert ./mycert.crt