Example #1
0
 /**
  * @param OX_M2M_XmlRpcExecutor $serviceExecutor
  * @param OX_M2M_M2MTicketProvider $m2mTicketProvider
  */
 function __construct(&$serviceExecutor, &$m2mTicketProvider = null)
 {
     if ($m2mTicketProvider == null) {
         $m2mTicketProvider = new OA_Central_M2MTicketProviderImpl();
     }
     parent::__construct($serviceExecutor, $m2mTicketProvider);
     $this->setAccountIdAndType(0, OA_ACCOUNT_ADMIN);
 }
Example #2
0
 function call($methodName, $params = null)
 {
     try {
         OX_M2M_M2MProtectedRpc::dumpCall($this->serviceExecutor, $methodName, $params);
         $fullParams = $this->addCredentials($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->m2mTicketProvider->getTicket(true);
             return $this->call($methodName, $params);
         }
         throw $e;
     }
 }
Example #3
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);
     }
 }