This section provides a tutorial example on how to use the SOAP extension to call a Web service provided by xmethods.org to get the current temperature.
To show you an example of how PHP SOAP extension can be used in a SOAP client application, here is my
first SOAP PHP script, Get_Temperature.php
<?php # Get_Temperature.php
# Copyright (c) 2005 by Dr. Herong Yang, http://www.herongyang.com/
#
$client = new SoapClient
("http://www.xmethods.net/sd/2001/DemoTemperatureService.wsdl");
echo("\nReturning value of getTemp() call: ".
$client->getTemp("12345"));
?>
Run it while your connected to the Internet. You will get:
>php Get_Temperature.php
Returning value of getTemp() call: 52
Very nice. This confirms that:
PHP SOAP extension is easy to use. Two statements are enough to call a SOAP service.
You PHP SOAP extension is installed correctly and working.
PHP SOAP extension supports WSDL.
www.xmethods.net is doing a great job for offering this demonstration SOAP service.