NuSOAP
| From: | Kanishka | Date: | Thu, 04 Aug 2011 11:31:00 +0000 |
| Subject: | NuSOAP | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-314338@lists.php.net to get a copy of this message | ||
NuSOAP
Hi, I am learning “SOAP web services” using “NuSOAP” I tried to
execute hello world program, but it didn’t work. When I execute the
server script It generate the wsdl without giving any warning or
error. But when I execute the client it gives following message.
********************
” Warning: SoapClient::SoapClient(http://localhost/nusoap/server.php?wsdl)
[soapclient.soapclient]: failed to open stream: A connection attempt
failed because the connected party did not properly respond after a
period of time, or established connection failed because connected
host has failed to respond. in E:\xampp\htdocs\nusoap\client.php on
line 5
Warning: SoapClient::SoapClient() [soapclient.soapclient]: I/O warning
: failed to load external entity
"http://localhost/nusoap/server.php?wsdl"
in
E:\xampp\htdocs\nusoap\client.php on line 5
Fatal error: Maximum execution time of 60 seconds exceeded in
E:\xampp\htdocs\nusoap\client.php on line 10
*************************
.I have attached “client.php” and “server.php”.
server.php
**************
“<?php
// Pull in the NuSOAP code
require_once('lib/nusoap.php');
// Create the server instance
$server = new soap_server();
// Initialize WSDL support
$server->configureWSDL('hellowsdl', 'urn:hellowsdl');
// Register the method to expose
$server->register('hello', // method name
array('name' => 'xsd:string'), // input parameters
array('return' => 'xsd:string'), // output parameters
'urn:hellowsdl', // namespace
'urn:hellowsdl#hello', // soapaction
'rpc', // style
'encoded', // use
'Says hello to the caller' // documentation
);
// 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);
?>
*************”
client.php
*************
<?php
// Pull in the NuSOAP code
require_once('lib/nusoap.php');
// Create the client instance
$client = new soapclient("http://localhost/nusoap/server.php?wsdl");
// Call the SOAP method
$result = $client->call('hello', array('name' => 'Scott'));
// Display the result
print_r($result);
?>
***********
This examples is taken from the
http://www.scottnichol.com/nusoapprogwsdl.htm
can anybody tell me what’s wrong with this code.
Thank you
Attachment: [application/x-httpd-php] client.php
Attachment: [application/x-httpd-php] server.php
Attachment: [application/x-httpd-php] client.php
Attachment: [application/x-httpd-php] server.php