Web service con PHP problemas

stsights

New Member
Messages
159
Reaction score
0
Points
0
Saludos.
he estado batallando con algo que no he podido decifrar que podra ser, tengo un mi webservice constrido pero solo con una funcion registrada funciona bien cuando registro otra funcion que contiene los mismos parametros que la primera funcion pero le pongo otro nombre me sale este error
Fatal error: Uncaught SoapFault exception: [Client] Function ("hola") is not a valid method for this service in /home/stsights/public_html/lib2/hellowsdlclient.php:16 Stack trace: #0 [internal function]: SoapClient->__call('hola', Array) #1 /home/stsights/public_html/lib2/hellowsdlclient.php(16): SoapClient->hola('Scott') #2 {main} thrown in /home/stsights/public_html/lib2/hellowsdlclient.php on line 16

y asi siempre ha sido cuando creo otra funcion y la registro o sea practicamente el webservice solo me deja registrar una funcion porque cuando registro otra da ese error.
este es el codigo del web service

<?php
// Pull in the NuSOAP code
include("/home/stsights/public_html/lib/nusoap.php");
// Create the server instance
$server = new soap_server();
// Initialize WSDL support
$server->configureWSDL('hellowsdl', 'urn:hellowsdl');
// Register the method to expose
$server->register('hello', // method name
array('name' => 'xsd:string'), // input parameters
array('return' => 'xsd:string'), // output parameters
'urn:hellowsdl', // namespace
'urn:hellowsdl#hello', // soapaction
'rpc', // style
'encoded', // use
'Says hello to the caller' // documentation
);
// Define the method as a PHP function
function hello($name) {
return 'Hello, ' . $name;
}


//$server->configureWSDL('holawsdl', 'urn:holawsdl');
// Register the method to expose
$server->register('hola', // method name
array('name' => 'xsd:string'), // input parameters
array('return' => 'xsd:string'), // output parameters
'urn:holawsdl', // namespace
'urn:holawsdl#hola', // soapaction
'rpc', // style
'encoded', // use
'Says hello to the caller en espanol' // documentation
);
// Define the method as a PHP function
function hola($name) {
return 'Hello, ' . $name;
}
// Use the request to (try to) invoke the service
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$server->service($HTTP_RAW_POST_DATA);
?>
y la direccion donde esta es http://mensajote.com/lib2/hellowsdl.php?wsdl
ahora donde lo ejecuto este es el codigo

<?php
// Pull in the NuSOAP code
include("/home/stsights/public_html/lib/nusoap.php");
// Create the client instance
$client = new soapclient('http://mensajote.com/lib2/hellowsdl.php?wsdl');
// Check for an error
//$err = $client->getError();
if ($err) {
// Display the error
echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
// At this point, you know the call that follows will fail
}
// Call the SOAP method
$result = $client->hello('Scott');
echo $result;
echo $client->hola('Scott');
// Check for a fault

?> es aqui donde me da el error que puse arriba, alguien le habra pasado lo mismo y sabe que puede ser?? y aqui lo ejecuto http://mensajote.com/lib2/hellowsdlclient.php tengo el nusoap instalado y es la ultima version y tambien he probado con una anterior pero no se que podra ser el error.
gracias de antemano
 
Last edited:

stefano

New Member
Messages
191
Reaction score
1
Points
0
Me parece que es por la línea que tenés comentada, la tendrías que dejar libre.
//$server->configureWSDL('holawsdl', 'urn:holawsdl');
 
Top