NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Problem when passing integer value


Joined: 05 Nov 2008
Posts: 2
Reply with quote
Hi
i am new baby to nusoap, i had problem when i pass integer to server, server receive null value. i don't know what's wrong with that. Anyone help me

this is my server code
Code:

require_once('../nusoap/lib/nusoap.php');
// Create the server instance
$ns="http://localhost/example/n_soap_server1.php";
$server = new soap_server();
// Initialize WSDL support
$server->configureWSDL('hellowsdl', true);
$server->wsdl->schemaTargetNamespace=$ns;
// Register the method to expose
$server->register('authhello',                // method name
    array('name1' =>'xsd:int',
        'name2'=>'xsd:int'),        // input parameters
    array('return'=>'xsd:int'),      // output parameters
    $ns,                      // namespace
    '',                // soapaction
    'rpc',                                // style
    'enclosed',                            // use
    'Says hello to the caller'            // documentation
);

function authhello($name,$name1) {
        return $name+$name1;
}
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$server->service($HTTP_RAW_POST_DATA);


this is my client code

Code:

require_once("../nusoap/lib/nusoap.php");
// Pull in the NuSOAP code

// Create the client instance

$client = new nusoap_client('http://localhost/example/n_soap_server1.php?wsdl', true);
// 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
}

$result = $client->call('authhello', array('num1'=>10,'num2'=>20));

if ($client->fault) {
      echo '<h2>Fault</h2><pre>';
      print_r($result);
      echo '</pre>';
   } else {
      // Check for errors
      $err = $client->getError();
      if ($err) {
         // Display the error
         echo '<h2>Error</h2><pre>' . $err . '</pre>';
      } else {
         // Display the result
         echo '<h2>Result</h2><pre>';
         print_r($result);
         echo '</pre>';
      }
   }
View user's profileFind all posts by jobsivaSend private message
Problem when passing integer value
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