Exemple #1
0
 private static function composeJsonRequest(RpcRequest $request)
 {
     $return = array("jsonrpc" => "2.0", "method" => $request->getMethod(), "params" => $request->getParameters());
     $rid = $request->getId();
     if ($rid === true) {
         $id = $return["id"] = $request->getUniqueId();
     } else {
         if (is_scalar($rid)) {
             $id = $return["id"] = $rid;
         } else {
             $id = null;
         }
     }
     return array($return, $id);
 }
Exemple #2
0
 private function encodeSingleCall(RpcRequest $request)
 {
     $this->logger->notice("Performing a single XML call");
     $this->logger->debug("Data dump before encoding", $request->toArray());
     try {
         // encoding
         foreach ($request->getSpecialTypes() as $key => $value) {
             $this->encoder->setValueType($key, $value);
         }
         $encoded_request = $this->encoder->encodeCall($request->getMethod(), $request->getParameters());
     } catch (XmlrpcException $xe) {
         throw $xe;
     }
     $this->logger->debug("Data dump after encoding: " . $encoded_request);
     return $encoded_request;
 }