通过https在php中调用wsdl

时间:2010-06-11 08:56:44

标签: php https wsdl nusoap exchangewebservices

我正在尝试连接到下一个网络服务:

https://grab.beta.agiv.be/Tools/CRABTools.svc?wsdl

我还必须添加一个我已创建的标题元素。

我可以使用PHP soapclientzend_soap_client来调用它吗?或者我必须使用nusoap_client

我试着像:

$soapclient = new nusoap_client($wsdl);
$header = "<o:Security s:mus... ../>"; // including my password and username

$soapclient->call("FindGemeentenResult",
array("houseNumberId" => 2306852),
"https://grab.beta.agiv.be/Tools/CRABTools.svc",
"http://ws.agiv.be/crabtools/ICRABTools/FindGemeentenResult",
$header);

但现在我明白了:

Error: HTTP Error: Unsupported HTTP response status 415 Cannot process the message because the content type 'text/xml; charset=ISO-8859-1' was not the expected type 'text/xml; charset=utf-8'.(soapclient-&gt;响应包含响应的内容)

我对此很新,欢迎任何帮助!

2 个答案:

答案 0 :(得分:7)

在服务器上调用方法之前,需要将SOAP客户端编码设置为utf-8而不是默认的ISO-8859-1

e.g。

$soapclient = new nusoap_client(...);
$soapclient->soap_defencoding = 'UTF-8';
$soapclient->call(...);

答案 1 :(得分:5)

/**
* charset encoding for outgoing messages
*
* @var      string
* @access   public
*/
  var $soap_defencoding = 'UTF-8';
 //var $soap_defencoding = 'ISO-8859-1';