コード例 #1
0
ファイル: XmlrpcCall.php プロジェクト: bazitov/kueueingbundle
 /**
  * @todo add support for options to be set to the xmlrpc client
  * @todo on the other hand, the list of allowed xmlrpc server with options might be stored in settings, just like ggwebservices does...
  *
  * @param array $body
  * @return mixed
  * @throws \UnexpectedValueException
  */
 public function consume($body)
 {
     // validate members in $body
     if (!is_array($body) || empty($body['server']) || empty($body['method']) || isset($body['arguments']) && !is_array($body['arguments'])) {
         throw new \UnexpectedValueException("Message format unsupported. Received: " . json_encode($body));
     }
     $label = trim(ConsumerCommand::getLabel());
     if ($label != '') {
         $label = " '{$label}'";
     }
     if ($this->logger) {
         $this->logger->debug("XMLRPC call will be executed from MessageConsumer{$label}: " . $body['method'] . " on server: " . $body['server']);
     }
     $encoder = new XE();
     $args = array();
     foreach ($body['arguments'] as $val) {
         $args[] = $encoder->encode($val);
     }
     $client = new XC($body['server']);
     $response = $client->send(new XR($body['method'], $args));
     if ($response->faultCode() != 0 && $this->logger) {
         $this->logger->error("XMLRPC call executed from MessageConsumer{$label} failed. Retcode: " . $response->faultCode() . ", Error message: '" . $response->faultString() . "'", array());
     }
     return $response->faultCode() == 0 ? $encoder->decode($response->value()) : null;
 }
コード例 #2
0
     $c = new Client($args['URI'], $server[0], $server[1]);
 } else {
     $srv = $args['LOCALSERVER'] . $args['URI'];
     $c = new Client($args['URI'], $args['LOCALSERVER']);
 }
 // do not interfere with http compression
 $c->accepted_compression = array();
 //$c->debug=true;
 $testName = "Repeated send (small array) to {$srv}";
 if (function_exists('gzinflate')) {
     $c->accepted_compression = null;
 }
 begin_test($testName, 'http 10');
 $response = array();
 for ($i = 0; $i < 25; $i++) {
     $resp = $c->send($req);
     $response[] = $resp->value();
 }
 end_test($testName, 'http 10', $response);
 if (function_exists('curl_init')) {
     begin_test($testName, 'http 11 w. keep-alive');
     $response = array();
     for ($i = 0; $i < 25; $i++) {
         $resp = $c->send($req, 10, 'http11');
         $response[] = $resp->value();
     }
     end_test($testName, 'http 11 w. keep-alive', $response);
     $c->keepalive = false;
     begin_test($testName, 'http 11');
     $response = array();
     for ($i = 0; $i < 25; $i++) {
コード例 #3
0
ファイル: OpenERPLib.php プロジェクト: hendri30/OpenPrint
 public function workflow($model, $method, $record_id)
 {
     $client = new Client($this->server . "object");
     $client->setSSLVerifyPeer(0);
     $client->return_type = 'phpvals';
     $msg = new Request('exec_workflow');
     $msg->addParam(new Value($this->database, "string"));
     //* database name */
     $msg->addParam(new Value($this->uid, "int"));
     /* useid */
     $msg->addParam(new Value($this->password, "string"));
     /** password */
     $msg->addParam(new Value($model, "string"));
     /** model name where operation will held * */
     $msg->addParam(new Value($method, "string"));
     /** method which u like to execute */
     $msg->addParam(new Value($record_id, "int"));
     /** parameters of the methods with values....  */
     $resp = $client->send($msg);
     if ($resp->faultCode()) {
         return -1;
     } else {
         return $resp->value();
     }
     /* return new generated id of record */
 }
コード例 #4
0
ファイル: Evatr.php プロジェクト: codedge/laravel-bzst-evatr
 /**
  * Send the XML RPC query.
  */
 public function query()
 {
     $this->response = $this->client->send(new Request('evatrRPC', [new Value($this->ownUstId), new Value($this->foreignUstId), new Value($this->companyName), new Value($this->city), new Value($this->zipCode), new Value($this->street), new Value($this->_setPrintConfirmationOption($this->printConfirmation))]));
     $this->_processResponse();
 }