访问Yii生成的WSDL时出现XML解析错误


XML Parsing error when accessing Yii generated WSDL

我试图用yii创建一个简单的示例web服务。我遵循了这些指示,但是当我试图访问WSDL以查看生成的内容时,出现了一个错误。通过http://localhost/mywebapp/index.php/L1Folio/folio

访问WSDL

错误:

XML Parsing Error: junk after document element
Location: http://localhost/paperless_admin/index.php/L1Folio/folio
Line Number 4, Column 1:
<table class="yiiLog" width="100%" cellpadding="2" style="border-spacing:1px;font:11px Verdana, Arial, Helvetica, sans-serif;background:#EEEEEE;color:#666666;">
^

代码:

L1FolioController.php:

<?php
class L1FolioController extends CController
{
    public function actions()
    {
        return array(
            'folio'=>array(
                'class'=>'CWebServiceAction',
            ),
        );
    }
    /**
     * @param  string the folio
     * @return string the statement
     * @soap
     */
    public function sendFolio($folio)
    {
      return 'it works';
    }
}

谢谢你的帮助

找到答案了。日志记录选项与WSDL XML冲突。您的main.php配置应该在日志部分如下所示:

'log'=>array(
                        'class'=>'CLogRouter',
                        'routes'=>array(
                                array(
                                        'class'=>'CFileLogRoute',
                                        'levels'=>'error, warning',                                        
                                ),
                                // uncomment the following to show log messages on web pages                            
                                /*array(
                                        'class'=>'CWebLogRoute',
                                ),*/
                        ),
                ),