Пример #1
0
        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 = "";
                }
            }
        }
Пример #2
0
        public void Call()
        {
            try
            {
                var request = new SabreCommandLLSRQ
                {
                    Request = new SabreCommandLLSRQRequest
                    {
                        HostCommand = "SI5"
                    },
                    Version = VolarisResources.SabreCommandServiceVersion
                };

                var service = new SabreCommandLLSService
                {
                    MessageHeaderValue = this.GetMessageHeader(),
                    SecurityValue      = new Security
                    {
                        BinarySecurityToken = this.SecurityToken
                    }
                };

                Serializer.Serialize("SabreCommandLLSRQ", request);
                var response = service.SabreCommandLLSRQ(request);
                Serializer.Serialize("SabreCommandLLSRS", response);
                if (response.ErrorRS == null)
                {
                    Success = true;
                }
                else
                {
                    Success      = false;
                    ErrorMessage = "No se pudo establecer coneccion con los servicios.";
                }
            }
            catch (Exception ex)
            {
                Success      = true;
                ErrorMessage = ex.Message;
            }
        }
Пример #3
0
        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_);
        }