Web Service in Nusoap PHP? What am i doing wrong?

Zombie Jhakkaas

New member
Hi All!

I have created a web service with the code

require 'nusoap.php';
include 'SOAP/Server.php';
$namespace="XXXXXXXXXXXXXXXXXXX";
$server = new soap_server();
$server->configureWSDL('appstats',$namespace);
$server->wsdl->schemaTargetNamespace=$namespace;
$server->register('getPageView',array('date1'=>'xsd:string','date2'=>'xsd:string'),array('stats'=>'xsd:string'),$namespace);
function getPageView($date1,$date2){
$date1 = strtotime($date1);
$date2 = strtotime($date2);
$results = "some calculation on dates";
$result = (array)$results;
return new soapval('return','string',$result);
$server->service($HTTP_RAW_POST_DATA);


and trying to consume it with the following client

if (!require 'nusoap.php'){echo "file not found";}
$wsdl="my created wsdl";
if (!$client=new nusoapclient($wsdl, 'wsdl')){echo "Client not formed";}
$date1 = '03/01/2009';
$date2 = '03/23/2009';
$hits= $client->getCanvasPageViews($date1, $date2);
$hits = array($hits);
print_r ($hits);

It is not showing anything. The function when run independently in server wsdl executes fine.
I am using PHP 5.1.4 with both soap server and client functionalities enabled.

Any clues?
 
Back
Top