como Cosumir Web sevice con php
Publicado por Cosumir Web sevice con php (1 intervención) el 22/09/2015 19:50:30
como Cosumir Web sevice con php
Valora esta pregunta


0
<?php
// recibe parametros por post o por get igual que cualquier pagina php
// segun la informacon que procesa arma el contenido xml, aqui un ejemplo para usar DOM
$Dom = new DOMDocument('1.0', 'UTF-8');
$File = $Dom->createElement('File', '');
$Dom->appendChild($File);
$FileName = $Dom->createElement('FileName','NombreDelArchivo');
$File->appendChild($FileName);
//y responde ese contenido xml
echo $Dom->saveXML();
?>
<header del xml>
<File>
<FileName>
NombreDeArchivo
</FileName>
</File>
<?php
//Create the client object
$soapclient = new SoapClient('http://www.webservicex.net/globalweather.asmx?WSDL');
//Use the functions of the client, the params of the function are in
//the associative array
$params = array('CountryName' => 'Spain', 'CityName' => 'Alicante');
$response = $soapclient->getWeather($params);
var_dump($response);
?>