Joined: 09 Jun 2007 |
Posts: 4 |
|
|
|
Posted: Fri Jun 08, 2007 12:39 pm |
|
|
|
|
|
HI all,
I am a newbie to Nusoap and cannot even get the bog standard 'Hello world' program to work !
Here is the server source ...
<?php
// Pull in the NuSOAP code
require_once('nusoap.php');
// Create the server instance
$server = new soap_server;
// Register the method to expose
$server->register(
'hello', // method name
array('name' => 'xsd:string'), // input parameters
array('return' => 'xsd:string'), // output parameters
'uri:helloworld', // namespace
'uri:helloworld/hello', // SOAPAction
'rpc', // style
'encoded' // use
);
// Define the method as a PHP function
function hello($name)
{
return 'Hello, ' . $name;
}
// 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);
?>
and here is the client ...
<?php
// Pull in the NuSOAP code
require_once('nusoap.php');
// Create the client instance
$client = new soapclient('http://localhost/WS/HelloWorld.php');
// Call the SOAP method
$result = $client->call('hello', array('name' => 'DAD'));
// Display the result
print_r($result);
?>
THe output is as follows ...
Array ( [faultcode] => Client [faultactor] => [faultstring] => error in msg parsing: xml was empty, didn't parse! [detail] => )
What is the problem ?
regards,
Steven M
|
|