Ejemplo n.º 1
0
 function inputFilter($data, $context)
 {
     $response = json_decode($data);
     if (!isset($response->result)) {
         $response->result = null;
     }
     if (!isset($response->error)) {
         $response->error = null;
     }
     $stream = new \Hprose\BytesIO();
     $writer = new \Hprose\Writer($stream, true);
     if ($response->error) {
         $stream->write(\Hprose\Tags::TagError);
         $writer->writeString($response->error->message);
     } else {
         $stream->write(\Hprose\Tags::TagResult);
         $writer->serialize($response->result);
     }
     $stream->write(\Hprose\Tags::TagEnd);
     $data = $stream->toString();
     unset($response);
     unset($writer);
     unset($stream);
     return $data;
 }
Ejemplo n.º 2
0
 function inputFilter($data, $context)
 {
     $result = xmlrpc_decode($data, "UTF-8");
     $stream = new \Hprose\BytesIO();
     $writer = new \Hprose\Writer($stream, true);
     if (isset($result['faultString'])) {
         $stream->write(\Hprose\Tags::TagError);
         $writer->writeString($result['faultString']);
     } else {
         $stream->write(\Hprose\Tags::TagResult);
         $writer->serialize($result);
     }
     $stream->write(\Hprose\Tags::TagEnd);
     $data = $stream->toString();
     unset($result);
     unset($writer);
     unset($stream);
     return $data;
 }