Joined: 05 Nov 2008 |
Posts: 2 |
|
|
|
Posted: Tue Nov 04, 2008 1:56 am |
|
|
|
|
|
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
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
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>';
}
}
|
|
|