Web services con PHP

From: Date: Sun, 10 Feb 2008 16:29:52 +0000
Subject: Web services con PHP
Groups: php.general.es 
Request: Send a blank email to general-es+get-62247@lists.php.net to get a copy of this message
Amigos, estoy comenzando a probar webservices con php para lo cual descargue un ejemplo de internet. El servidor funciona bien porque ademas lo pude testear con exito desde un cliente .net pero el cliente da el siguiente error: Fatal error: Uncaught SoapFault exception: [Client] Function ("getError") is not a valid method for this service in C:\xampp\htdocs\www\webservice\ClienteHolaMundo.php:7 Stack trace: #0 [internal function]: SoapClient->__call('getError', Array) #1 C:\xampp\htdocs\www\webservice\ClienteHolaMundo.php(7): SoapClient->getError() #2 {main} thrown in C:\xampp\htdocs\www\webservice\ClienteHolaMundo.php on line 7 Estoy usando PHP5 con apache 2.2 en windows y nusoap 0.7.3 Adjunto los fuentes del servidor y cliente. Desde ya agradezco cualquier ayuda. Un saludo, Raul -- Servidor: HolaMundo.php <?php require_once('lib/nusoap.php'); function HolaMundo ($nombre) { return "Hola ".$nombre; } $server = new soap_server(); $ns="http://localhost/www/webservice/HolaMundo"; $server->configurewsdl('ApplicationServices',$ns); $server->wsdl->schematargetnamespace=$ns; $server->register('HolaMundo', array('nombre' => 'xsd:string'), array('return' => 'xsd:string'), $ns); if (isset($HTTP_RAW_POST_DATA)) { $input = $HTTP_RAW_POST_DATA; } else { $input = implode("\r\n", file('php://input')); } $server->service($input); exit; ?> -- Cliente: ClienteHolaMundo.php <?php ini_set('soap.wsdl_cache_enabled', '0'); require_once('lib/nusoap.php'); $oSoap = new soapclient('http://localhost/www/webservice/HolaMundo.php?wsdl'); $err = $oSoap->getError(); if ($err) { echo '<p><b>Error: ' . $err . '</b></p>'; } $dato = $oSoap->call('HolaMundo',array('nombre' => 'Raul'), 'http://localhost/www/webservice/HolaMundo'); if ($oSoap->fault) { echo "Error al llamar el metodo<br/>".$oSoap->getError(); } else { echo $dato; } ?>

« previous php.general.es (#62247) next »