YII中使用SOAP一定要注意的一些东西

SiteController.php  

 

在Yii框架下使用soap接口的时候,需要注意几个问题::

1 服务器要打开soap功能,在phpinfo里搜soap,如果已经打开了的话有个大标题就是SOAP
2 classMap其实只要是对应的Model就行,比如这里的Members。
3 代码注释里* @return Members[] the members records Members[]也必须和Model名称一致
4 代码注释里* @soap 这个也不能少,不然无法通过soap方式访问,想不到注释里还有这么多文章
5 如果controller里有accessRules的话,得设定访客就可以访问getPredictions()
6 Model里要公开的变量,需要用下面的形式标明:

/**
     * @var integer UID of this record
     * @soap
     */
    public $uid;

7.client端设置ini_set(“soap.wsdl_cache_enabled”, “0″),否则可能由于缓存而得不到接口的新变动.

本文转载自:http://blog.csdn.net/xinqingch/article/details/12704321

原文地址:https://www.cnblogs.com/DaBing0806/p/4747477.html