public async Task <Air_FlightInfoResponse> Air_FlightInfo(SessionHandler.TransactionStatusCode transactionStatusCode, TransactionFlowLinkHandler.TransactionFlowLinkAction linkAction) { BeforeRequest(transactionStatusCode, linkAction); var session = hSession.Session; var link = hLink.Link; var basicHttpBinding = new BasicHttpBinding { MaxReceivedMessageSize = int.MaxValue, Name = "AmadeusWebServicesPortBinding", ReaderQuotas = System.Xml.XmlDictionaryReaderQuotas.Max, Security = { Mode = BasicHttpSecurityMode.Transport } }; var nonceText = Guid.NewGuid().ToString(); var created = DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:ss.fff") + "Z"; var nonceBytes = Encoding.ASCII.GetBytes(nonceText); var nonceTextEncoded = Convert.ToBase64String(nonceBytes); var shaPwd1 = new System.Security.Cryptography.SHA1Managed(); var pwd = shaPwd1.ComputeHash(Encoding.ASCII.GetBytes("password")); var createdBytes = System.Text.Encoding.ASCII.GetBytes(created); var operand = new byte[nonceBytes.Length + createdBytes.Length + pwd.Length]; Array.Copy(nonceBytes, operand, nonceBytes.Length); Array.Copy(createdBytes, 0, operand, nonceBytes.Length, createdBytes.Length); Array.Copy(pwd, 0, operand, nonceBytes.Length + createdBytes.Length, pwd.Length); var sha1 = new System.Security.Cryptography.SHA1Managed(); var trueDigest = Convert.ToBase64String(sha1.ComputeHash(operand)); var soapSecurityHeader = new SoapSecurityHeader("userName", trueDigest, nonceTextEncoded, created); var factory = ChannelFactory(basicHttpBinding); var serviceProxy = AmadeusWebServicesPtChannel(factory, soapSecurityHeader); #region air flight info method call var result2 = await serviceProxy.Air_FlightInfoAsync(new Air_FlightInfoRequest { Air_FlightInfo = new Air_FlightInfo { generalFlightInfo = new Air_FlightInfoGeneralFlightInfo { boardPointDetails = new Air_FlightInfoGeneralFlightInfoBoardPointDetails { trueLocationId = "TPE" }, offPointDetails = new Air_FlightInfoGeneralFlightInfoOffPointDetails { trueLocationId = "LGW" }, companyDetails = new Air_FlightInfoGeneralFlightInfoCompanyDetails { marketingCompany = "CI" }, flightDate = new Air_FlightInfoGeneralFlightInfoFlightDate { departureDate = "021020" }, flightIdentification = new Air_FlightInfoGeneralFlightInfoFlightIdentification { flightNumber = "69" } } }, AMA_SecurityHostedUser = hSecurity.getHostedUser() }); #endregion factory.Close(); ((ICommunicationObject)serviceProxy).Close(); return(null); }
private void BeforeRequest(SessionHandler.TransactionStatusCode transactionStatusCode, TransactionFlowLinkHandler.TransactionFlowLinkAction linkAction) { hSession.HandleSession(transactionStatusCode); hLink.handleLinkAction(linkAction); hAddressing.update(); }