NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
$client->call is returning an array


Joined: 30 Nov 2017
Posts: 2
Reply with quote
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
Code:
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:
Code:
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:
Code:

function getstudent($id) {
    return "A";
}

it keeps answering Array.

Thanks in advance. Best regards,

Emiliano
View user's profileFind all posts by emiliano.martinSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8328
Reply with quote
check this post
http://forum.nusphere.com/nusoap-sample-s-t55.html

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 30 Nov 2017
Posts: 2
Reply with quote
Hi, dmitri.
I've already solved it with this post: https://stackoverflow.com/questions/33386545/how-to-fix-if-operation-is-not-defined-in-the-wsdl-using-php-nusoap

Thanks, anyway.

Best regards,

Emiliano
View user's profileFind all posts by emiliano.martinSend private message
$client->call is returning an array
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic