Web Service, @param array

I want to send an array to the Web Service provided by Yii, but for some reason it is always seen as a string.

Client:



	$client = new SoapClient('host/service/quote');


	$returned = $client->setOptions(array(


		'var1' => 1


		'var2' => 2


	));


	print_r($returned); //prints array('options' => 'Array')


Server:



	class ServiceController extends CController {


	


		public function actions(){


	        return array(


	            'quote'=>array(


	                'class'=>'CWebServiceAction'


	            ),


	        );


	    }


 


	    /**


	     * @param array


	     * @return array


	     * @soap


	     */


	    public function setOptions($array){


	        return array('options' => $array);


	    }





	}


Sending strings and numbers all works, but when I want to send an Array() or Object, at the server end I only get the word 'Array' or 'Object'…

What am I doing wrong?

Try something like this



  /**


   * @return string[]


   * @soap


   */


...


...


and



<?php


...


...


$data = $client->getItems();


foreach ($data as $n=>$str):


    echo $str.'<br>';


endforeach;


?>


Edit: Remember to turn off WSDL caching.

/Tommy

thanks! that worked.

where can I see if caching is turned on or off?

What does the cache do? I'm assuming it caches per session? So there is no security issue?

When testing I realized that if the existing WSDL is cached, changes won't take effect. I didn't immediately succeed with disabling the caching so I changed wsdl_cache_ttl to a short duration.

php.ini:

Quote

;soap.wsdl_cache_ttl=86400

soap.wsdl_cache_ttl=60

Thx for tip tri, Ive made a cron which periodically deletes WSDL cache under /tmp folder, but your solution is better (and simpler:-)

I done as you and i get

Function ("setOptions") is not a valid method for this service

Why ? ((((