Error:Client-looks like we got no XML document:; WebService PHP
Hi!
I am trying to do a webservice using the native library and theses are my examples
This is the server that listen request
<?php
// Incluir la Clase
require_once('Calculadora.php');
// Crear servidor de Soap
$server = new SoapServer(
null, // No use WSDL
array('uri' => 'urn:webservices') // Se debe especificar el URI
);
// Asignar la Clase
$server->setClass('Calculadora');
// Atender los llamados al webservice
$server->handle();
?>
This is the Calculadora class. Just is for examples
<?php
// Clase que implementa los servicios
class Calculadora
{
// Metodo a utilizar como servicio
public function sumar($x, $y)
{
return $x + $y;
}
}
This is the cllient that try to use the webservice
<?php
$client = new SoapClient(null,
array(
'location' => 'http://localhost/ws/ser.php',
'uri' => 'urn:webservices',
));
try
{
echo $client->sumar(13,4);
}
catch (SoapFault $fault) {
var_dump($client->__getLastResponse());
var_dump($client->__getLastRequest());
die("Sorry, the service returned the following ERROR::: ".$fault->faultcode."-".$fault->faultstring.".");
}
?>
When I run the client #>php cliente.php I get this::
NULL
NULL
Sorry, the service returned the following ERROR:::
Client-looks like we got no XML document
I am using APache2 and PHP5 in debian6 with php-soap installed. In other server it runs fine. My other server is for testing not production.
Any cluees?
Edwin Quijada
|