我在php中与SOAP服务进行通信时遇到问题: 我的客户代码:
$url = "https://XXXX.com/DataService.svc?singleWsdl";
$client = new SoapClient($url);
var_dump($client->__getFunctions()); // ExportScheduleData(ExportScheduleData $parameters)
$aclient->ExportScheduleData(array());
我得到了:
Uncaught SoapFault exception: [HTTP] Cannot process the message because the content type 'text/xml; charset=utf-8' was not the expected type 'application/soap+xml; charset=utf-8'.
将肥皂版本更改为1.2:
$client = new SoapClient($url, array('soap_version' => SOAP_1_2));
请求无法完成:当我刷新页面时,它仍处于暂停状态 - 任何错误左右。
===== update =====
看起来服务使用WS-Security。它们提供证书文件,但是:
Warning: SoapClient::SoapClient(): Unable to set local cert chain file `C:\xampp\htdocs\workspace\sandbox.dev\public\sandbox.cer'; Check that your cafile/capath settings include details of your certificate and its issuer in C:\xampp\htdocs\workspace\sandbox.dev\public\sandbox.php on line 34
答案 0 :(得分:0)
解决。 编写用于ws-security检查的Java应用程序,并从php脚本查询java app。我使用的是java tcp服务器。