第一步:创建controller
yiic shell index.php
controller xxxxx
编辑xxxxx
加入action方法并且引用'CWebServiceAction':
public function action(){
return array(
'quote'=>array(
'class'=>'CWebServiceAction',
)
);
}
创建web service方法:
/**
* @param string the symbol of the stock
* @return float the stock price
* @soap
*/
public function getPrice($symbol)
{
//...return stock price for $symbol
}
注意,在phpdoc中要以@soap做标示的就是web service的方法,呵呵,有点像.net的[WebMethod]
^_^
创建完成,访问
http://path/index.php/xxxxx/quote
就可以看见wsdl了
yii分析 创建web service
最新推荐文章于 2021-03-17 12:41:33 发布