Search code examples
phpxmlweb-serviceswsdlyii

XML Parsing error when accessing Yii generated WSDL


I'm trying to create a simple example web service with yii. I followed these directions, but I'm getting an error when I try to visit the WSDL to view what yii generated. Visiting the WSDL at http://localhost/mywebapp/index.php/L1Folio/folio

Error:

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;">
^

Code:

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';
    }

}

Thanks for the help.


Solution

  • Found the answer. The logging options conflict with the WSDL XML. Your main.php config should look like this in the log section:

    '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',
                                    ),*/
    
                            ),
                    ),