Wednesday, July 29, 2009

Create PHP Client to Access Web Service

In this article I will assume that you have already create a Calculator Web Service and deployed it on tomcat web server. If not please go and create your sample web service following the article Develop and Debug web services using-Axis, Eclipse and Tomact.


$params->num1 = 1;
$params->num2 = 2;

$client = new SoapClient("http://localhost:8080/CalculatorService/services/Calculator?wsdl");

try {
$reply = $client->getSummation($params);

echo $reply->return;

} catch (SoapFault $exception) {
echo $exception;
}

?>