Re: PHP SOAP - Extreme newbie questions :/

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Based upon your WSDL file, here is the code I would use (at least as a
basic test)

<?php
class stockserver extends SoapClient {

  private static $classmap = array();

  public function stockserver($wsdl =
"http://localhost/soap_tutorial_server.php?wsdl";, $options = array())
{
    foreach(self::$classmap as $key => $value) {
      if(!isset($options['classmap'][$key])) {
        $options['classmap'][$key] = $value;
      }
    }
    parent::__construct($wsdl, $options);
  }

  public function getStockQuote($symbol) {
    return $this->__soapCall('getStockQuote', array($symbol),       array(
            'uri' => 'urn:stockquote',
            'soapaction' => ''
           )
      );
  }
}

// Use the stockserver.
$Stocks = new stockserver();
echo 'The stock price for ABC is ', $Stocks->getStockQuote('ABC'), '.';
?>

Try this as the client.php

It uses PHP's SoapClient to talk to the service described in the WSDL
file. The code (other than the "use" code at the bottom) was generated
using a WSDL2PHP script http://www.urdalen.no/wsdl2php/ - the
sourceforge code isn't perfect - if you need/want it, I can supply my
patches.

I'm working on the server for you too.

-- 
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

-- 
PHP Soap Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Kernel Newbies]     [PHP Database]     [Yosemite]

  Powered by Linux