Hi I am trying to create a web service using hessian but I can't seem to have any luck in implementing even the most basic example.
This is my client
<?php
include_once './Hessian/HessianClient.php';
$testurl = 'http://localhost/HessianPHP/server.php';
$proxy = new HessianClient($testurl);
echo $proxy->div(2,5);
?>
And this is my server code:
<?php
include_once 'Hessian/HessianService.php';
$service = new HessianService(new Math());
$service->handle();
?>
class Math {
function add($n1,$n2) {
return $n1+$n2;
}
function sub($n1,$n2) {
return $n1-$n2;
}
function mul($n1,$n2) {
return $n1*$n2;
}
function div($n1,$n2) {
return $n1/$n2;
}
}
When I run this code I get this error:
Fatal error: Uncaught exception 'HessianFault' with message 'Code not recognized as a top element' in E:\Program Files\xampp\htdocs\HessianPHP\Hessian\Hessian2\Hessian2ServiceParser.php:38 Stack trace: #0 E:\Program Files\xampp\htdocs\HessianPHP\Hessian\HessianClient.php(74): Hessian2ServiceParser->parseTop() #1 E:\Program Files\xampp\htdocs\HessianPHP\Hessian\HessianClient.php(111): HessianClient->_hessianCall('div', Array) #2 E:\Program Files\xampp\htdocs\HessianPHP\client.php(5): HessianClient->_call('div', Array) #3 E:\Program Files\xampp\htdocs\HessianPHP\client.php(5): HessianClient->div(2, 5) #4 {main} thrown in E:\Program Files\xampp\htdocs\HessianPHP\Hessian\Hessian2\Hessian2ServiceParser.php on line 38
What am I doing wrong here?