通过https在php中调用wsdl

Sam*_*ers 2 php https wsdl nusoap exchangewebservices

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

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);
Run Code Online (Sandbox Code Playgroud)

但现在我得到:

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->响应有响应的内容)

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

小智 7

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

例如

$soapclient = new nusoap_client(...);
$soapclient->soap_defencoding = 'UTF-8';
$soapclient->call(...);
Run Code Online (Sandbox Code Playgroud)


小智 5

/**
* charset encoding for outgoing messages
*
* @var      string
* @access   public
*/
  var $soap_defencoding = 'UTF-8';
 //var $soap_defencoding = 'ISO-8859-1';
Run Code Online (Sandbox Code Playgroud)