Hello
recently I follow yii guide to create a webservice, code like below:
public function actions()
{
return array(
//
'contact'=>array(
'class'=>'CWebServiceAction',
/*'classMap'=>array(
'Post'=>'Post', // or simply 'Post'
),*/
),
);
}
public function login($userName,$password)
{
$username=strtolower($userName);
$criteria=new CDbCriteria;
$criteria->select='*';
$criteria->condition='LOWER(userName)=?';
$criteria->params=array($username);//userType:1 means admin role
$user=User::model()->find($criteria);
if($user==null)
return false;
else if(!$user->validatePassword($password))
return false;
else
{
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
Tim