public string Login(string messageXml)
        {
            $"<LoginRequestType>{messageXml}</LoginRequestType>".XDocValidate(Utils.GetSchemas());

            var request     = messageXml.DeserializeFromXmlString <LoginRequestTypeMessage>();
            var responseMsg = BL.Login(request);

            if (responseMsg.Body.LoginResponse.Status)
            {
                var ticket = new FormsAuthenticationTicket(
                    1,
                    request.Body.LoginRequest.CustomerName,
                    DateTime.Now,
                    DateTime.Now.AddDays(int.Parse(this.Config["LoginExpirationDays"])),
                    true,
                    request.Body.LoginRequest.ClientIP
                    );
                string encryptedTicket = FormsAuthentication.Encrypt(ticket);
                var    cookie          = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
                HttpContext.Current.Response.Cookies.Add(cookie);
            }
            var responseStr = responseMsg.SerializeToXmlString();

            $"<LoginResponseType>{responseStr}</LoginResponseType>".XDocValidate(Utils.GetSchemas());
            return(responseStr);
        }
        public string Login(string messageXml)
        {
            LoginResponseTypeMessage responseMsg;
            LoginRequestTypeMessage  request = null;

            try
            {
                $"<LoginRequestType>{messageXml}</LoginRequestType>".XDocValidate(Utils.GetSchemas());
                request = messageXml.DeserializeFromXmlString <LoginRequestTypeMessage>();
                Logger.LogInformation(AvlLogEvent.LoginCall, request.Header.SessionID, "Login Name: {loginName}", request.Body.LoginRequest.CustomerName);
                responseMsg = BL.Login(request);
            }
            catch (XmlSchemaValidationException ex) {
                Logger.LogError(ex, request != null ? request.Header.SessionID : 0, "Login request validation error.");
                responseMsg = BL.GetDefaultLoginResponseMessage();
                responseMsg.Body.LoginResponse.Status      = false;
                responseMsg.Body.LoginResponse.Description = "XML syntax error in request";
            }
            var responseStr = responseMsg.SerializeToXmlString();

            $"<LoginResponseType>{responseStr}</LoginResponseType>".XDocValidate(Utils.GetSchemas());
            Logger.LogDebug(AvlLogEvent.LoginCall, responseMsg.Header.SessionID, "Response sent: {responseStr}", responseStr);
            return(responseStr);
        }