NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Hello world - not that again !!


Joined: 09 Jun 2007
Posts: 4
Reply with quote
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
View user's profileFind all posts by ksmatthewsSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 7861
Reply with quote
it's because line below
$client = new soapclient('http://localhost/WS/HelloWorld.php');
is just not correct.
Please see samples posted on this forum

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
Hello world - not that again !!
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