php - Yii soap webservice with input parameter -


i need pass special unique key (string) in constructor input of soap webservice made using yii framework. example of tried:

class soapcontroller extends controller { private $uniquekey; public function __construct() {     $this->uniquekey = $_get['uniquekey']; }  public function actions() {         return array(                 'service'=>array(                         'class'=>'cwebserviceaction',                 ),         ); }  /*  * @return string result  * @soap  */ public function actiondemo() {     if(isset($this->uniquekey))         return $this->uniquekey;     else         return 'key not set'; } } 

the wsdl url is: ../index.php/soap/service?uniquekey=sss displays wsdl data in browser. when call demo action method (with visual studio example) 'the request failed http status 404: not found.'

at system.web.services.protocols.soaphttpclientprotocol.readresponse(soapclientmessage message, webresponse response, stream responsestream, boolean asynccall) @ system.web.services.protocols.soaphttpclientprotocol.invoke(string methodname, object[] parameters) ...

the webservice worked before adding '?uniquekey=sss' part.

is there way pass $uniquekey parameter __construct method, or need customize actions() method maybe ? please, appreciate advice.

you can send uniquekey directly $_get parameter function:

index.php?r=soapcontroller/show&uniquekey=the_unique_key

yii controller:

class soapcontroller extends controller {     public function actionshow($uniquekey)     {         //soap connect          $this->render('show',array(             'soap_data'=>$soap_data,         ));     } } 

php soap example:

$options = array(     'exceptions'=>true,     'trace'=>1, );  $client = new soapclient("https://s7sps3apissl.scene7.com/scene7/webservice/ipsapi-2012-02-14.wsdl",$options);  $ns = 'http://www.scene7.com/ipsapi/xsd';  $auth = (object)array(     'ns2:user' => 'xxx',     'ns2:password' => 'xxx' );  $header = new soapheader($ns, "authheader", $auth, false);  $client->__setsoapheaders(array($header));  //get company handle $client->getcompanyinfo(array('companyname' => 'xxx'));  //extract company handle preg_match('~<companyhandle>(.*?)</companyhandle>~s',$client->__getlastresponse(),$companyhandlematch);  echo $companyhandlematch[1]; 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -