I am trying to develop webservice in php using ws02 php webservice framework.
I am using this framework along with WAMP server.Here is my sample server code
Code:
<?php
/*** operation add
* @param int $x operand1 <- This is the PHP type
* maps to xs:int <- This is the schema type
* @param int $y operand2 <- This is the PHP type
* maps to xs:int <- This is the schema type
* @return int $result
*/
function add($x, $y)
{
return array("result" => $x + $y);
}
$operations = array("add" => "add");
$opParams = array("add" => "MIXED");
$svr = new WSService(array("operations" => $operations,"opParams" => $opParams,"serviceName" => "Calculator"));
$svr->reply();
?>
client code
Code:
<?php
try {
// create client in WSDL mode
$client = new WSClient(array ("to" =>"http://localhost/calculator.php"));
// get proxy object reference form client
$proxy = $client->getProxy();
$x=5;
$y=3;
$response=$proxy->add($x,$y);
echo $response;
// create input object and set values
} catch (Exception $e) {
// in case of an error, process the fault
if ($e instanceof WSFault) {
printf("Soap Fault: %s\n", $e->Reason);
} else {
printf("Message = %s\n", $e->getMessage());
}
}
?>
Problem is on the client side I get no response at all.Has anybody worked on this before?Can you please kindly help me in figuring out what the problem is?
Thanks in advance
Ratna
Bookmarks