19 require_once(BASE.
"wcmf/lib/util/class.Log.php");
20 require_once(BASE.
"wcmf/lib/presentation/class.Request.php");
21 require_once(BASE.
"wcmf/lib/presentation/class.Response.php");
22 require_once BASE.
'wcmf/3rdparty/zend/Zend/Http/Client.php';
24 set_include_path(get_include_path().PATH_SEPARATOR.BASE.
'wcmf/3rdparty/zend');
45 $this->_client =
new Zend_Http_Client($serverUrl, array(
50 $this->_client->setMethod(Zend_Http_Client::POST);
51 $this->_client->setCookieJar();
73 $cookyJar = $this->_client->getCookieJar();
74 if (!$isLogin &&
sizeof($cookyJar->getAllCookies()) == 0) {
80 $this->_client->resetParameters();
81 $this->_client->setParameterPost(
'controller', $request->getSender());
82 $this->_client->setParameterPost(
'context', $request->getContext());
83 $this->_client->setParameterPost(
'usr_action', $request->getAction());
84 $this->_client->setParameterPost(
'format', $request->getFormat());
85 $this->_client->setParameterPost(
'response_format', $request->getResponseFormat());
86 $this->_client->setParameterPost($request->getData());
88 $httpResponse = $this->_client->request();
90 catch (Exception $ex) {
91 Log::error(
"Error in remote call to ".$url.
":\n".$ex, __FILE__, __LINE__);
102 if (!$response->getValue(
'success'))
104 $errorMsg = $response->getValue(
'errorMsg');
106 if (strpos(
'Authorization failed', $errorMsg) === 0 && !$isLogin) {
109 $url = $this->_client->getUri();
110 Log::error(
"Error in remote call to ".$url.
": ".$errorMsg.
"\n".$response->toString(), __FILE__, __LINE__);
111 throw new Exception(
"Error in remote call: $errorMsg");
130 'login' => $this->_user->getLogin(),
131 'password' => $this->_user->getPassword(),
132 'password_is_encrypted' => true
136 if ($response->getValue(
'success')) {
137 $this->_sessionId = $response->getValue(
'sid');
151 $errorMsg = $response->getValue(
'errorMsg');
152 Log::error(
"Error in remote call to ".$this->_serverBase.
": ".$errorMsg.
"\n".$response->toString(), __FILE__, __LINE__);
error($message, $category)
Request holds the request values that are used as input to Controller instances. It is typically inst...
throwEx($message, $file='', $line='')
ControllerMessages are sent between Controllers and are used to transfer data between them...
static decode($value, $assoc=false)
HTTPClient is used to do calls to other wCMF instances over HTTP.
__construct($serverUrl, $user)
doRemoteCall($request, $isLogin)