Webservice, Url Rewrite Problem

Hi,

i’ve successfully implemented simple webservice, based on this link:

yiiframework.ru/doc/guide/en/topics.webservice.

It works fine!

However, i use config/main.php in order to have nice urls:


'urlManager'=>array(

			'urlFormat'=>'path',

                              'showScriptName'=>false,

                        //    'urlSuffix'=>'.html',

			'rules'=>array(

                                       

				'<controller:\w+>/<id:\d+>'=>'<controller>/view',

				'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',

				'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',

And the problem is, that after this “url configuration” my webservice stops working :(

When i use client, like this:


 $client  = new SoapClient('path/contoler/quote', array('trace' => 1));

 echo $client->getPrice('GOOGLE');

it doesn’t work. i’ve got Maximum execution time error.

I’ tried use ‘serviceUrl’=>‘myurl’, but a few possibilities doesn’t make it works.

Can anybody help me a little bit?

Thanks in advance…

Does it work using just path format, but without any of the rules?

it does work with this url: /index.php?r=wstest1/quote

but in other application, when i use url rewriting - it does not - wsdl is ok, but invoking method - not…

Does it work using path format though? In your case, that would be /wstest1/quote

If not, then it would suggest a problem with your .htaccess file, assuming you’re using apache.

Yes, i’m using Apache, and my htaacess:


Options +FollowSymLinks

IndexIgnore */*

RewriteEngine on

# if a directory or a file exists, use it directly

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

# otherwise forward it to index.php

RewriteRule . index.php

I belive that is the case with this line of wsdl:


<soap:address location="server/path/wstest1/quote?ws=1"/>

but what… i dont’t know yet

hi here is my code tested it 100% working with exactly same environment as your’s

NOTE:

Just make sure you have mod_rewrite enabled.

thanks,

i’ll test your code.

Could You please paste your /config/main.php file (mainly url rewrite part).


<?php


// uncomment the following to define a path alias

// Yii::setPathOfAlias('local','path/to/local-folder');


// This is the main Web application configuration. Any writable

// CWebApplication properties can be configured here.

return array(

	'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',

	'name'=>'My Web Application',


	// preloading 'log' component

	'preload'=>array('log'),


	// autoloading model and component classes

	'import'=>array(

		'application.models.*',

		'application.components.*',

	),


	'modules'=>array(

		// uncomment the following to enable the Gii tool

		'gii'=>array(

			'class'=>'system.gii.GiiModule',

			'password'=>'123',

			// If removed, Gii defaults to localhost only. Edit carefully to taste.

			'ipFilters'=>array('127.0.0.1','::1'),

		),

	),


	// application components

	'components'=>array(

		'user'=>array(

			// enable cookie-based authentication

			'allowAutoLogin'=>true,

		),

		// uncomment the following to enable URLs in path-format


		'urlManager'=>array(

			'urlFormat'=>'path',

      'showScriptName'=>false,

			'rules'=>array(

      			'stock/quote'=>'stock/qoute',

				'<controller:\w+>/<id:\d+>'=>'<controller>/view',

				'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',

				'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',

			),

		),

/*

		'db'=>array(

			'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db',

		),

		// uncomment the following to use a MySQL database

		*/

		'db'=>array(

			'connectionString' => 'mysql:host=localhost;dbname=test',

			'emulatePrepare' => true,

			'username' => 'root',

			'password' => 'root',

			'charset' => 'utf8',

		),

		

		'errorHandler'=>array(

			// use 'site/error' action to display errors

			'errorAction'=>'site/error',

		),

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

				),

				*/

			),

		),

	),


	// application-level parameters that can be accessed

	// using Yii::app()->params['paramName']

	'params'=>array(

		// this is used in contact page

		'adminEmail'=>'webmaster@example.com',

	),

);