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); } } }
public Session CreateSession(string username, string agency, string organization, string password, int dataLength, bool forceNewSession) { //AuthenticateRequest client = new AmadeusWebServicesPTClient(); var sec_auth = new Security_Authenticate(); sec_auth.dutyCode = new ReferenceInformationTypeI(); sec_auth.dutyCode.dutyCodeDetails = new ReferencingDetailsTypeI2(); sec_auth.dutyCode.dutyCodeDetails.referenceIdentifier = "SU"; sec_auth.dutyCode.dutyCodeDetails.referenceQualifier = "DUT"; sec_auth.passwordInfo = new BinaryDataType[1]; sec_auth.passwordInfo[0] = new BinaryDataType(); sec_auth.passwordInfo[0].dataLength = dataLength.ToString(); sec_auth.passwordInfo[0].dataType = "E"; sec_auth.passwordInfo[0].binaryData = password; sec_auth.systemDetails = new SystemDetailsInfoType(); sec_auth.systemDetails.organizationDetails = new SystemDetailsTypeI1(); sec_auth.systemDetails.organizationDetails.organizationId = organization; sec_auth.userIdentifier = new UserIdentificationType2[1]; sec_auth.userIdentifier[0] = new UserIdentificationType2(); sec_auth.userIdentifier[0].originator = username; sec_auth.userIdentifier[0].originatorTypeCode = "U"; sec_auth.userIdentifier[0].originIdentification = new OriginatorIdentificationDetailsTypeI3(); sec_auth.userIdentifier[0].originIdentification.sourceOffice = agency; session = new Session { SessionId = string.Empty, SecurityToken = string.Empty, SequenceNumber = "1" }; var sec_auth_reply = client.Security_Authenticate(ref session, sec_auth); if (sec_auth_reply.errorSection != null) { var sb = new StringBuilder(); foreach (var s in sec_auth_reply.errorSection.interactiveFreeText.freeText) { sb.Append(s); } throw new Exception(sb.ToString()); } return(session); }
public Session CreateSession(string username, string agency, string organization, string password, int dataLength, bool forceNewSession) { //AuthenticateRequest client = new AmadeusWebServicesPTClient(); var sec_auth = new Security_Authenticate(); sec_auth.dutyCode = new ReferenceInformationTypeI(); sec_auth.dutyCode.dutyCodeDetails = new ReferencingDetailsTypeI2(); sec_auth.dutyCode.dutyCodeDetails.referenceIdentifier = "SU"; sec_auth.dutyCode.dutyCodeDetails.referenceQualifier = "DUT"; sec_auth.passwordInfo = new BinaryDataType[1]; sec_auth.passwordInfo[0] = new BinaryDataType(); sec_auth.passwordInfo[0].dataLength = dataLength.ToString(); sec_auth.passwordInfo[0].dataType = "E"; sec_auth.passwordInfo[0].binaryData = password; sec_auth.systemDetails = new SystemDetailsInfoType(); sec_auth.systemDetails.organizationDetails = new SystemDetailsTypeI1(); sec_auth.systemDetails.organizationDetails.organizationId = organization; sec_auth.userIdentifier = new UserIdentificationType2[1]; sec_auth.userIdentifier[0] = new UserIdentificationType2(); sec_auth.userIdentifier[0].originator = username; sec_auth.userIdentifier[0].originatorTypeCode = "U"; sec_auth.userIdentifier[0].originIdentification = new OriginatorIdentificationDetailsTypeI3(); sec_auth.userIdentifier[0].originIdentification.sourceOffice = agency; session = new Session { SessionId = string.Empty, SecurityToken = string.Empty, SequenceNumber = "1" }; var sec_auth_reply = client.Security_Authenticate(ref session, sec_auth); if (sec_auth_reply.errorSection != null) { var sb = new StringBuilder(); foreach (var s in sec_auth_reply.errorSection.interactiveFreeText.freeText) sb.Append(s); throw new Exception(sb.ToString()); } return session; }