public string _Sabre_CrearSesion() { string Session_ = null; Ssoft.ValueObjects.VO_Credentials objvo_Credentials = Ssoft.Utils.clsSesiones.getCredentials(); /*ASIGNAMOS LOS CRITERIOS BASICOS PARA CREAR LA SESSION*/ VO_SessionCreateRQ vo_SessionCreateRQ = new VO_SessionCreateRQ(objvo_Credentials.User, objvo_Credentials.Password, objvo_Credentials.Ipcc, objvo_Credentials.Pcc, objvo_Credentials.Dominio ); clsSessionCreateRQ objclsSessionCreateRQ = new clsSessionCreateRQ(); Session_ = objclsSessionCreateRQ.getSesion(vo_SessionCreateRQ); VO_SabreCommandLLSRS vo = new VO_SabreCommandLLSRS(); vo.BCDATA = true; vo.StrComando = "AAA" + objvo_Credentials.Pcc; clsSabreCommandLLS oclsSabreCommandLLS = new clsSabreCommandLLS(); oclsSabreCommandLLS.StrSesion = Session_; SabreCommandLLSRS respuesta = oclsSabreCommandLLS.getEjecutarComando(vo); return(Session_); }
public void SendCommand(string commandToSend) { using (WSSessionSabre session = new WSSessionSabre()) { try { session.OpenConnection(); if (session.IsConnected) { SabreCommandLLSService service = new SabreCommandLLSService(); service.MessageHeaderValue = new MessageHeader(); service.MessageHeaderValue.ConversationId = session.ConversationId; service.MessageHeaderValue.Action = "SabreCommandLLSRQ"; service.MessageHeaderValue.CPAId = session.IPcc; service.MessageHeaderValue.From = new From(); From from = new From(); PartyId partyId = new PartyId(); partyId.Value = "9999"; from.PartyId = new PartyId[] { partyId }; service.MessageHeaderValue.From = from; service.MessageHeaderValue.To = new To(); To to = new To(); PartyId newPartyId = new PartyId(); newPartyId.Value = "123123"; to.PartyId = new PartyId[] { newPartyId }; service.MessageHeaderValue.To = to; service.SecurityValue = new Security(); service.SecurityValue.BinarySecurityToken = session.SecurityToken; SabreCommandLLSRQ request = new SabreCommandLLSRQ(); request.Request = new SabreCommandLLSRQRequest(); request.Request.HostCommand = commandToSend; request.Target = SabreCommandLLSRQTarget.Test; request.Request.Output = SabreCommandLLSRQRequestOutput.SDSXML; request.TimeStamp = new TimeSpan().ToString(); SabreCommandLLSRS response = service.SabreCommandLLSRQ(request); this.ResponseFromServer = response.Response; } } catch (Exception exception) { this.ResponseFromServer = ""; } } }
public static string _CrearSesion() { string Session_ = null; clsCache cCache = new csCache().cCache(); StringBuilder consulta = new StringBuilder(); clsParametros cParametros = new clsParametros(); VO_Credentials objvo_Credentials = clsSesiones.getCredentials(); string sMensaje = clsValidaciones.GetKeyOrAdd("sMensajeSesionSabre", "En este momento hay mas de 2000 personas consultado nuestras Promociones!!!"); string sSugerencia = clsValidaciones.GetKeyOrAdd("sSugerenciaSesionSabre", "Por favor intente de nuevo en 5 minutos!!!"); try { /*ASIGNAMOS LOS CRITERIOS BASICOS PARA CREAR LA SESSION*/ VO_SessionCreateRQ vo_SessionCreateRQ = new VO_SessionCreateRQ(objvo_Credentials.User, objvo_Credentials.Password, objvo_Credentials.Ipcc, objvo_Credentials.Pcc, objvo_Credentials.Dominio ); clsSessionCreateRQ objclsSessionCreateRQ = new clsSessionCreateRQ(); try { Session_ = objclsSessionCreateRQ.getSesion(vo_SessionCreateRQ); } catch (Exception Ex) { cParametros.Id = 0; cParametros.Message = Ex.Message.ToString(); cParametros.Tipo = clsTipoError.Library; cParametros.Severity = clsSeveridad.Moderada; cParametros.Metodo = System.Reflection.MethodInfo.GetCurrentMethod().Name; cParametros.Complemento = "_CrearSesion"; cParametros.Info = cParametros.Message; consulta.AppendLine("Credenciales: "); try { if (objvo_Credentials != null) { consulta.AppendLine("User: "******"Password: "******"Ipcc: " + objvo_Credentials.Ipcc); consulta.AppendLine("Pcc: " + objvo_Credentials.Pcc); consulta.AppendLine("Dominio: " + objvo_Credentials.Dominio); consulta.AppendLine("Session Sabre: " + Session_.ToString()); consulta.AppendLine("Url Sabre: " + objvo_Credentials.UrlWebServices); } } catch { } cParametros.StackTrace = consulta.ToString(); try { if (Session_ != null) { if (cCache != null) { cParametros.Source = "Sesion Local: " + cCache.SessionID.ToString(); } else { cParametros.Source = "Sesion Local: No hay cache "; } } } catch { cParametros.Source = "Sesion Local: Error "; } try { if (cCache != null) { cParametros.ErrorConfigura[0] = cCache.Empresa; } else { cParametros.ErrorConfigura[0] = "0"; } } catch { } if (cParametros.Message.Contains("limit of Host TAs allocated")) { cParametros.ViewMessage.Add(sMensaje); cParametros.Sugerencia.Add(sSugerencia); cParametros.Code = "109"; } else { cParametros.Code = "106"; } cParametros.ValidaInfo = false; clsSesiones.setParametrosError(cParametros); ExceptionHandled.Publicar(cParametros); clsValidaciones.RedirectPagina("ErrorBusqueda.aspx", true); } VO_SabreCommandLLSRS vo = new VO_SabreCommandLLSRS(); vo.BCDATA = true; vo.StrComando = "AAA" + objvo_Credentials.Pcc; clsSabreCommandLLS oclsSabreCommandLLS = new clsSabreCommandLLS(); oclsSabreCommandLLS.StrSesion = Session_; SabreCommandLLSRS respuesta = oclsSabreCommandLLS.getEjecutarComando(vo); //if (clsValidaciones.GetKeyOrAdd("ValidaLogTransac", "False").ToUpper().Equals("TRUE")) //{ consulta.AppendLine("Credenciales: "); if (objvo_Credentials != null) { consulta.AppendLine("User: "******"Password: "******"Ipcc: " + objvo_Credentials.Ipcc); consulta.AppendLine("Pcc: " + objvo_Credentials.Pcc); consulta.AppendLine("Dominio: " + objvo_Credentials.Dominio); consulta.AppendLine("Url Sabre: " + objvo_Credentials.UrlWebServices); } cParametros.Id = 1; cParametros.TipoLog = Enum_Error.Transac; cParametros.Message = "Ejecucion del comando AAA y perfil de agencia"; cParametros.Tipo = clsTipoError.WebServices; cParametros.Severity = clsSeveridad.Baja; cParametros.TargetSite = "Comando: " + vo.StrComando; cParametros.StackTrace = "Respuesta" + respuesta.Response; cParametros.Metodo = System.Reflection.MethodInfo.GetCurrentMethod().Name; cParametros.Complemento = consulta.ToString(); try { if (Session_ != null) { cParametros.Info = "Session Sabre: " + Session_.ToString(); } if (cCache != null) { cParametros.Source = "Sesion Local: " + cCache.SessionID.ToString(); } else { cParametros.Source = "Sesion Local: No hay cache "; } } catch { cParametros.Source = "Sesion Local: Error "; } ExceptionHandled.Publicar(cParametros); //} } catch (Exception Ex) { consulta.AppendLine("Credenciales: "); if (objvo_Credentials != null) { consulta.AppendLine("User: "******"Password: "******"Ipcc: " + objvo_Credentials.Ipcc); consulta.AppendLine("Pcc: " + objvo_Credentials.Pcc); consulta.AppendLine("Dominio: " + objvo_Credentials.Dominio); consulta.AppendLine("Url Sabre: " + objvo_Credentials.UrlWebServices); } cParametros.Id = 0; cParametros.TipoLog = Enum_Error.Log; cParametros.Message = Ex.Message.ToString(); cParametros.Source = Ex.Source.ToString(); cParametros.Tipo = clsTipoError.WebServices; cParametros.Severity = clsSeveridad.Alta; cParametros.Metodo = System.Reflection.MethodInfo.GetCurrentMethod().Name; cParametros.Complemento = consulta.ToString(); cParametros.Info = cParametros.Message; try { if (cCache != null) { cParametros.ErrorConfigura[0] = cCache.Empresa; } else { cParametros.ErrorConfigura[0] = "0"; } } catch { } if (cParametros.Message.Contains("limit of Host TAs allocated")) { cParametros.ViewMessage.Add(sMensaje); cParametros.Sugerencia.Add(sSugerencia); cParametros.Code = "109"; } else { cParametros.Code = "106"; } cParametros.ValidaInfo = false; cParametros.TipoWs = Enum_ProveedorWebServices.Sabre; clsSesiones.setParametrosError(cParametros); ExceptionHandled.Publicar(cParametros); clsValidaciones.RedirectPagina("ErrorBusqueda.aspx", true); } return(Session_); }
public SabreCommandLLSRS getEjecutarComando(VO_SabreCommandLLSRS vo_SabreCommandLLSRS) { SabreCommandLLSRS SabreCommandRespuesta_ = new SabreCommandLLSRS(); MessageHeader srMensaje = clsSabreBase.SabreCommandLLS(); clsParametros cParametros = new clsParametros(); clsCache cCache = new csCache().cCache(); VO_Credentials objvo_Credentials; objvo_Credentials = clsSesiones.getCredentials(); StringBuilder consulta = new StringBuilder(); cParametros.TipoWs = Enum_ProveedorWebServices.Sabre; if (srMensaje != null) { Security Seguridad_ = new Security(); Seguridad_.BinarySecurityToken = StrSesion; SabreCommandLLSRQ SabreCommand_ = new SabreCommandLLSRQ(); SabreCommandLLSRQRequest oSabreCommandLLSRQRequest = new SabreCommandLLSRQRequest(); //oSabreCommandLLSRQRequest.Output = vo_SabreCommandLLSRS.ESalida; oSabreCommandLLSRQRequest.CDATA = vo_SabreCommandLLSRS.BCDATA; oSabreCommandLLSRQRequest.HostCommand = vo_SabreCommandLLSRS.StrComando; SabreCommand_.Request = oSabreCommandLLSRQRequest; SabreCommand_.Version = clsSabreBase.COMMANDLLS_VERSION; SabreCommandLLSService SabreCommandServicio_ = new SabreCommandLLSService(); SabreCommandServicio_.MessageHeaderValue = srMensaje; SabreCommandServicio_.SecurityValue = Seguridad_; SabreCommandServicio_.Url = objvo_Credentials.UrlWebServices; SabreCommandRespuesta_ = SabreCommandServicio_.SabreCommandLLSRQ(SabreCommand_); if (SabreCommandRespuesta_.ErrorRS != null) { cParametros.Id = 0; cParametros.Code = SabreCommandRespuesta_.ErrorRS.Errors.Error.ErrorCode; cParametros.Info = SabreCommandRespuesta_.ErrorRS.Errors.Error.ErrorInfo.Message; cParametros.Message = SabreCommandRespuesta_.ErrorRS.Errors.Error.ErrorMessage; cParametros.Severity = SabreCommandRespuesta_.ErrorRS.Errors.Error.Severity; cParametros.Tipo = clsTipoError.WebServices; cParametros.ViewMessage.Add(""); cParametros.Sugerencia.Add(""); cParametros.Message = SabreCommandRespuesta_.ErrorRS.Errors.Error.ErrorMessage; cParametros.Complemento = "SabreCommand"; cParametros.InnerException = "HostCommand: " + vo_SabreCommandLLSRS.StrComando; cParametros.TipoLog = Enum_Error.Log; try { cParametros.TargetSite = "Response: " + SabreCommandRespuesta_.Response; } catch { } consulta.AppendLine("Credenciales: "); try { if (objvo_Credentials != null) { consulta.AppendLine("User: "******"Password: "******"Ipcc: " + objvo_Credentials.Ipcc); consulta.AppendLine("Pcc: " + objvo_Credentials.Pcc); consulta.AppendLine("QNumber: " + objvo_Credentials.QNumber); consulta.AppendLine("Dominio: " + objvo_Credentials.Dominio); consulta.AppendLine("Session Sabre: " + strSesion.ToString()); consulta.AppendLine("Url Sabre: " + objvo_Credentials.UrlWebServices); } } catch { } cParametros.StackTrace = consulta.ToString(); try { cParametros.Metodo = System.Reflection.MethodBase.GetCurrentMethod().Name; if (cCache != null) { cParametros.Source = "Sesion Local: " + cCache.SessionID.ToString(); } else { cParametros.Source = "Sesion Local: No hay cache "; } } catch { cParametros.Source = "Sesion Local: Error "; } ExceptionHandled.Publicar(cParametros); } else { //if (clsValidaciones.GetKeyOrAdd("ValidaLogTransac", "False").ToUpper().Equals("TRUE")) //{ cParametros.Id = 1; cParametros.Complemento = "SabreCommand"; cParametros.Message = "HostCommand: " + vo_SabreCommandLLSRS.StrComando; cParametros.Info = "Response: " + SabreCommandRespuesta_.Response; cParametros.Severity = clsSeveridad.Moderada; cParametros.Tipo = clsTipoError.WebServices; cParametros.TipoLog = Enum_Error.Transac; consulta.AppendLine("Credenciales: "); try { if (objvo_Credentials != null) { consulta.AppendLine("User: "******"Password: "******"Ipcc: " + objvo_Credentials.Ipcc); consulta.AppendLine("Pcc: " + objvo_Credentials.Pcc); consulta.AppendLine("QNumber: " + objvo_Credentials.QNumber); consulta.AppendLine("Dominio: " + objvo_Credentials.Dominio); consulta.AppendLine("Session Sabre: " + strSesion.ToString()); consulta.AppendLine("Url Sabre: " + objvo_Credentials.UrlWebServices); } } catch { } cParametros.StackTrace = consulta.ToString(); try { cParametros.Metodo = System.Reflection.MethodBase.GetCurrentMethod().Name; cParametros.StackTrace = "Session Sabre: " + strSesion.ToString(); if (cCache != null) { cParametros.Source = "Sesion Local: " + cCache.SessionID.ToString(); } else { cParametros.Source = "Sesion Local: No hay cache "; } } catch { cParametros.Source = "Sesion Local: Error "; } ExceptionHandled.Publicar(cParametros); //} } } return(SabreCommandRespuesta_); }