/** * Proxy request from server to GwtPHP server and return list of Gadgets * @service gadget read * @param Gpf_Rpc_Params $params * @return Gpf_Data_RecordSet */ public function getWidgetsList(Gpf_Rpc_Params $params) { $proxyRequest = new Gpf_Rpc_Request('Aw_GadgetLibrary', 'getRows'); $proxyRequest->setUrl('http://addons.qualityunit.com/scripts/server.php'); $proxyRequest->setParams($params); $proxyRequest->sendNow(); return $proxyRequest->getResponseObject(); }
/** * @param $request * @param $groupId * @param $validTo * @return string */ public function __construct(Gpf_Rpc_Request $request, Gpf_DateTime $validTo = null) { parent::__construct(); $json = new Gpf_Rpc_Json(); if ($validTo === null) { $validTo = new Gpf_DateTime(); $validTo->addDay(30); } $this->setAccountId(Gpf_Session::getInstance()->getAuthUser()->getAccountId()); $this->setGroupId(''); $this->setRequest($json->encode($request->toObject())); $this->setValidTo($validTo->toDateTime()); $this->insert(); return $this; }
public function send() { $this->addParam('data', $this->data->getParams()); if (count($this->filters) > 0) { $this->addParam("filters", $this->addFiltersParameter()); } parent::send(); }
public function send() { if (count($this->filters) > 0) { $this->addParam("filters", $this->getFiltersParameter()); } if ($this->sortColumn !== '') { $this->addParam("sort_col", $this->sortColumn); $this->addParam("sort_asc", $this->sortAscending ? 'true' : 'false'); } if ($this->offset !== '') { $this->addParam("offset", $this->offset); } if ($this->limit !== '') { $this->addParam("limit", $this->limit); } parent::send(); }
public function send() { $request = new Gpf_Rpc_Request($this->serverClassName, Gpf_Rpc_Server::RUN_METHOD); if ($this->useNewStyleRequestsEncoding) { $request->addParam(Gpf_Rpc_Server::REQUESTS_SHORT, $this->requests); } else { $request->addParam(Gpf_Rpc_Server::REQUESTS, $this->requests); } if ($this->sessionId != null) { $request->addParam("S", $this->sessionId); } $requestBody = $this->json->encodeResponse($request); $responseText = $this->sendRequest($requestBody); if ($this->debugRequests) { echo "REQUEST: " . $requestBody . "<br/>"; echo "RESPONSE: " . $responseText . "<br/><br/>"; } $responseArray = $this->json->decode($responseText); if (!is_array($responseArray)) { throw new Gpf_Exception("Response decoding failed: not array. Received text: {$responseText}"); } if (count($responseArray) != $this->requests->getCount()) { throw new Gpf_Exception("Response decoding failed: Number of responses is not same as number of requests"); } $exception = false; foreach ($responseArray as $index => $response) { if (is_object($response) && isset($response->e)) { $exception = true; $this->requests->get($index)->setResponseError($response->e); } else { $this->requests->get($index)->setResponse($response); } } if ($exception) { $messages = ''; foreach ($this->requests as $request) { $messages .= $request->getResponseError() . "|"; } } $this->requests = new Gpf_Rpc_Array(); if ($exception) { throw new Gpf_Rpc_ExecutionException($messages); } }
public function send() { $this->addParam('fields', $this->fields->getFields()); parent::send(); }
private function sendRequest(Gpf_Rpc_Request $request, Gpf_Rpc_Params $params) { $request->setUrl('http://addons.qualityunit.com/scripts/server.php'); // $request->setUrl('http://localhost/trunk/AddonsWeb/trunk/server/scripts/server.php'); $params->add('application_code', Gpf_Application::getInstance()->getCode()); $params->add('application_version', Gpf_Application::getInstance()->getVersion()); $request->setParams($params); $request->sendNow(); }