예제 #1
0
 public function testSkipsSystemCallWhenDirected()
 {
     $httpAdapter = $this->httpAdapter;
     $response = $this->makeHttpResponseFor('foo');
     $httpAdapter->setResponse($response);
     $this->xmlrpcClient->setSkipSystemLookup(true);
     $this->assertSame('foo', $this->xmlrpcClient->call('test.method'));
 }
 /**
  * @param string     $username
  * @param string     $password
  * @param string     $hostname
  * @param int        $port
  * @param null|mixed $logger
  */
 public function __construct($username, $password, $hostname = '127.0.0.1', $port = 9001, $logger = null)
 {
     $this->_logger = $logger;
     // Connect to Supervsior XMLRPC server
     // MUST add '/RPC2' to URI!!!
     $xmlRpcClient = new Client("http://{$username}:{$password}@{$hostname}:{$port}/RPC2");
     $xmlRpcClient->setSkipSystemLookup(true);
     $this->_service = $xmlRpcClient->getProxy();
 }
 /**
  * @return Zend_XmlRpc_Client
  */
 public function getClient()
 {
     if (!$this->client) {
         $client = new Client($this->getApiUrl());
         $client->setSkipSystemLookup(true);
         $this->client = SS_Cache::factory('wordpress_posts', 'Class', array('cached_entity' => $client, 'lifetime' => $this->getCacheLifetime()));
     }
     return $this->client;
 }
예제 #4
0
 /**
  * Get XmlRpc Client
  *
  * This method returns an XmlRpc Client for the requested endpoint.
  * If no endpoint is specified or if a client for the requested endpoint is
  * already initialized, the last used client will be returned.
  *
  * @param null|string $path The api endpoint
  *
  * @return XmlRpcClient
  */
 protected function getClient($path = null)
 {
     if ($path === null) {
         return $this->client;
     }
     if ($this->path === $path) {
         return $this->client;
     }
     $this->path = $path;
     $this->client = new XmlRpcClient($this->host . '/' . $path);
     // The introspection done by the Zend XmlRpc client is probably specific
     // to Zend XmlRpc servers. To prevent polution of the Odoo logs with errors
     // resulting from this introspection calls we disable it.
     $this->client->setSkipSystemLookup(true);
     return $this->client;
 }