Web Services

Is it possible to expose Yii’s control methods as a web service? XML, SOAP etc.


Yes, this chapter of The Definitive Guide to Yii explains how.

Also search the forum for posts about web services. Finally (or perhaps first) have a look at the phone book sample that comes with the framework.



My question is, how does http://hostname/path/to/index.php?r=stock/quote map to the getPrice function of the StockController object?

How does r=stock/quote map to StockController->getPrice($symbol);

It does not make much sense to me and it doesn’t work either.

I added a StockControllers (right were all other controllers are). This simple php client does not do the trick:

$client=new SoapClient(‘http://localhost/yiitest/index.php?r=stock/quote’);

echo $client->getPrice(‘GOOGLE’);

Any thoughts?

I want return a array of web service server and my code is:

public function getValidezClave($argX)



        return serialize($producto);


I call the client, with that:


the out is:

Array ( )