Consuming a Web Service with PEAR::SOAP


After the Web Service is created and does offer WSDL generation, a proxy class is very easy to get, thanks to PEAR::SOAP. Instantiate the SOAP_WSDL class with the WSDL description, call getProxy(), and then use the proxy. This is very short but does quite a lot of SOAP in the background.

Consuming the Web Service with PEAR::SOAP (wsdl-pear-client.php)
 <?php   error_reporting(E_ALL ^ E_NOTICE);   require_once 'SOAP/Client.php';   $soap = new SOAP_WSDL('http://localhost/     wsdl-pear-server.php?wsdl');   $proxy = $soap->getProxy();   $result = $proxy->add(47, 11);   if (PEAR::isError($result)) {     echo $result->getMessage();   } else {     echo "47 + 11 = $result";   } ?> 




PHP Phrasebook
PHP Phrasebook
ISBN: 0672328178
EAN: 2147483647
Year: 2005
Pages: 193

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net