我有以下 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));
服务器管理员为证书连接放置了一个*.crt
文件,但是当我放置它时连接丢失了!
curl_setopt($ch, CURLOPT_SSLCERT, realpath('./mycert.crt'));
或者当我也使用转换后的 *.pem
文件时。
只有在一种情况下,我在使用以下源代码时建立了连接:
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
我收到了这个回复
The given SOAPAction processRequest does not match an operation.
<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认证?
问题出在哪里?
最佳答案
这似乎不是 SSL 错误,因为该消息与 SOAP 相关。
您是否已连接到服务器管理员为 SOAP 服务指定的 URL?
来自服务器的 WSDL 文件中是否有 processRequest?假设服务器正在使用相同的 WSDL 文件运行 SOAP 服务以确保接口(interface)匹配?
您还应该能够使用 curl 命令从基于 Linux 的命令行使用 curl 测试 SSL,这将澄清是否存在任何 SSL 问题:
curl https://_SERVER_URL_:8086/erefill_bl/ETIServiceMerchant?wsdl --verbose --cert ./mycert.crt
关于php - Validation SSL 是否与 soap 直接相关?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32829607/