42 private $_clients = array();
43 private $_users = array();
51 public function doCall($serverKey, $request) {
52 $client = $this->getClient($serverKey);
54 $response = $client->call($request);
65 private function getClient($serverKey) {
66 if (!isset($this->_clients[$serverKey])) {
68 $serverDef = $config->getValue($serverKey,
'remoteserver');
70 $user = $this->getRemoteUser($serverKey);
73 if (strpos($serverDef,
'http://') === 0 || strpos($serverDef,
'https://') === 0) {
77 $client =
new RPCClient($serverDef, $user);
79 $this->_clients[$serverKey] = $client;
81 return $this->_clients[$serverKey];
89 private function getRemoteUser($serverKey) {
90 if (!isset($this->_users[$serverKey])) {
92 $remoteUser = $config->getValue($serverKey,
'remoteuser');
93 if (is_array($remoteUser) &&
sizeof($remoteUser) == 2) {
94 $this->_users[$serverKey] = array(
95 'login' => $remoteUser[0],
96 'password' => $remoteUser[1]
100 throw new IllegialConfigurationException(
101 "Remote user definition of '".$serverKey.
102 "' must be an array of login and password."
106 return $this->_users[$serverKey];
static getInstance($name, $dynamicConfiguration=array())
RemotingServer is used to communicate with other wCMF instances.
Service related interfaces and classes.
HTTPClient is used to do calls to other wCMF instances over HTTP.
doCall($serverKey, $request)
Send a request to the server identified by serverKey.