Llamar a un WSDL en PHP sobre HTTPS
-
26-09-2019 - |
Pregunta
Estoy tratando de conectarme al próximo servicio web:
https://grab.beta.agiv.be/tools/crabtools.svc?wsdl
También tengo que agregar un elemento de encabezado que ya he creado.
¿Puedo llamarlo solo usando php? soapclient
o zend_soap_client
? O tengo que usar nusoap_client
?
Intento algo como:
$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);
Pero ahora entiendo:
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-> La respuesta tiene contenido de la respuesta)
Soy bastante nuevo en esto, ¡cualquier ayuda sería bienvenida!
Solución
/**
* charset encoding for outgoing messages
*
* @var string
* @access public
*/
var $soap_defencoding = 'UTF-8';
//var $soap_defencoding = 'ISO-8859-1';
Otros consejos
Debe configurar el cliente SOAP codificando utf-8
en lugar del valor predeterminado ISO-8859-1
antes de llamar al método en el servidor.
p.ej
$soapclient = new nusoap_client(...);
$soapclient->soap_defencoding = 'UTF-8';
$soapclient->call(...);