31/05/2010, 21:41
|
| | Fecha de Ingreso: marzo-2003
Mensajes: 164
Antigüedad: 21 años, 8 meses Puntos: 0 | |
Consumir web services php nusoap Buen dia.
De antemano gracias por la atencion y/o colaboracion.
tengo el siguiente codigo que consume un web service
require_once('../nusoap/nusoap.php');
$url = 'http://www.webservicex.net/globalweather.asmx?wsdl';
$soapclient = new soapclient($url, TRUE);
$function = 'GetWeather';
$params = array('CityName' => 'medellin','CountryName' => 'colombia');
$result = $soapclient->call($function , $params);
if (!$error = $soapclient->getError())
echo "Resultado: ".print_r ($result);
else
echo "ERROR:".print_r ($error);
pero no me esta funcionando me sale este error
soap:Server: System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Data.SqlClient.SqlException: Procedure or function 'getWeather' expects parameter '@CountryName', which was not supplied. at System.Data.SqlClient.SqlConnection.OnError(SqlExc eption exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnErro r(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndW arning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlCommand.FinishExecuteRead er(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderT ds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader( CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.InternalExecuteNo nQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at WebServicex.GlobalWeather.GetWeather(String CityName, String CountryName) --- End of inner exception stack trace ---ERROR:1
Probe con soapUI y este funciona perfecto,
Este codigo fue basado en este:
require_once('../nusoap/nusoap.php');
$url = 'http://dev.deepinphp.com/ejemplos/webservices/server.php?wsdl';
$soapclient = new soapclient($url, TRUE);
$function = 'hola';
$params = array('nombre' => 'Pepe');
$result = $soapclient->call($function , $params);
if (!$error = $soapclient->getError())
echo "Resultado: ".$result;
else
echo "ERROR:".$error;
Les agradeceria cualquier colaboracion que me guie al respecto. |