public string Logout(string messageXml) { $"<LogoutRequestType>{messageXml}</LogoutRequestType>".XDocValidate(Utils.GetSchemas()); var request = messageXml.DeserializeFromXmlString <LogoutRequestTypeMessage>(); var responseMsg = BL.Logout(request); FormsAuthentication.SignOut(); return(responseMsg.SerializeToXmlString()); }
public string Logout(string messageXml) { LogoutResponseTypeMessage responseMsg; LogoutRequestTypeMessage request = null; try { $"<LogoutRequestType>{messageXml}</LogoutRequestType>".XDocValidate(Utils.GetSchemas()); request = messageXml.DeserializeFromXmlString <LogoutRequestTypeMessage>(); Logger.LogInformation(AvlLogEvent.LogoutCall, request.Header.SessionID, null); responseMsg = BL.Logout(request); } catch (XmlSchemaValidationException ex) { Logger.LogError(ex, request != null ? request.Header.SessionID : 0, "Logout request validation error."); responseMsg = new LogoutResponseTypeMessage() { Header = new Header() { MessageIDSpecified = true, MessageID = -1, SessionIDSpecified = true, SessionID = -1 }, Body = new LogoutResponseTypeMessageBody() { LogoutResponse = new LogoutResponseTypeMessageBodyLogoutResponse() { Description = "XML syntax error in request", Status = false } } }; } var responseStr = responseMsg.SerializeToXmlString(); $"<LogoutResponseType>{responseStr}</LogoutResponseType>".XDocValidate(Utils.GetSchemas()); Logger.LogDebug(AvlLogEvent.LogoutCall, responseMsg.Header.SessionID, "Response sent: {responseStr}", responseStr); return(responseStr); }