public string ExportData(string messageXml) { $"<ExportDataRequestType>{messageXml}</ExportDataRequestType>".XDocValidate(Utils.GetSchemas()); var request = messageXml.DeserializeFromXmlString <ExportDataRequestTypeMessage>(); var responseMsg = BL.ExportData(request); var responseStr = responseMsg.SerializeToXmlString(); $"<ExportDataResponseType>{responseStr}</ExportDataResponseType>".XDocValidate(Utils.GetSchemas()); return(responseStr); }
public string ExportData(string messageXml) { ExportDataResponseTypeMessage responseMsg; ExportDataRequestTypeMessage request = null; try { $"<ExportDataRequestType>{messageXml}</ExportDataRequestType>".XDocValidate(Utils.GetSchemas()); request = messageXml.DeserializeFromXmlString <ExportDataRequestTypeMessage>(); Logger.LogInformation(AvlLogEvent.ExportDataCall, request.Header.SessionID, null); responseMsg = BL.ExportData(request); } catch (XmlSchemaValidationException ex) { Logger.LogError(ex, request != null ? request.Header.SessionID : 0, "ExportData request validation error."); responseMsg = new ExportDataResponseTypeMessage() { Header = new Header() { MessageIDSpecified = true, SessionIDSpecified = true, MessageID = -1, SessionID = -1 }, Body = new ExportDataResponseTypeMessageBody() { DataInsertResponse = new ExportDataResponseTypeMessageBodyDataInsertResponse() { Description = "XML syntax error in request", Status = false } } }; } var responseStr = responseMsg.SerializeToXmlString(); $"<ExportDataResponseType>{responseStr}</ExportDataResponseType>".XDocValidate(Utils.GetSchemas()); Logger.LogDebug(AvlLogEvent.ExportDataCall, responseMsg.Header.SessionID, "Response sent: {responseStr}", responseStr); return(responseStr); }