Quantcast
Channel: Web services
Viewing all articles
Browse latest Browse all 2361

nusoap ws

$
0
0
by Majda Majda23.  

Hi,
i'm trying to send the value of the current logged in user's id to wsdl using nusoap but it always returns 0!! 
however when i send a random value it works just fine so the problem isn't the code (i presume!).  
Any help is appreciated. A big thanks in advance smile.

SERVER:
<?php// Pull in the NuSOAP coderequire_once('./nusoap/nusoap.php');// Create the server instance$server = new soap_server();// Initialize WSDL support$server->configureWSDL('useridwsdl', 'urn:useridwsdl');// Register the method to expose$server->register('getUserId',                // method name
    array(),        // input parameters
    array('return' => 'xsd:int')
);// Define the method as a PHP functionfunction getUserId() {
require_once("config.php"); return $USER->id; }// 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); ?>


CLIENT:
<?php// Pull in the NuSOAP coderequire_once('./nusoap/nusoap.php');// Create the client instance$client = new soapclient('http://localhost/moodle/useridwsdl.php?wsdl', true);

$result = $client->call('getUserId');
echo $result;

?>


Viewing all articles
Browse latest Browse all 2361

Trending Articles