Hello. I'm new to web services and am struggling with nusoap. I cannot get this code working. I need the webservice receive a parameter but can't make it work. It keeps returning
Array.
Server
require_once("../nusoap/nusoap.php");
$server = new soap_server();
$server->configureWSDL("SB_WSDL","urn:mydomain.com/student.php?wsdl");
$server->wsdl->schemaTargetNamespace = 'urn:SB_WSDL';
$server->register("getstudent",
array("id" => "xsd:int"),
array("return" => "xsd:string"),
"urn:SB_WSDL",
"urn:SB_WSDL#getstudent");
function getstudent($id) {
if($id == 0)
$id = 1;
//query the database and create json
return $myname;
}
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$server->service($HTTP_RAW_POST_DATA); |
Client:
include("nusoap/nusoap.php");
$client = new nusoap_client("https://mydomain.com/student.php?wsdl");
if(isset($_GET['id']))
$id = $_GET['id'];
else
$id = "0";
$param = array("id" => $id);
$result = $client->call('getstudent', $param);
echo "$result";
|
As I've just said, it is always printing
Array. Despite whatever there was on the
getstudent function. In fact, if the function were:
function getstudent($id) {
return "A";
}
|
it keeps answering
Array.
Thanks in advance. Best regards,
Emiliano