Приглашаем посетить
Спорт (sport.niv.ru)

Consuming a Web Service with PEAR::SOAP

Previous
Table of Contents
Next

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";
  }
?>


Previous
Table of Contents
Next