problems with soap and php

1

I need to call a function in a wsdl , for which I am using __soapCall() but at the time of using it I get the following error:

  


" Fatal error: Uncaught SoapFault exception: [HTTP] Could not connect to host in C: \ xampp \ htdocs \ SOAP \ product.php: 39 Stack trace: # 0 [internal function]: SoapClient-> __ doRequest ('http: //0.0.0.0: ...', 'urn: georeferenc ...', 1, 0) # 1 C: \ xampp \ htdocs \ SOAP \ producto.php (39) : SoapClient-> __ soapCall ('georeferencingC ...', Array) # 2 {main} thrown in C: \ xampp \ htdocs \ SOAP \ product.php on line 39 "

I understand that I can also use __doRequest() but the data that it returns to me is in a complete chain, that is to say all the information united in the same line and without space.

What I have in línea 39 is the following:

$vem = $cliente->__soapCall('georeferenciarCR',array($CodigoPais, $CodigoDepartamento, $CodigoMunicipio , $DireccionNatural , $Latitud , $Longitud));

I know those are the parameters that I have to send because those are the parameters implanted in xml :

<soapenv:Header/>
           < soapenv:Body><br>
              < gis:WSGeorreferenciarCR-RQ><br>
                 < gis:CodigoPais>57</ gis:CodigoPais><br>
                 < gis:CodigoDepartamento>68</ gis:CodigoDepartamento><br>
                 < gis:CodigoMunicipio>68081000</ gis:CodigoMunicipio><br>
                 < gis:DireccionNatural>KR 19 # 65 - 15</ gis:DireccionNatural><br>
                 < !--Optional:--><br>
                 < gis:Latitud></gis:Latitud><br>
                 < !--Optional:--><br>
                 < gis:Longitud></gis:Longitud><br>
                 < gis:UNE_Cobertura_Especial>0</gis:UNE_Cobertura_Especial>

I hope you can help me and thank you in advance!

** CODE **

<?php
ini_set('soap.wsdl_cache_enabled',0);
ini_set('soap.wsdl_cache_ttl',0);
$wsdl = "http://10.00.00.00:8080/site/www/srvs/WSGeorreferenciarCRService?wsdl";
$xml = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:gis="http://www.une.net.co/gis">
           <soapenv:Header/>
           <soapenv:Body>
              <gis:WSGeorreferenciarCR-RQ>
                 <gis:CodigoPais>57</gis:CodigoPais>
                 <gis:CodigoDepartamento>68</gis:CodigoDepartamento>
                 <gis:CodigoMunicipio>68081000</gis:CodigoMunicipio>
                 <gis:DireccionNatural>KR 19 # 65 - 15</gis:DireccionNatural>
                 <!--Optional:-->
                 <gis:Latitud></gis:Latitud>
                 <!--Optional:-->
                 <gis:Longitud></gis:Longitud>
                 <gis:UNE_Cobertura_Especial>0</gis:UNE_Cobertura_Especial>
              </gis:WSGeorreferenciarCR-RQ>
           </soapenv:Body>
        </soapenv:Envelope>';   
$cliente = new SoapClient($wsdl,array('trace' => 1,'soap_version' => SOAP_1_1));
// $returndatos = $cliente->__doRequest($xml, $wsdl, 'urn:georeferenciarCR', null, 0);
// print_r($returndatos);

$parametros = array(
    "CodigoPais" => 57, 
    "CodigoDepartamento" => 68 , 
    "CodigoMunicipio" => 68081000, 
    "DireccionNatural" => "KR 19 # 65 - 15",
    "Latitud" => "",
    "Longitud" => "",
    "UNE_Cobertura_Especial" => 0);

$strResp = $cliente->__soapCall('georeferenciarCR',array($parametros));
var_dump($strResp);?>
    
asked by OriginPnTest 05.04.2017 в 15:09
source

1 answer

0
$cliente= new SoapClient("http://url?wsdl",array('trace' => 1,'soap_version' => SOAP_1_1));
$arreglo=array("CodigoPais"=>"valor1", "CodigoDepartamento"=>"valor2", "CodigoMunicipio"=>"valor3" , "DireccionNatural"=>"valor4" , "Latitud"=>"valor5" , "Longitud"=>"valor6");
$strResp = $cliente->__soapCall('georeferenciarCR',array($arreglo));
var_dump($strResp);
echo "Valor deseado(el nombre esta en el WSDL): \$strResp->conversionRateReturn = ". $strResp->conversionRateReturn. "<br/>";
$x=$strResp->conversionRateReturn;
echo "conversionRateReturn es un ejemplo tienes que ver la respuesta con var_dump e invocar lo que necesitas y guardarlo en una variable x o imprimirlo como necesites";

    
answered by 05.04.2017 в 17:23