WebService Problem

Hi,

I I’m having a lot of trouble in trying to make the yii stock quote webservice example to work. I have checked and ensured that soap extension is enabled. I am using ubuntu 11 and apache 5.3. The following is an output of the error that I am getting in the browser


This page contains the following errors:


error on line 4 at column 1: Extra content at the end of the document

Below is a rendering of the page up to the first error.

Normaly I expect to get the XML content which is actually the WSDL for the Web service. But I am getting the error above. Kindly help

It would help if you would post your code…


class StockController extends CController {


    public function actions()

    {

        return array(

            'quote'=>array(

                'class'=>'CWebServiceAction',

            ),

        );

    }

    

    /**

     * @param string the symbol of the stock

     * @return float the stock price

     * @soap

     */

    public function getPrice($symbol) {

        $prices = array('IBM' => 100, 'GOOGLE' => 350);

        return isset($prices[$symbol]) ? $prices[$symbol] : 0;

        //...return stock price for $symbol

    }


}

Calling the same url from mozilla gives me the following error:

[sub]XML Parsing Error: junk after document element

Location: http://localhost/authentication/index.php/stock/quote

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

^[/sub]

Hey guys,

Just found what has been causing all the headache. For the web services to run well then ensure that the UI logger is disabled by commenting out its config settings in the protected/config/main.php

The cause of the problem is that the response header specifies that the content type is xml but the logger response is also appended to the response hence the error.

Your log config section in main.php should look something close to this




                        .

                        .

                        .    

                        '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',

				),*/

				

			),

		),

                        .

                        .

                        .    



Time saver - thanks for the tip

Thanks Kevin, I have same problem with you, it save my day :)

Thank you Kevin. I just commented string


//'class'=>'ext.yii-debug-toolbar.YiiDebugToolbarRoute',

But what if I want to use debug-toolbar? How can I use both - WebService and debug-toolbar?