c# call yii webservice


recently I follow yii guide to create a webservice, code like below:

public function actions()


		return array(





                    'Post'=>'Post',  // or simply 'Post'





public function login($userName,$password)



		$criteria=new CDbCriteria;



		$criteria->params=array($username);//userType:1 means admin role



			return false;		

		else if(!$user->validatePassword($password))

			return false;



			return true;



I run PHP test script , the webservice can be called and executed.

Then I create c# winform by using visual studio 2010 and .net2.0 and use the add web reference to add the webservice.

AccessServiceControllerService service = new AccessServiceControllerService();

bool ret = service.login(identity.userName,identity.password);

but the code always throws the exception "Client found response content type of ‘text/xml’, but expected ‘text/xml’.

The request failed with an empty response."

I use fiddle to track, found the httpresponse code is 200.

Does anyone can help me? Or please provides your code to reference.

thanks in advance


Nobody meet the same problems?

I did not have any similar experience… but as you are getting the message "… empty response"… could be that "return false" is interpreted as empty…

Try first with some values… try to echo some text and check if c# is getting that…

Hi Mdomba

I have tried that, return 1 or -1 ,but still get same error message. anyway, thanks a lot for your reply.