function getTicket($force)
 {
     if ($force) {
         return $this->m2mService->getM2MTicket($this->accountId, $this->accountType);
     }
     $ticket = $this->m2mDataProvider->getM2MTicket($this->accountId);
     return $ticket ? $ticket : $this->getTicket(true);
 }
示例#2
0
 function call_($methodName, $params, $accountId, $accountType, $credentials = null)
 {
     try {
         if ($credentials === null) {
             $credentials = $this->getCredentialsParam($accountId, $accountType);
         }
         OX_M2M_M2MProtectedRpc::dumpCall($this->serviceExecutor, $methodName, $params);
         $fullParams = array_merge(array($credentials), $params);
         $result = $this->serviceExecutor->call($methodName, $fullParams);
         OX_M2M_M2MProtectedRpc::dumpResult($this->serviceExecutor, $methodName, $params, $result);
         return $result;
     } catch (Exception $e) {
         //echo "<BR><BR>" . $e->getTraceAsString() . "<BR><BR>";
         if ($e->getCode() == OX_M2M_XmlRpcErrorCodes::$TICKET_EXPIRED) {
             $this->getM2MTicket($accountId, $accountType);
         } else {
             if ($e->getCode() == OX_M2M_XmlRpcErrorCodes::$PASSWORD_EXPIRED) {
                 $this->reconnectM2M($accountId, $accountType);
             } else {
                 if ($e->getCode() == OX_M2M_XmlRpcErrorCodes::$PASSWORD_INVALID && $accountId != $this->m2mDataProvider->getAdminAccountId()) {
                     //if password invalid try regenerate using admin password
                     $this->connectM2M($accountId, $accountType);
                 } else {
                     throw $e;
                 }
             }
         }
         return $this->call_($methodName, $params, $accountId, $accountType);
     }
 }