Exemplo n.º 1
0
 /**
  * Method to validate request timers
  * 
  * @param object $request Request Object
  * @return boolean true when the request timing is valid 
  *   string when request timing is not valid with the correct ack
  */
 public static function validate($request)
 {
     //reset the failure for next validation
     self::$failure = FALSE;
     $ret = TRUE;
     $isTimeout = FALSE;
     //we're on check - no timers
     if (!isset($request->last_method_time) && !$request->last_method_time) {
         return TRUE;
     }
     $msg_type = strtolower($request->getHeaderField('MSG_TYPE'));
     self::$last_transaction = $request->last_method;
     self::$last_request_time = $request->last_method_time;
     self::$last_port_time = $request->last_transfer_time;
     self::$port_time = $request->getBodyField("PORT_TIME");
     // current port time
     if (isset(self::$timerMethodArr[$msg_type])) {
         $timer = self::$timerMethodArr[$msg_type];
         //			Application_Model_Agg::insertInvalidProcessByTimer($timer, $request->getHeaderField('MSG_TYPE') , $waiting);
         if ($timer['time'] == "PORT") {
             $input_time = self::$last_port_time;
         } else {
             $input_time = self::$last_request_time;
         }
         if ($timer['lt']) {
             $isTimeout = self::isTimeout($timer['code'], $input_time);
             //true of false
         } else {
             $isTimeout = self::isTimeout($timer['code'], $input_time, null, FALSE);
             //true of false
         }
     }
     // the first timeout should return true or false (no further use for the timer code)
     if ($isTimeout === TRUE) {
         Application_Model_General::writeToTimersActivity($request->getHeaders(), self::$failure);
         if (self::isDebug()) {
             error_log("Timer is not valid: " . $ret);
         }
         return "Gen07";
     }
     $method_name = $msg_type . "Timeout";
     if (in_array($method_name, get_class_methods("Np_Timers"))) {
         self::$method_name();
         if (self::$failure !== FALSE) {
             $ret = ucfirst(strtolower(self::$failure));
             Application_Model_General::writeToTimersActivity($request->getHeaders(), $ret);
             if (self::isDebug()) {
                 error_log("Timer is not valid: " . $ret);
             }
             return $ret;
         }
     }
     return $ret;
 }
Exemplo n.º 2
0
 /**
  * sets ack code in body field using validate params
  * post validation checks for general soap field errors
  * 
  * @return mixed String or BOOL 
  */
 public function PostValidate()
 {
     $this->setAck($this->validateParams($this->getHeaders()));
     //first step is GEN
     if (!$this->checkDirection()) {
         return "Gen04";
     }
     if (!$this->ValidateDB()) {
         return "Gen07";
     }
     if (($timer_ack = Np_Timers::validate($this)) !== TRUE) {
         $timers_array = array('T2DR1', 'T2DR2', 'T3DR1', 'T3RK1', 'T3DR1U', 'T3RK1', 'T3RK2', 'T3DR1D', 'T3RK3', 'T3KR', 'T4DR0', 'T4DR1', 'T4DR11', 'T4DR2', 'T4DR3', 'T4RR1', 'T4RR11', 'T4OR1', 'T4OR11', 'T4RO1', 'TNP', 'TNP1', 'TNP2', 'TNP3', 'TNP4', 'TNPS', 'TNPB', 'T5BA2', 'T5BA3', 'T5AO1', 'T5OR1', 'T5001', 'T5002', 'T5003', 'TACK1', 'TACK2', 'TRES2', 'T5BA2', 'T5BA22', 'PNP1', 'PNP2', 'PNP3', 'PNP4', 'RACK3', 'N2DR4', 'PNP10', 'PNP4', 'RACK3');
         if (in_array($timer_ack, $timers_array)) {
             Application_Model_General::writeToTimersActivity($this->getHeaders(), $timer_ack);
         }
         return $timer_ack;
     }
     return true;
 }