private function processEvent() { $dom = $this->dom; $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($agent->sourceId, $originalMsgId); } else { $agent = new Agent($originalSourceId); if ($agent->isRegistered()) { $eventObjectNode = $dom->getElementsByTagName('SIF_EventObject')->item(0); $objectName = $eventObjectNode->getAttribute('ObjectName'); $objectAction = $eventObjectNode->getAttribute('Action'); $objectAction = strtolower($objectAction); if (!DataObject::objectExists($objectName)) { ProvisionError::invalidObject($originalSourceId, $originalMsgId, $objectName); exit; } else { $allowed = $this->hasPermission($objectName, $objectAction, $agent->agentId); if ($allowed) { $provider = DataObject::isProvider($objectName, $agent->agentId); if ($provider) { $this->publishEvent($agent->agentId, $objectName, $objectAction, $_SESSION['ZONE_VERSION'], $dom->saveXml($headerNode)); $timestamp = Utility::createTimestamp(); $msgId = Utility::createMessageId(); $sifMessageNode = $dom->getElementsByTagName('SIF_Message')->item(0); XmlHelper::buildSuccessMessage($msgId, $timestamp, $originalSourceId, $originalMsgId, 0, $originalMsg = null, $desc = null); } else { ProvisionError::notProviderError($originalSourceId, $originalMsgId); } } else { switch ($objectAction) { case 'add': ProvisionError::invalidPermissionToPublishAdd($originalSourceId, $originalMsgId, $objectName); break; case 'change': ProvisionError::invalidPermissionToPublishChange($originalSourceId, $originalMsgId, $objectName); break; case 'delete': ProvisionError::invalidPermissionToPublishDelete($originalSourceId, $originalMsgId, $objectName); break; } //switch for error message } //allowed } //object exist } else { RegisterError::notRegisteredError($originalSourceId, $originalMsgId); } //not registered } //valid sourceId }
public function Subscribe($dom) { $this->dom = $dom; $this->processSubscribe(); $this->saveSubscribes(); $timestamp = Utility::createTimestamp(); $msgId = Utility::createMessageId(); $sifMessageNode = $dom->getElementsByTagName('SIF_Message')->item(0); XmlHelper::buildSuccessMessage($msgId, $timestamp, $this->originalSourceId, $this->originalMsgId, 0, $originalMsg = null, $desc = null); }
public function Provide($dom) { $this->dom = $dom; $this->processProvide(); DataObject::saveProvides($this->provideObjects, $this->agent->agentId); $timestamp = Utility::createTimestamp(); $msgId = Utility::createMessageId(); $sifMessageNode = $dom->getElementsByTagName('SIF_Message')->item(0); XmlHelper::buildSuccessMessage($msgId, $timestamp, $this->originalSourceId, $this->originalMsgId, 0, $originalMsg = null, $desc = null); }
private function updateMessageQueue($agent, $originalMsgId, $msgId) { $res = DataObject::updateEvent($agent->agentId, $originalMsgId, $msgId); if ($res == 1) { $timestamp = Utility::createTimestamp(); $msgId_u = Utility::createMessageId(); XmlHelper::buildSuccessMessage($msgId_u, $timestamp, $agent->sourceId, $msgId, 0, $originalMsg = null, $desc = null); } else { GeneralError::EventACKError($this->xml); } }
private function processProvision() { $dom = $this->dom; $headerNode = $dom->getElementsByTagName('SIF_Header')->item(0); $this->originalMsgId = $headerNode->getElementsByTagName('SIF_MsgId')->item(0)->nodeValue; $this->originalSourceId = $headerNode->getElementsByTagName('SIF_SourceId')->item(0)->nodeValue; $this->originalTimestamp = $headerNode->getElementsByTagName('SIF_Timestamp')->item(0)->nodeValue; $validSourceId = Agent::checkSourceId($this->originalSourceId); if (!$validSourceId) { ProvisionError::invalidSourceId($this->originalSourceId, $this->originalMsgId); if (CODELEVEL != 3) { exit; } else { return false; } } else { $this->agent = new Agent($this->originalSourceId); if (!$this->agent->isRegistered()) { RegisterError::notRegisteredError($this->originalSourceId, $this->originalMsgId); } else { $provideObjectNode = $dom->getElementsByTagName('SIF_ProvideObjects')->item(0); $this->processProvideObjects($provideObjectNode); $subscribeObjectNode = $dom->getElementsByTagName('SIF_SubscribeObjects')->item(0); $this->processSubscribeObjects($subscribeObjectNode); $publishAddObjectNode = $dom->getElementsByTagName('SIF_PublishAddObjects')->item(0); $this->processPublishAddObjects($publishAddObjectNode); $publishChangeObjectNode = $dom->getElementsByTagName('SIF_PublishChangeObjects')->item(0); $this->processPublishChangeObjects($publishChangeObjectNode); $publishDeleteObjectNode = $dom->getElementsByTagName('SIF_PublishDeleteObjects')->item(0); $this->processPublishDeleteObjects($publishDeleteObjectNode); $requestObjectNode = $dom->getElementsByTagName('SIF_RequestObjects')->item(0); $this->processRequestObjects($requestObjectNode); $respondObjectNode = $dom->getElementsByTagName('SIF_RespondObjects')->item(0); $this->processRespondObjects($respondObjectNode); $this->saveProvisions(); $timestamp = Utility::createTimestamp(); $msgId = Utility::createMessageId(); $sifMessageNode = $dom->getElementsByTagName('SIF_Message')->item(0); XmlHelper::buildSuccessMessage($msgId, $timestamp, $this->originalSourceId, $this->originalMsgId, 0, $originalMsg = null, $desc = null); } } }
public function processUnregistration() { $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($agent->sourceId, $originalMsgId); } else { $agent = new Agent($originalSourceId); if ($agent->isRegistered()) { if ($agent->unRegister()) { XmlHelper::buildSuccessMessage(Utility::createMessageId(), Utility::createTimestamp(), $agent->sourceId, $originalMsgId, 0); } else { RegisterError::genericError($agent->sourceId, $originalMsgId); } } else { RegisterError::notRegisteredError($originalSourceId, $originalMsgId); } } }
private function createAclAckMessage($sourceId, $originalMsgId) { $acl = new ACL($this->xmlDom); $timestamp = Utility::createTimestamp(); $msgId = Utility::createMessageId(); XmlHelper::buildSuccessMessage($msgId, $timestamp, $sourceId, $originalMsgId, 0, $originalMsg = $acl->BuildACL(), $desc = null); }
private function setupRequest($objectName, $sourceId, $agent) { $db = ZitDBAdapter::getDBAdapter(); $dom = $this->dom; $providerId = null; if ($sourceId != null) { $agent = new Agent($sourceId); $providerId = $agent->agentId; } else { $providerId = DataObject::getProviderId($objectName); } if ($providerId == 0) { RequestError::invalidProvider($this->originalSourceId, $this->originalMsgId); } else { $error = false; $sifMessageNode = $dom->getElementsByTagName('SIF_Message')->item(0); $eventXML = $dom->saveXML($sifMessageNode); $eventXML = str_replace('xmlns:sif="http://www.sifinfo.org/infrastructure/2.x" ', '', $eventXML); $eventXML = str_replace('xmlns="http://www.sifinfo.org/infrastructure/2.x" ', '', $eventXML); $eventXML = str_replace('xmlns:sif="http://www.sifinfo.org/infrastructure/1.x" ', '', $eventXML); $eventXML = str_replace('xmlns="http://www.sifinfo.org/infrastructure/1.x" ', '', $eventXML); $eventXML = str_replace('xmlns="http://www.sifinfo.org/uk/infrastructure/2.x" ', '', $eventXML); $eventXML = str_replace('xmlns="http://www.sifinfo.org/au/infrastructure/2.x" ', '', $eventXML); $eventXML = str_replace('xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ', '', $eventXML); $messageId = $dom->getElementsByTagName('SIF_MsgId')->item(0)->nodeValue; $bufferSize = $dom->getElementsByTagName('SIF_MaxBufferSize')->item(0)->nodeValue; /* PUSH all messages to the ZONE Version: DO NOT Check Message Version: */ $version = $_SESSION['ZONE_VERSION']; $query = "select\r\n agent_registered.sif_version,\r\n agent_registered.maxbuffersize,\r\n agent_registered.agent_mode_id,\r\n agent.source_id\r\n from " . DBConvertor::convertCase('agent_registered') . " \r\n inner join " . DBConvertor::convertCase('agent') . " on agent.agent_id = agent_registered.agent_id\r\n where agent_registered.agent_id = {$providerId} and agent_registered.unregister_timestamp is null\r\n and agent_registered.zone_id = " . $_SESSION["ZONE_ID"] . "\r\n and agent_registered.context_id = " . $_SESSION["CONTEXT_ID"]; $result = $db->fetchAll($query); switch (DB_TYPE) { case 'mysql': $agentModeId = $result[0]->agent_mode_id; $maxbuffersize = intval($result[0]->maxbuffersize); $source_id = $result[0]->source_id; $sif_version = $result[0]->sif_version; break; case 'oci8': $agentModeId = $result[0]->AGENT_MODE_ID; $maxbuffersize = intval($result[0]->MAXBUFFERSIZE); $source_id = $result[0]->SOURCE_ID; $sif_version = $result[0]->SIF_VERSION; break; } $messageSize = strlen($eventXML); if ($messageSize > $maxbuffersize) { $error = true; $header = $this->headerNode; SifLogEntry::CreateSifLogEvents($header, '4', '2', 'Buffer size of agent ' . $source_id . ' is too small to recieve this request [size : ' . $maxbuffersize . ']'); } /* if($version != '2.*') { if($version != $sif_version) { $header = $this->headerNode; $error = true; SifLogEntry::CreateSifLogEvents($header, '4', '4', 'Version in request not supported by agent '.$source_id ); } } else { $version = $_SESSION['ZONE_VERSION']; } */ if (!$error) { $dataObject = new DataObject($objectName); # $request = new Requests($db); # $data = array( # DBConvertor::convertCase('request_msg_id') => $messageId, # DBConvertor::convertCase('request_timestamp') => new Zend_Db_Expr(DBConvertor::convertCurrentTime()), # DBConvertor::convertCase('agent_id_requester') => $agent->agentId, # DBConvertor::convertCase('agent_id_responder') => intval($providerId), # DBConvertor::convertCase('request_data') => $eventXML, # DBConvertor::convertCase('max_buffer_size') => $bufferSize, # DBConvertor::convertCase('version') => $version, # DBConvertor::convertCase('agent_mode_id') => intval($agentModeId), # DBConvertor::convertCase('zone_id') => $_SESSION["ZONE_ID"], # DBConvertor::convertCase('context_id') => $_SESSION["CONTEXT_ID"] # ); # $request->insert($data); $messagequeue = new MessageQueues($db); $data = null; $data = array(DBConvertor::convertCase('msg_id') => $messageId, DBConvertor::convertCase('msg_type') => 1, DBConvertor::convertCase('status_id') => 1, DBConvertor::convertCase('insert_timestamp') => new Zend_Db_Expr(DBConvertor::convertCurrentTime()), DBConvertor::convertCase('agt_id_in') => intval($agent->agentId), DBConvertor::convertCase('agt_id_out') => intval($providerId), DBConvertor::convertCase('data') => $eventXML, DBConvertor::convertCase('maxbuffersize') => intval($bufferSize), DBConvertor::convertCase('version') => $version, DBConvertor::convertCase('agt_mode_id') => intval($agentModeId), DBConvertor::convertCase('zone_id') => $_SESSION["ZONE_ID"], DBConvertor::convertCase('context_id') => $_SESSION["CONTEXT_ID"]); $messagequeue->insert($data); } $timestamp = Utility::createTimestamp(); $msgId = Utility::createMessageId(); $sifMessageNode = $dom->getElementsByTagName('SIF_Message')->item(0); XmlHelper::buildSuccessMessage($msgId, $timestamp, $this->originalSourceId, $this->originalMsgId, 0, $originalMsg = null, $desc = null); } //invalid provider check }
public static function checkIfZitIsSleeping($dom) { if (Zit::isAsleep()) { /* todo: Should create a SIF_MESSAGE_TYPE for errors */ $_SESSION['SIF_MESSAGE_TYPE'] = 1; $headerNode = $dom->getElementsByTagName('SIF_Header')->item(0); $originalMsgId = $headerNode->getElementsByTagName('SIF_MsgId')->item(0)->nodeValue; $originalSourceId = $headerNode->getElementsByTagName('SIF_SourceId')->item(0)->nodeValue; $timestamp = Utility::createTimestamp(); $msgId = Utility::createMessageId(); $sifMessageNode = $dom->getElementsByTagName('SIF_Message')->item(0); XmlHelper::buildSuccessMessage($msgId, $timestamp, $originalSourceId, $originalMsgId, 8, $originalMsg = null, $desc = 'Receiver is sleeping'); exit; } }
public function processRequestMessages() { $db = ZitDBAdapter::getDBAdapter(); $query = "select \r\n\t\t\t \trequest_data,\r\n\t\t\t\t\tagent_registered.callback_url,\r\n\t\t\t\t\tagent_registered.frozen,\r\n\t\t\t\t\trequest_id\r\n\t\t\t\t from\r\n\t\t\t\t \trequest\r\n\t\t\t\t inner join\r\n\t\t\t\t \tagent_registered on request.agent_id_responder = agent_registered.agent_id\r\n\t\t\t\t where\r\n\t\t\t\t \trequest.status_id in (1,2)\r\n\t\t\t\t and\r\n\t\t\t\t \tagent_registered.asleep = 0\r\n\t\t\t\t and\r\n\t\t\t\t \trequest.agent_mode_id = 1\r\n\t\t\t\t and\r\n\t\t\t\t \trequest.zone_id = " . $this->zoneId . "\r\n\t\t\t\t and\r\n\t\t\t\t\tagent_registered.zone_id = " . $this->zoneId . "\r\n\t\t\t\t and \r\n\t\t\t\t \trequest.context_id = " . $this->contextId . "\r\n\t\t\t\t and \r\n\t\t\t\t\tagent_registered.context_id = " . $this->contextId; $result = $db->fetchAll($query); foreach ($result as $row) { if ($row->frozen != 1) { $timestamp = Utility::createTimestamp(); $msgId = Utility::createMessageId(); $xml = XmlHelper::buildSuccessMessage($msgId, $timestamp, $this->zoneName, $msgId, 0, $this->zoneVersion, $this->versionNamespace, $this->zoneName, $originalMsg = $row->request_data, $desc = null); $sendMessageResult = $this->sendMessage($xml, $row->callback_url, $this->zoneId, $this->contextId, $row->agent_id); echo 'here after'; if (!$sendMessageResult['Error']) { $data = array('status_id' => 2, 'msg_id' => $msgId); $db->update('request', $data, 'request_id = ' . $row->request_id); $processResponseResult = $this->processResponseMessage($sendMessageResult['Xml'], $this->zoneId, $this->contextId, $row->agent_id); if (!$processResponseResult['Error']) { if ($processResponseResult['ImmediateUpdate']) { $data = array('status_id' => 3, 'msg_id' => $msgId); $db->update('request', $data, 'request_id = ' . $row->request_id); } ZitLog::writeToLog($sendMessageResult['Xml'], $xml, $this->zoneId, $row->agent_id, 6); } //check for errors in response } else { $data = array('status_id' => 4, 'msg_id' => $msgId); $db->update('request', $data, 'request_id = ' . $row->request_id); } //errors in request } //make sure agent is not frozen } //loop through results }
private function createAclAckMessage($sourceId, $originalMsgId) { $acl = new ACL($this->xmlDom); $timestamp = Utility::createTimestamp(); $msgId = Utility::createMessageId(); if ($_SESSION['ZONE_VERSION'] == '1.5r1') { XmlHelper::buildSuccessMessage($msgId, $timestamp, $sourceId, $originalMsgId, 0); } else { XmlHelper::buildSuccessMessage($msgId, $timestamp, $sourceId, $originalMsgId, 0, $originalMsg = $acl->BuildACL(), $desc = null); } }
private function processZoneStatus() { $dom = $this->xmlDom; $headerNode = $dom->getElementsByTagName('SIF_Header')->item(0); $originalSourceId = $headerNode->getElementsByTagName('SIF_SourceId')->item(0)->nodeValue; $originalMsgId = $headerNode->getElementsByTagName('SIF_MsgId')->item(0)->nodeValue; $validSourceId = Agent::checkSourceId($originalSourceId); if (!$validSourceId) { RegisterError::invalidSourceId($originalSourceId, $originalMsgId); } else { $dom = new DOMDocument('1.0', 'iso-8859-1'); $zoneStatusNode = $dom->createElement('SIF_ZoneStatus'); $zoneStatusNode->setAttribute('ZoneId', $_SESSION['ZONE_NAME']); $dom->appendChild($zoneStatusNode); $zoneNameNode = $dom->createElement('SIF_Name'); $zoneNameNode->appendChild($dom->createTextNode($_SESSION['ZONE_DESC'])); $zoneStatusNode->appendChild($zoneNameNode); $sifVendorNode = $dom->createElement('SIF_Vendor'); $sifVendorName = $dom->createElement('SIF_Name'); $sifVendorName->appendChild($dom->createTextNode(VENDOR_NAME)); $sifVendorNode->appendChild($sifVendorName); $sifVendorProduct = $dom->createElement('SIF_Product'); $sifVendorProduct->appendChild($dom->createTextNode(VENDOR_PRODUCT)); $sifVendorNode->appendChild($sifVendorProduct); $sifVendorVersion = $dom->createElement('SIF_Version'); $sifVendorVersion->appendChild($dom->createTextNode(VENDOR_VERSION)); $sifVendorNode->appendChild($sifVendorVersion); $zoneStatusNode->appendChild($sifVendorNode); $sifProvidersNode = $dom->createElement('SIF_Providers'); $sifProvidersNode = $this->buildProviders($sifProvidersNode, $dom); $zoneStatusNode->appendChild($sifProvidersNode); $sifSubscribersNode = $dom->createElement('SIF_Subscribers'); $sifSubscribersNode = $this->buildSubscribers($sifSubscribersNode, $dom); $zoneStatusNode->appendChild($sifSubscribersNode); $sifNodes = $dom->createElement('SIF_SIFNodes'); $sifSubscribersNode = $this->buildNodeList($sifNodes, $dom); $zoneStatusNode->appendChild($sifNodes); /*$sifSupportedAuth = $dom->createElement('SIF_SupportedAuthentication'); $sifProtocolName = $dom->createElement('SIF_ProtocolName'); $sifSupportedAuth->appendChild($sifProtocolName); $zoneStatusNode->appendChild($sifSupportedAuth);*/ $sifSupportedProtocols = $dom->createElement('SIF_SupportedProtocols'); $sifProtocol = $dom->createElement('SIF_Protocol'); $sifProtocol->setAttribute('Type', 'HTTP'); $sifProtocol->setAttribute('Secure', 'No'); $sifUrl = $dom->createElement('SIF_URL'); $sifUrl->appendChild($dom->createTextNode(ZIT::getZitUrl())); $sifProtocol->appendChild($sifUrl); $sifSupportedProtocols->appendChild($sifProtocol); $zoneStatusNode->appendChild($sifSupportedProtocols); $sifSupportedVersions = $dom->createElement('SIF_SupportedVersions'); $versions = ZIT::getVersions(); foreach ($versions as $version) { $sifVersion = $dom->createElement('SIF_Version'); $sifVersion->appendChild($dom->createTextNode($version['VERSION'])); $sifSupportedVersions->appendChild($sifVersion); } $zoneStatusNode->appendChild($sifSupportedVersions); $sifAdminUrl = $dom->createElement('SIF_AdministrationURL'); $sifAdminUrl->appendChild($dom->createTextNode(ZIT::getAdminUrl())); $zoneStatusNode->appendChild($sifAdminUrl); $sifContexts = $dom->createElement('SIF_Contexts'); $sifContexts = $this->buildContexts($sifContexts, $dom); $zoneStatusNode->appendChild($sifContexts); $xml = $dom->saveXML($dom->documentElement); $msgId = Utility::createMessageId(); $timestamp = Utility::createTimestamp(); XmlHelper::buildSuccessMessage($msgId, $timestamp, $originalSourceId, $originalMsgId, 0, $originalMsg = $xml, $desc = null); } }
private function setupResponseNew($agent, $msgId, $m) { $dom = $m->dom; $dataObject = null; $db = Zend_Registry::get('my_db'); $requesterId = RequestObject::getRequesterId($msgId); $agentModeId = RequestObject::getRequesterAgentMode($msgId); try { $sifObjectDataNode = $dom->getElementsByTagName('SIF_ObjectData')->item(0); $children = isset($sifObjectDataNode->childNodes) ? $sifObjectDataNode->childNodes : ''; if (is_object($children)) { $objectName = isset($children->item(0)->nodeName) ? $children->item(0)->nodeName : null; } else { $objectName = null; ZitLog::writeToErrorLog('[SIF_ObjectData Error]', 'No SIF_ObjectData found from agent = ' . $agent->sourceId, $this->xmlStr); GeneralError::systemError($this->xmlStr); } $dataObject = new DataObject($objectName); } catch (Exception $e) { ZitLog::writeToErrorLog('[Error processing message]', "DataObject Name: " . $objectName . "\nError Message\n" . $e->getMessage() . "\n\nStack Trace\n" . $e->getTraceAsString() . ' ' . $this->xmlStr, 'Process Message', $_SESSION['ZONE_ID']); GeneralError::systemError($this->xmlStr); } $sifMessageNode = $dom->getElementsByTagName('SIF_Message')->item(0); $responseXml = $dom->saveXML($sifMessageNode); $responseXml = str_replace('xmlns="http://www.sifinfo.org/infrastructure/1.x"', '', $responseXml); $responseXml = str_replace('xmlns:sif="http://www.sifinfo.org/infrastructure/1.x"', '', $responseXml); $responseXml = str_replace('xmlns="http://www.sifinfo.org/infrastructure/2.x" ', '', $responseXml); $responseXml = str_replace('xmlns="http://www.sifinfo.org/uk/infrastructure/2.x" ', '', $responseXml); $responseXml = str_replace('xmlns="http://www.sifinfo.org/au/infrastructure/2.x" ', '', $responseXml); $responseXml = str_replace('xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ', '', $responseXml); # $data = array( # DBConvertor::convertCase('request_msg_id') => $msgId, # DBConvertor::convertCase('response_data') => $responseXml, # DBConvertor::convertCase('next_packet_num') => '2', # DBConvertor::convertCase('status_id') => '1', # DBConvertor::convertCase('agent_id_requester') => intval($requesterId), # DBConvertor::convertCase('agent_id_responder') => $agent->agentId, # DBConvertor::convertCase('agent_mode_id') => intval($agentModeId), # DBConvertor::convertCase('zone_id') => $_SESSION["ZONE_ID"], # DBConvertor::convertCase('context_id') => $_SESSION["CONTEXT_ID"] # ); # $db->insert(DBConvertor::convertCase('response'), $data); /* Removing the filterUtility as it should be reworked. $filterUtility = new FilterUtility(); $filterUtility->FilterCommonElements($dataObject->objectId, $dom, intval($requesterId)); */ try { $this->xslt = null; $permissions = new AgentPermissions($db); $where = "object_id = " . $dataObject->objectId . " and agent_id = " . $requesterId . " and zone_id = " . $_SESSION['ZONE_ID'] . " and context_id = " . $_SESSION['CONTEXT_ID']; $result = $permissions->fetchAll($where); switch (DB_TYPE) { case 'mysql': $this->xslt = isset($result[0]->xslt) ? $result[0]->xslt : null; break; case 'oci8': $this->xslt = isset($result[0]->XSLT) ? $result[0]->XSLT : null; break; } if ($this->xslt != null) { $xsltpro = new XSLTProcessor(); $XSL = new DOMDocument(); $XSL->loadXML($this->xslt); $xsltpro->importStylesheet($XSL); $XML = new DOMDocument(); $XML->loadXML($responseXml); $responseXml = $xsltpro->transformToXML($XML); } $responseXml = str_replace('<?xml version="1.0"?>' . "\n", '', $responseXml); } catch (Zend_Exception $e) { ZitLog::writeToErrorLog('[Error filtering message]', "DataObject Name: " . $objectName . "\nError Message\n" . $e->getMessage() . "\n\nStack Trace\n" . $e->getTraceAsString() . ' ' . $this->xmlStr, 'Process Message', $_SESSION['ZONE_ID']); GeneralError::systemError($this->xmlStr); } $messagequeue = new MessageQueues($db); $data = null; $data = array(DBConvertor::convertCase('msg_id') => $this->originalMsgId, DBConvertor::convertCase('ref_msg_id') => $msgId, DBConvertor::convertCase('msg_type') => 2, DBConvertor::convertCase('status_id') => '1', DBConvertor::convertCase('version') => $_SESSION['ZONE_VERSION'], DBConvertor::convertCase('insert_timestamp') => new Zend_Db_Expr(DBConvertor::convertCurrentTime()), DBConvertor::convertCase('agt_id_in') => $agent->agentId, DBConvertor::convertCase('agt_id_out') => intval($requesterId), DBConvertor::convertCase('data') => $responseXml, DBConvertor::convertCase('next_packet_num') => 2, DBConvertor::convertCase('agt_mode_id') => intval($agentModeId), DBConvertor::convertCase('zone_id') => $_SESSION["ZONE_ID"], DBConvertor::convertCase('context_id') => $_SESSION["CONTEXT_ID"]); $messagequeue->insert($data); $timestamp = Utility::createTimestamp(); $msgId = Utility::createMessageId(); XmlHelper::buildSuccessMessage($msgId, $timestamp, $this->originalSourceId, $this->originalMsgId, 0, $originalMsg = null, $desc = null); }