private static DataValidations IsMneRequestValid(string message) { var thirdPartyDataActivityManagementRequest = FdrCommon.SelectNode(message, "pnsb", "http://www.sars.gov.za/enterpriseMessagingModel/ThirdPartyData/ThirdPartyDataActivityManagement/xml/schemas/version/1.1", "ThirdPartyDataActivityManagementRequest"); var validations = new DataValidations(thirdPartyDataActivityManagementRequest) { SchemaList = new List <InternalSchemaData>() }; var sarsgmdBasetypes = File.ReadAllText(string.Format(AppConfig.SchemBaseFolder, "MNE", "SARSGMD_BaseTypes.xsd")); var sarsThirdPartyDataActivity = File.ReadAllText(string.Format(AppConfig.SchemBaseFolder, "MNE", "SARSThirdPartyDataActivityManagement.xsd")); var sarsthirdpartysubmissionheader = File.ReadAllText(string.Format(AppConfig.SchemBaseFolder, "MNE", "SARSThirdPartySubmissionHeader.xsd")); validations.SchemaList.AddRange( new List <InternalSchemaData> { new InternalSchemaData { TargetNamespace = "http://www.sars.gov.za/enterpriseMessagingModel/GMD/BaseTypes/xml/schemas/version/55.2", SchemaContent = sarsgmdBasetypes }, new InternalSchemaData { TargetNamespace = "http://www.sars.gov.za/enterpriseMessagingModel/ThirdPartyData/ThirdPartyDataActivityManagement/xml/schemas/version/1.1", SchemaContent = sarsThirdPartyDataActivity }, new InternalSchemaData { TargetNamespace = "http://www.sars.gov.za/enterpriseMessagingModel/ThirdPartySubmissionHeader/xml/schemas/version/1.17", SchemaContent = sarsthirdpartysubmissionheader } } ); validations.ValidateSchema(); return(validations); }
private static DataValidations IsMasterLocalFileRequestValid(string message) { var contentManagementRequest = FdrCommon.SelectNode(message, "ContMgt", "http://www.sars.gov.za/enterpriseMessagingModel/ContentManagement/xml/schemas/version/1.8", "ContentManagementRequest"); var validations = new DataValidations(contentManagementRequest) { SchemaList = new List <InternalSchemaData>() }; var contMgt = File.ReadAllText(string.Format(AppConfig.SchemBaseFolder, "ML", "SARSContentManagement.xsd")); var sarsgmdFbasetypes = File.ReadAllText(string.Format(AppConfig.SchemBaseFolder, "ML", "SARSGMD_BaseTypes.xsd")); validations.SchemaList.AddRange( new List <InternalSchemaData> { new InternalSchemaData { TargetNamespace = "http://www.sars.gov.za/enterpriseMessagingModel/ContentManagement/xml/schemas/version/1.8", SchemaContent = contMgt }, new InternalSchemaData { TargetNamespace = "http://www.sars.gov.za/enterpriseMessagingModel/GMD/BaseTypes/xml/schemas/version/54.8", SchemaContent = sarsgmdFbasetypes } } ); validations.ValidateSchema(); return(validations); }
private static DataValidations IsCbcValid(string message) { var submitCountryByCountryDeclarationRequest = FdrCommon.SelectNode(message, "tnsf", "http://www.sars.gov.za/enterpriseMessagingModel/ThirdPartyData/SubmitCountryByCountryDeclaration/xml/schemas/version/1.2", "SubmitCountryByCountryDeclarationRequest"); var validations = new DataValidations(submitCountryByCountryDeclarationRequest) { SchemaList = new List <InternalSchemaData>() }; var cbcSchema = File.ReadAllText(string.Format(AppConfig.SchemBaseFolder, "CBC", "CbcXML.xsd")); var isocbctypes = File.ReadAllText(string.Format(AppConfig.SchemBaseFolder, "CBC", "isocbctypes.xsd")); var declaration = File.ReadAllText(string.Format(AppConfig.SchemBaseFolder, "CBC", "SARSCountryByCountryDeclaration.xsd")); var oecdtypes = File.ReadAllText(string.Format(AppConfig.SchemBaseFolder, "CBC", "oecdtypes.xsd")); var sarsgmdBase = File.ReadAllText(string.Format(AppConfig.SchemBaseFolder, "CBC", "SARSGMD_BaseTypes.xsd")); var sarsgmdFormtypes = File.ReadAllText(string.Format(AppConfig.SchemBaseFolder, "CBC", "SARSGMD_FormTypes.xsd")); validations.SchemaList.AddRange( new List <InternalSchemaData> { new InternalSchemaData { TargetNamespace = "urn:oecd:ties:cbc:v1", SchemaContent = cbcSchema }, new InternalSchemaData { TargetNamespace = "urn:oecd:ties:isocbctypes:v1", SchemaContent = isocbctypes }, new InternalSchemaData { TargetNamespace = "http://www.sars.gov.za/enterpriseMessagingModel/ThirdPartyData/CountryByCountryDeclaration/xml/schemas/version/1.2", SchemaContent = declaration }, new InternalSchemaData { TargetNamespace = "urn:oecd:ties:stf:v4", SchemaContent = oecdtypes }, new InternalSchemaData { TargetNamespace = "http://www.sars.gov.za/enterpriseMessagingModel/GMD/BaseTypes/xml/schemas/version/55.2", SchemaContent = sarsgmdBase }, new InternalSchemaData { TargetNamespace = "http://www.sars.gov.za/enterpriseMessagingModel/GMD/FormTypes/xml/schemas/version/1.6", SchemaContent = sarsgmdFormtypes } } ); validations.ValidateSchema(); return(validations); }
private static void OnMessage(IMessage msg) { //var corId = FdrCommon.ByteArrayToString(msg.JMSCorrelationIDAsBytes); var message = string.Empty; try{ var textMsg = (ITextMessage)msg; message = textMsg.Text; try{ message = FdrCommon.FormatXml(message); } catch (Exception) { ; } var dataValidation = IsCbcValid(message); var header = FdrCommon.SelectNode(message, "soap12", "http://www.w3.org/2003/05/soap-envelope", "Header"); if (header != null) { var messageToSend = dataValidation.IsValid ? CreateXml(header.OuterXml) : FdrCommon.CreateFaultXml(header.OuterXml, dataValidation.ErrorXml); var queueInfo = new QueueInfo { Manager = CBCApplicationConfigurationdetails.ResponseManger, Channel = CBCApplicationConfigurationdetails.ResponseChannel, UseManagerName = false, Port = CBCApplicationConfigurationdetails.ResponsePort, HostName = CBCApplicationConfigurationdetails.ResponseHostName, QueueName = CBCApplicationConfigurationdetails.ResponseQueueName, CorrelationId = msg.JMSMessageID, Message = messageToSend }; FdrMessaging.SendMessageToQueue(queueInfo); if (!dataValidation.IsValid) { return; } } } catch (Exception exception) { FdrCommon.LogEvent(exception, EventLogEntryType.Error); } try{ if (!string.IsNullOrEmpty(message)) { SaveIncomingCbcDeclaration(message); } } catch (Exception exception) { FdrCommon.LogEvent(exception, EventLogEntryType.Error); } }