I am attempting to make a call to a soapClient.

So far as a test call I have:


	$client=new SoapClient('Link I can't post on my first post XD');      

	echo $client->getConnection('hello');  


and on the other Side I have:


class ConnectionController extends CController


	public function actions()


			return array(








     * @param string 

     * @return string 

     * @soap


    public function getConnection($requeste)


        $responde= "Hi <img src='http://www.yiiframework.com/forum/public/style_emoticons/default/biggrin.gif' class='bbc_emoticon' alt=':D' />";

        return $responde;



as you’d guess this simple returns "Hi :D" and displays it on the page…

What I need to do is make the getConnection function Check if the user is a guest or falls into a certain “role” i have set up or if they don’t, each doing something different.

If statements don’t seem to work, Redirects are also not working…

I’ve not used this before now but have tried all I can think of/find.

if anyone has a way of getting 3 different responses on those 3 requirements I’d really appreciate the help.

Thanks in advance



	if (Yii::app()->user->isGuest)


		$client=new SoapClient('addy');  	

		echo $client->getConnection('Guest'); 




    	if (Yii::app()->user->role == 'user')


        	$client=new SoapClient('addy');  	

        	echo $client->getConnection('User'); 


    	if (Yii::app()->user->role == 'subscriber')


        	$client=new SoapClient('addyt');  	

        	echo $client->getConnection('Subscriber');  


    	if (Yii::app()->user->role == 'admin')


        	$client=new SoapClient('addy  ');  	

        	echo $client->getConnection('Admin');  




works with the result being an array


 public function getConnection($values)


    	$responde=array('Guest'=>"You are a guest ", 'Subscriber'=>"Your subscription",'User'=>"USER!", 'Admin'=>"Hi <img src='http://www.yiiframework.com/forum/public/style_emoticons/default/biggrin.gif' class='bbc_emoticon' alt=':D' />");

    	return isset($responde[$values])?$responde[$values]:"uh oh Billy: 404";


but as I said the call is a test and won’t actually exist like that so none of the work can be on the calling side (ideally)

When you provide a soap service this should be usable for other clients too (C#, Java, Python …).

These clients don’t know anything about Yii::app()->user->role …

So this is much more complex (implementing an app-login, identify the client …).

For cases like your code above I wouldn’t use soap services.

what would you suggest for making the call from a C# application and getting the desired result?

What should the function ‘getConnection’ do?

The example above is only a question-answer game when you call the soap service from C#

Q: getConnection(‘Guest’) A: ‘You are a guest’

Q: getConnection(‘Subscriber’) A: ‘Your subscription’

Q: getConnection(’??’) A: ‘uh oh Billy: 404’

What other result do you expect?

I wanted to perform the check on the controller rather than the requester,

However It turns out I was wrong in an asumption I made and have since resolved this issue

Thanks anyway