Passing variables from client to server ?

kyanchev.gmail.com's picture
Any idea how to pass some variables from WSClient to WSService ? I want to use WSClient as a local proxy, passing the session Cookie from the browser to WSService on a remote server. Because of the cross-domain limitations the cookie is not readable at the remote server. I need WSClient to send a variable and WSService to be able to read it (and preferably pass it to class constructor). $client = new WSClient(array("wsdl" => getWsdlLocation(), "to" => getToEndpoint(), "classmap" => getClassMap(), //"httpHeaders" => array('mytestHeader' => 12345), //"args" => array('session_id' => @$_COOKIE['session_id']), )); $proxy = $client->getProxy(); $response = $proxy->myFunction($input);
kyanchev.gmail.com's picture

Quick & dirty solution

The only solution I found is to add the variable as GET parameter to "to" endpoint address and extract it from $_SERVER['REQUEST_URI'] server side. This resolves the cross-domain restriction for the cookies and I can pass the session id with every request without modifying the WSDL. "to" => "http://myserver.com/myservice/?session_id_123456" $sid = substr(strstr($_SERVER['REQUEST_URI'], '?'), 1);