我有一个问题是在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'.
将soap版本更改为1.2:
$client = new SoapClient($url, array('soap_version' => SOAP_1_2));
并且请求无法完成:当我刷新页面时它仍然处于loaging状态 - 任何错误左右 .
=====更新=====
看起来服务使用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