Exemplo n.º 1
0
        public void autenticarse(string OfficeId)
        {
            //var WSCliente = new AmadeusWebServices();
            if (WSCliente == null)
            {
                WSCliente = new AmadeusWebServices();
                var oALogin = new WSALogin();

                //Crea la sesión authentic
                var sec_auth       = new Security_Authenticate();
                var sec_auth_reply = new Security_AuthenticateReply();

                var oSession = new Session();
                oSession.SecurityToken  = "";
                oSession.SequenceNumber = "";
                oSession.SessionId      = "";
                WSCliente.SessionValue  = oSession;

                var oPasswordInfo   = new Security_AuthenticatePasswordInfo[1];
                var oUserIdentifier = new Security_AuthenticateUserIdentifier[1];

                sec_auth.dutyCode = new Security_AuthenticateDutyCode();
                sec_auth.dutyCode.dutyCodeDetails = new Security_AuthenticateDutyCodeDutyCodeDetails();
                sec_auth.dutyCode.dutyCodeDetails.referenceIdentifier = oALogin.dutyCodeId;
                sec_auth.dutyCode.dutyCodeDetails.referenceQualifier  = oALogin.dutyCodeQu;

                oPasswordInfo[0]            = new Security_AuthenticatePasswordInfo();
                oPasswordInfo[0].dataLength = oALogin.pwdLen;
                oPasswordInfo[0].dataType   = oALogin.pwdType;
                oPasswordInfo[0].binaryData = oALogin.pwd;
                sec_auth.passwordInfo       = oPasswordInfo;

                sec_auth.systemDetails = new Security_AuthenticateSystemDetails();
                sec_auth.systemDetails.organizationDetails = new Security_AuthenticateSystemDetailsOrganizationDetails();
                sec_auth.systemDetails.organizationDetails.organizationId = oALogin.organization;

                oUserIdentifier[0]                      = new Security_AuthenticateUserIdentifier();
                oUserIdentifier[0].originator           = oALogin.uorigin;
                oUserIdentifier[0].originatorTypeCode   = oALogin.uoriginType;
                oUserIdentifier[0].originIdentification = new Security_AuthenticateUserIdentifierOriginIdentification();
                oUserIdentifier[0].originIdentification.sourceOffice = OfficeId;
                sec_auth.userIdentifier = oUserIdentifier;

                sec_auth.applicationId = new Security_AuthenticateApplicationId();
                sec_auth.applicationId.applicationDetails            = new Security_AuthenticateApplicationIdApplicationDetails();
                sec_auth.applicationId.applicationDetails.internalId = oALogin.aplicationId;

                sec_auth_reply = WSCliente.Security_Authenticate(sec_auth);

                if (sec_auth_reply.errorSection != null)
                {
                    var mError = sec_auth_reply.errorSection.applicationError.errorDetails.errorCode;
                    Console.Write(mError);
                }
            }
        }
Exemplo n.º 2
0
        public void signOut()
        {
            var sec_SignOut = new Security_SignOut();

            try
            {
                var response = WSCliente.Security_SignOut(sec_SignOut);
                WSCliente = null;
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error signOut: " + ex.Message.ToString());
            }
        }