Пример #1
0
 /**
  * The constructor
  *
  * @param string $name
  * @param string $ipAddress The server ip adress
  * @param string $username Default set to null
  * @param string $password Default set to null
  * @param integer $port Default set to null
  */
 public function __construct($name, $ipAddress, $username = null, $password = null, $port = null)
 {
     $this->name = $name;
     $this->rpcClient = new RpcClient('http://' . $ipAddress . ':' . $port . '/RPC2/');
     if ($username !== null && $password !== null) {
         $this->rpcClient->getHttpClient()->setAuth($username, $password, HttpClient::AUTH_BASIC);
     }
     $this->createKey($ipAddress, $username, $password, $port);
 }
Пример #2
0
 protected function setUpConnector()
 {
     $client = new Client('http://127.0.0.1:9001/RPC2');
     $client->getHttpClient()->setAuth('user', '123', HttpClient::AUTH_BASIC);
     $connector = new Zend($client);
     $this->supervisor = new Supervisor($connector);
 }
Пример #3
0
 /**
  * @group ZF-4372
  */
 public function testSettingNoHttpClientUriForcesClientToSetUri()
 {
     $baseUri = 'http://foo:80/';
     $this->httpAdapter = new Adapter\Test();
     $this->httpClient = new Http\Client(null, array('adapter' => $this->httpAdapter));
     $this->xmlrpcClient = new Client($baseUri);
     $this->xmlrpcClient->setHttpClient($this->httpClient);
     $this->setServerResponseTo(array());
     $this->assertNull($this->xmlrpcClient->getHttpClient()->getRequest()->getUriString());
     $this->xmlrpcClient->call('foo');
     $uri = $this->xmlrpcClient->getHttpClient()->getUri();
     $this->assertEquals($baseUri, $uri->toString());
 }
Пример #4
0
 /**
  * Does a query to the RPC host
  *
  * @param string $method
  * @param array $search
  * @return bool|array
  */
 public function doQuery($method, $search)
 {
     try {
         $username = '******';
         $password = '******';
         $RpcClient = new RpcClient('http://172.17.100.201:1337/XMLRPC');
         $httpClient = $RpcClient->getHttpClient();
         $httpClient->setAuth($username, $password);
         $return = $RpcClient->call($method, $search);
     } catch (\Exception $e) {
         $return = false;
     }
     return $return;
 }
Пример #5
0
 /**
  * @return XmlRpcClient
  */
 private function _initConnection()
 {
     return $this->_connection->getHttpClient()->setAuth($this->user, $this->password);
 }
Пример #6
0
 public function testSettingHttpClientViaContructor()
 {
     $xmlrpcClient = new Client('http://foo', $this->httpClient);
     $httpClient = $xmlrpcClient->getHttpClient();
     $this->assertSame($this->httpClient, $httpClient);
 }