private static string CreateResponseXml(string header, ApplicationInformationStructureApplicationInformationResult appResult) { var applicationInformationStructure = new ApplicationInformationStructure { ApplicationInformationResult = new ApplicationInformationStructureApplicationInformationResult[1] }; applicationInformationStructure.ApplicationInformationResult[0] = appResult; var applicationInformationStructureXml = Sars.Systems.Serialization.XmlObjectSerializer.GetXmlWithNoDeclaration(applicationInformationStructure, "fdri", "http://www.egovernment.gov.za/GMD/ApplicationInformation/xml/schemas/version/3.1"); var xmlBuilder = new StringBuilder(); xmlBuilder.Append( "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?> " + "<soap12:Envelope xmlns:soap12=\"http://www.w3.org/2003/05/soap-envelope\" " + "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " + "xmlns:esb=\"http://www.egovernment.gov.za/GMD/MessageIdentification/xml/schemas/version/7.1\">" ); xmlBuilder.AppendFormat( "<soap12:Header xmlns:soap12=\"http://www.w3.org/2003/05/soap-envelope\">" + "{0}" + "</soap12:Header>" + " <soap12:Body>" + "{1}" + "</soap12:Body>" + "</soap12:Envelope>", header, applicationInformationStructureXml ); return(FormatXml(xmlBuilder.ToString())); }
private void RespondToB2Bi(ApplicationInformationStructure applicationInformationStructure, string code, string returnMessage, bool isError, string headerXml, string countryByCountryReportManagementRequestXml, IncomingMessage incomingMessage) { applicationInformationStructure.ApplicationInformationResult[0] = new ApplicationInformationStructureApplicationInformationResult { Code = code, Description = returnMessage, MessageType = isError ? MessageTypeEnum.ERROR : MessageTypeEnum.INFORMATION }; var messageToSend = CreateXml(headerXml, applicationInformationStructure, countryByCountryReportManagementRequestXml); SendMessage(messageToSend, incomingMessage, _client); }