Page 1 of 1

web services in php

Posted: Sat Mar 26, 2011 12:38 am
by away_young
Hi,

i want to start creating and accessing web services using php....i tried searching around the internet....but came up with lots of code which were too
difficult for me....can anyone please tell where can i find a simple tutorial to develop web services using php?

Re: web services in php

Posted: Sat Mar 26, 2011 11:48 am
by califdon
First of all, recognize that web services is not a simple operation, so you won't find a truly "simple" tutorial. But it's true that a lot of information on the web is more complicated than necessary for learning the fundamentals. This one is perhaps as simple as I can find quickly: http://www.ferdychristant.com/blog//art ... OMM-6J2QFF

Re: web services in php

Posted: Mon Mar 28, 2011 10:33 pm
by away_young
Thank you califdon for the reply....i will go through the website....

Re: web services in php

Posted: Tue Mar 29, 2011 12:26 am
by away_young
hi,
i am able to get the web service to work without using WSDL....but when i try to use WSDL..i get a page telling me
'Connection to the server was reset while the page was loading'..i am putting my client as well as my server code here...can anyone tell me what the problem is?
client code

Code: Select all

<?php
require_once('lib/nusoap.php');
$client = new soapclient('http://localhost/WebServices_WSDL/server.php?wsdl', true);
$result = $client->call('hello', array('name' => 'bye'));
print_r($result);

?>
server code

Code: Select all

<?php
require_once('lib/nusoap.php');
$server = new soap_server();
$server->configureWSDL('server', 'urn:server');
$server->register('hello',                
    array('name' => 'xsd:string'),        
    array('return' => 'xsd:string'),     
    'urn:server',                      
    'urn:server#hello',                
    'rpc',                               
    'encoded',                            
    'Says hello '            
);
function hello($name) {
        return 'Hello, ' . $name;
}
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$server->service($HTTP_RAW_POST_DATA);
?>