Re: [SOAP] PHP SOAP - Extreme newbie questions :/

From: Date: Wed, 31 Mar 2010 15:40:26 +0000
Subject: Re: [SOAP] PHP SOAP - Extreme newbie questions :/
References: 1 2 3  Groups: php.soap 
Request: Send a blank email to php-soap+get-3066@lists.php.net to get a copy of this message
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

« previous php.soap (#3066) next »