I am having problems getting nusoap to work. I am running Apache 2 and php5, and I downloaded nusoap.php. The webserver dir is /var/www/html, and I put nusoap in /var/www/html/nusoap/lib.
I created a simple client and server (from a book), but unfortunately it didn't work so I assume my setup is wrong.
This is the client script:
<?php
echo 'start';
require('nusoap.php');
echo 'after nusoap';
//Create the variable for the string we would like to send
$myString = 'teststring';
//Create the array that will hold the variable
$parameters = array($myString);
//Instantiate soapclient object
$ = new soapclient('http://192.168.1.3:9990/echoStringServer.php');
//Call the echoString object
$result = $s->call('echoString', $parameters);
//Check if there is an error
if(!$err = $s->getError()){
echo 'Result: '.$result;
}else{
echo 'Error:'.$err;
}
//Debugging
echo '<xmp>'.$s->$request.'</xmp>';
echo '<xmp>'.$s->response.'</xmp>';
?>
This is the server script:
<?php
require('nusoap.php');
//Instantiate the server
$s = new soap_server;
//Register the service
$s->register('echoString');
//Define the function
function echoString($inputString){
if(is_string($inputString)){
return $inputString;
} else {
return new soap_fault('Client','','The parameter to this service must be a string.')
}
}
//Post the response
$s->service($HTTP_RAW_POST_DATA);
?>
Apache is using running on port 9990, and I can run other scripts so I know apache/php is working.
When I enter this is a browser:
http://192.168.1.3:9990/echoStringClient.php
nothing comes back. If I comment the code after the 'require' statement, I don't see the print statement after that statement, so it looks like the problem is with the require statement. I made nusoap.php executable so I don't think it's a permission issue.
Does anyone know what I am doing wrong?
Thanks