Note that there are some explanatory texts on larger screens.

plurals
  1. POTrouble executing the Yii web service demo
    text
    copied!<p>I'm fairly new to Yii and am currently trying to use this framework to create some PHP web services. While trying to execute the brief tutorial on web services provided on the Yii web site <a href="http://www.yiiframework.com/doc/guide/1.1/en/topics.webservice#declaring-web-service-action" rel="nofollow">http://www.yiiframework.com/doc/guide/1.1/en/topics.webservice#declaring-web-service-action</a> I ran into some trouble. Namely, I get a "Maximum execution time of 60 seconds exceeded" fatal error when executing the script. My guess is that the getPrice() method actually never gets called. I'd appreciate any suggestions related to why this may be happening. The contents of my index.php file are listed below. (Note that the Yii gramework is properly installed and I'm running PHP 5.3.0 with the php_soap extension).</p> <pre><code>&lt;?php $yii=dirname(__FILE__).'/../yii/framework/yii.php'; defined('YII_DEBUG') or define('YII_DEBUG',true); defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3); require_once($yii); class StockController extends CController{ function __construct(){ parent::__construct($this-&gt;id, $this-&gt;module); } public function actions(){ return array( 'quote'=&gt;array( 'class'=&gt;'CWebServiceAction', ), ); } /** * @param string the symbol of the stock * @return float the stock price * @soap */ public function getPrice($symbol){ $prices=array('IBM'=&gt;100, 'GOOGLE'=&gt;350); return isset($prices[$symbol])?$prices[$symbol]:0; //...return stock price for $symbol } } $client=new SoapClient('http://localhost/SampleWebService/?r=stock/quote'); echo $client-&gt;getPrice('GOOGLE'); ?&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload