本文整理汇总了PHP中Utility::createMessageId方法的典型用法代码示例。如果您正苦于以下问题:PHP Utility::createMessageId方法的具体用法?PHP Utility::createMessageId怎么用?PHP Utility::createMessageId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utility
的用法示例。
在下文中一共展示了Utility::createMessageId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CreateSifLogEvents
public static function CreateSifLogEvents($header, $category, $code, $desc)
{
$db = Zend_Registry::get('my_db');
$xml = XmlHelper::buildSifLogEvent(Utility::createMessageId(), Utility::createTimestamp(), $header, $category, $code, $desc);
$xml = str_replace('xmlns="http://www.sifinfo.org/uk/infrastructure/2.x"', '', $xml);
$xml = str_replace('xmlns="http://www.sifinfo.org/infrastructure/2.x"', '', $xml);
$xml = str_replace('xmlns="http://www.sifinfo.org/infrastructure/1.x"', '', $xml);
$dataObject = new DataObject('sif_logentry');
$query = "select\r\n\t\t\t\t \tagent_registered.agent_id,\r\n\t\t\t\t\tagent_registered.agent_mode_id,\r\n agent_registered.context_id,\r\n agent_registered.zone_id\r\n\t\t\t\t from \r\n\t\t\t\t \t" . DBConvertor::convertCase('agent_registered') . " \r\n\t\t\t\t where \r\n\t\t\t\t \tagent_registered.context_id = " . $_SESSION["CONTEXT_ID"] . " \r\n\t\t\t\t\tand agent_registered.zone_id = " . $_SESSION["ZONE_ID"] . "\r\n\t\t\t\t\tand agent_registered.unregister_timestamp is null";
$result = $db->fetchAll($query);
foreach ($result as $row) {
switch (DB_TYPE) {
case 'mysql':
$agentId = intval($row->agent_id);
$agentModeId = intval($row->agent_mode_id);
$zoneId = intval($row->zone_id);
$contextId = intval($row->context_id);
break;
case 'oci8':
$agentId = intval($row->AGENT_ID);
$agentModeId = intval($row->AGENT_MODE_ID);
$zoneId = intval($row->ZONE_ID);
$contextId = intval($row->CONTEXT_ID);
break;
}
$data = array('event_timestamp' => new Zend_Db_Expr(DBConvertor::convertCurrentTime()), 'agent_id_sender' => intval(0), 'agent_id_rec' => $agentId, 'event_data' => $xml, 'object_id' => $dataObject->objectId, 'action_id' => intval(1), 'zone_id' => $zoneId, 'context_id' => $contextId, 'agent_mode_id' => $agentModeId);
/*
* $db->insert('event', $data);
*/
}
}
示例2: processEvent
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
}
示例3: Provide
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);
}
示例4: Subscribe
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);
}
示例5: notRegisteredError
public static function notRegisteredError($originalSourceId, $originalMsgId)
{
$categoryCode = "5";
$sifCode = "1";
$shortDesc = "Registration Error";
$longDesc = "Agent Not Registerd";
$timestamp = Utility::createTimestamp();
$msgId = Utility::createMessageId();
XmlHelper::buildErrorMessage($categoryCode, $sifCode, $shortDesc, $longDesc, $msgId, $timestamp, $originalSourceId, $originalMsgId);
}
示例6: updateMessageQueue
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);
}
}
示例7: processProvision
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);
}
}
}
示例8: processUnregistration
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);
}
}
}
示例9: systemError
static function systemError($xml)
{
try {
if ($xml != '' or $xml != null) {
$dom = new DomDocument();
try {
$dom->loadXML($xml);
} catch (Exception $e) {
$originalMsgId = '';
$originalSourceId = '';
$longDesc = "Premature end of Data.";
$categoryCode = "11";
$sifCode = "1";
$shortDesc = "Generic Error";
$timestamp = Utility::createTimestamp();
$msgId = Utility::createMessageId();
XmlHelper::buildErrorMessage($categoryCode, $sifCode, $shortDesc, $longDesc, $msgId, $timestamp, $originalSourceId, $originalMsgId, false);
exit;
}
$headerNode = $dom->getElementsByTagName('SIF_Header');
if ($headerNode->length != 0) {
$header = $headerNode->item(0);
} else {
$originalMsgId = '';
$originalSourceId = '';
$longDesc = "SIF_Header failed: possible a premature end of data caused this.";
$categoryCode = "11";
$sifCode = "1";
$shortDesc = "Generic Error";
$timestamp = Utility::createTimestamp();
$msgId = Utility::createMessageId();
XmlHelper::buildErrorMessage($categoryCode, $sifCode, $shortDesc, $longDesc, $msgId, $timestamp, $originalSourceId, $originalMsgId, false);
exit;
}
$SIF_MsgIdNode = $header->getElementsByTagName('SIF_MsgId');
if ($SIF_MsgIdNode->length != 0) {
$msgIdNode = $header->getElementsByTagName('SIF_MsgId')->item(0);
} else {
$originalMsgId = '';
$originalSourceId = '';
$longDesc = "SIF_MsgId - has issues.";
$categoryCode = "11";
$sifCode = "1";
$shortDesc = "Generic Error";
$timestamp = Utility::createTimestamp();
$msgId = Utility::createMessageId();
XmlHelper::buildErrorMessage($categoryCode, $sifCode, $shortDesc, $longDesc, $msgId, $timestamp, $originalSourceId, $originalMsgId, false);
exit;
}
$sourceIdNode = $header->getElementsByTagName('SIF_SourceId')->item(0);
$originalMsgId = isset($msgIdNode->nodeValue) ? $msgIdNode->nodeValue : '';
$originalSourceId = isset($sourceIdNode->nodeValue) ? $sourceIdNode->nodeValue : '';
$longDesc = "Event was not updated as recieved.";
} else {
$originalMsgId = '';
$originalSourceId = '';
$longDesc = "Event was not updated as recieved. XML not found.";
}
} catch (Exception $e) {
$originalMsgId = '';
$originalSourceId = '';
$longDesc = "Event was not updated as recieved. XML not found.";
}
$categoryCode = "11";
$sifCode = "1";
$shortDesc = "Generic Error";
$timestamp = Utility::createTimestamp();
$msgId = Utility::createMessageId();
XmlHelper::buildErrorMessage($categoryCode, $sifCode, $shortDesc, $longDesc, $msgId, $timestamp, $originalSourceId, $originalMsgId, false);
}
示例10: setupRequest
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
}
示例11: checkIfZitIsSleeping
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;
}
}
示例12: processRequestMessages
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
}
示例13: notProviderError
public static function notProviderError($originalSourceId, $originalMsgId)
{
$categoryCode = "6";
$sifCode = "5";
$shortDesc = "Not Provider";
$longDesc = "Not the provider of the object.";
$timestamp = Utility::createTimestamp();
$msgId = Utility::createMessageId();
XmlHelper::buildErrorMessage($categoryCode, $sifCode, $shortDesc, $longDesc, $msgId, $timestamp, $originalSourceId, $originalMsgId);
}
示例14: systemError
static function systemError($xml)
{
try {
if ($xml != '' or $xml != null) {
$dom = new DomDocument();
$dom->loadXML($xml);
$header = $dom->getElementsByTagName('SIF_Header')->item(0);
$msgIdNode = $header->getElementsByTagName('SIF_MsgId')->item(0);
$sourceIdNode = $header->getElementsByTagName('SIF_SourceId')->item(0);
$originalMsgId = isset($msgIdNode->nodeValue) ? $msgIdNode->nodeValue : '';
$originalSourceId = isset($sourceIdNode->nodeValue) ? $sourceIdNode->nodeValue : '';
$longDesc = "Event was not updated as recieved.";
} else {
$originalMsgId = '';
$originalSourceId = '';
$longDesc = "Event was not updated as recieved. XML not found.";
}
} catch (Exception $e) {
$originalMsgId = '';
$originalSourceId = '';
$longDesc = "Event was not updated as recieved. XML not found.";
}
$categoryCode = "11";
$sifCode = "1";
$shortDesc = "Generic Error";
$timestamp = Utility::createTimestamp();
$msgId = Utility::createMessageId();
XmlHelper::buildErrorMessage($categoryCode, $sifCode, $shortDesc, $longDesc, $msgId, $timestamp, $originalSourceId, $originalMsgId, false);
}
示例15: processZoneStatus
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);
}
}