protected function encodeRequest($method, $parameters)
 {
     $encoder = new XmlrpcEncoder();
     $data = $encoder->encodeCall($method, $parameters);
     $aes = new Crypt_AES();
     $aes->setKey($this->key);
     return 'comodojo_encrypted_request-' . base64_encode($aes->encrypt($data));
 }
Example #2
0
 protected function encodeRequest($method, $parameters)
 {
     $encoder = new XmlrpcEncoder();
     return $encoder->encodeCall($method, $parameters);
 }
 protected function encodeRequest($data)
 {
     $encoder = new XmlrpcEncoder();
     return $encoder->encodeMulticall($data);
 }
Example #4
0
 /**
  * Can the RPC response
  *
  * @param mixed   $response
  * @param boolean $error
  *
  * @return string
  * @throws \Comodojo\Exception\RpcException
  */
 private function can($response, $error)
 {
     $encoded = null;
     if ($this->protocol == 'xml') {
         $encoder = new XmlrpcEncoder();
         $encoder->setEncoding($this->encoding);
         try {
             $encoded = $error ? $encoder->encodeError($response->getCode(), $response->getMessage()) : $encoder->encodeResponse($response);
         } catch (XmlrpcException $xe) {
             $encoded = $encoder->encodeError(-32500, "Application error");
         }
     } else {
         if (strtolower($this->encoding) != 'utf-8' && !is_null($response)) {
             array_walk_recursive($response, function (&$entry) {
                 if (is_string($entry)) {
                     $entry = mb_convert_encoding($entry, strtoupper($this->encoding), "UTF-8");
                 }
             });
         }
         // json will not return any RpcException; errors (in case) are handled directly by processor
         $encoded = is_null($response) ? null : json_encode($response);
     }
     if ($this->request_is_encrypted) {
         $aes = new Crypt_AES();
         $aes->setKey($this->encrypt);
         $encoded = 'comodojo_encrypted_response-' . base64_encode($aes->encrypt($encoded));
     }
     return $encoded;
 }
Example #5
0
 /**
  * Encodes xmlrpc call into xml string.
  *
  * @param $method
  * @param array $parameters
  *
  * @return string
  *
  * @throws XmlrpcException
  */
 protected function encode($method, array $parameters = [])
 {
     $this->encoder = $this->encoder ?: new XmlrpcEncoder();
     return $this->encoder->encodeCall($method, $parameters);
 }