Inheritance: extends Gpf_Object, implements Gpf_Rpc_Serializable, implements IteratorAggregate
コード例 #1
0
 private function addFiltersParameter()
 {
     $filters = new Gpf_Rpc_Array();
     foreach ($this->filters as $filter) {
         $filters->add($filter);
     }
     return $filters;
 }
コード例 #2
0
 public static function getEncodedCountries()
 {
     $countries = self::createCountries();
     $output = new Gpf_Rpc_Array();
     $output->add(new Gpf_Rpc_Array(array('code', 'name')));
     foreach ($countries as $key => $country) {
         $output->add(new Gpf_Rpc_Array(array($key, $country)));
     }
     return $output;
 }
コード例 #3
0
 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);
     }
 }
コード例 #4
0
ファイル: Rpc.php プロジェクト: AmineCherrai/rostanvo
 /**
  * Executes multi request
  *
  * @service
  * @anonym
  * @return Gpf_Rpc_Serializable
  */
 public function run(Gpf_Rpc_Params $params)
 {
     $requestArray = $params->get(self::REQUESTS);
     if ($requestArray === null) {
         $requestArray = $params->get(self::REQUESTS_SHORT);
     }
     $response = new Gpf_Rpc_Array();
     foreach ($requestArray as $request) {
         $response->add($this->executeRequest(new Gpf_Rpc_Params($request)));
     }
     return $response;
 }
コード例 #5
0
 protected function getFiltersParameter()
 {
     $filters = new Gpf_Rpc_Array();
     foreach ($this->filters as $filter) {
         $filters->add($filter);
     }
     return $filters;
 }