Esempio n. 1
0
 private function processSleep()
 {
     $dom = $this->xmlDom;
     $headerNode = $dom->getElementsByTagName('SIF_Header')->item(0);
     $originalMsgId = $headerNode->getElementsByTagName('SIF_MsgId')->item(0)->nodeValue;
     $originalSourceId = $headerNode->getElementsByTagName('SIF_SourceId')->item(0)->nodeValue;
     //$originalTimestamp  = $headerNode->getElementsByTagName('SIF_Timestamp')->item(0)->nodeValue;
     $validSourceId = Agent::checkSourceId($originalSourceId);
     if (!$validSourceId) {
         RegisterError::invalidSourceId($originalSourceId, $originalMsgId);
     } else {
         $agent = new Agent($originalSourceId);
         if (!$agent->isRegistered()) {
             RegisterError::notRegisteredError($originalSourceId, $originalMsgId);
         } else {
             $agent->putToSleep();
             $timestamp = Utility::createTimestamp();
             $msgId = Utility::createMessageId();
             XmlHelper::buildSuccessMessage($msgId, $timestamp, $originalSourceId, $originalMsgId, 0, $originalMsg = null, $desc = null);
         }
     }
 }