private async Task <LowFareSearchRsp> SubmitAirLowFareSearchAsync(FlightSearchRQ request, JourneyType journeyType) { AirLowFareSearchPortTypeClient client; var binding = GenerateBasicHttpBinding(); try { var endpoint = new EndpointAddress("https://apac.universal-api.pp.travelport.com/B2BGateway/connect/uAPI/AirService"); client = new AirLowFareSearchPortTypeClient(binding, endpoint); var httpHeaders = Helper.ReturnHttpHeader(); client.Endpoint.EndpointBehaviors.Add(new HttpHeadersEndpointBehavior(httpHeaders)); var req = ConvertToLowFareSearchReq(request, journeyType); _LogService.LogInfo($"uAPI/LowFareSearchReq_{journeyType}", req); var response = await client.serviceAsync(null, req); _LogService.LogInfo($"uAPI/LowFareSearchRsp_{journeyType}", response); return(response.LowFareSearchRsp); } catch (Exception ex) { _LogService.LogException(ex, $"uAPI.AirService.SubmitAirLowFareSearchAsync_{journeyType}"); return(null); } finally { client = null; binding = null; } }
public LowFareSearchRsp LowFareShop(bool solutionResult) { LowFareSearchReq lowFareSearchReq = new LowFareSearchReq(); LowFareSearchRsp lowFareSearchRsp; lowFareSearchReq = SetUpLFSSearch(lowFareSearchReq, solutionResult); AirLowFareSearchPortTypeClient client = new AirLowFareSearchPortTypeClient("AirLowFareSearchPort", WsdlService.AIR_ENDPOINT); client.ClientCredentials.UserName.UserName = Helper.RetrunUsername(); client.ClientCredentials.UserName.Password = Helper.ReturnPassword(); try { var httpHeaders = Helper.ReturnHttpHeader(); client.Endpoint.EndpointBehaviors.Add(new HttpHeadersEndpointBehavior(httpHeaders)); lowFareSearchRsp = client.service(lowFareSearchReq); //Console.WriteLine(lowFareSearchRsp.AirSegmentList.Count()); return lowFareSearchRsp; } catch (Exception se) { Console.WriteLine("Error : " + se.Message); client.Abort(); return null; } }
public LowFareSearchRsp LowFareShop(bool solutionResult) { LowFareSearchReq lowFareSearchReq = new LowFareSearchReq(); LowFareSearchRsp lowFareSearchRsp; lowFareSearchReq = SetUpLFSSearch(lowFareSearchReq, solutionResult); AirLowFareSearchPortTypeClient client = new AirLowFareSearchPortTypeClient("AirLowFareSearchPort", WsdlService.AIR_ENDPOINT); client.ClientCredentials.UserName.UserName = Helper.RetrunUsername(); client.ClientCredentials.UserName.Password = Helper.ReturnPassword(); try { var httpHeaders = Helper.ReturnHttpHeader(); client.Endpoint.EndpointBehaviors.Add(new HttpHeadersEndpointBehavior(httpHeaders)); lowFareSearchRsp = client.service(null, lowFareSearchReq); //Console.WriteLine(lowFareSearchRsp.AirSegmentList.Count()); return(lowFareSearchRsp); } catch (Exception se) { Console.WriteLine("Error : " + se.Message); client.Abort(); return(null); } }
public JsonResult LowFareShop(SearchModel searchModel) { bool solutionResult = true; LowFareSearchReq lowFareSearchReq = new LowFareSearchReq(); LowFareSearchRsp lowFareSearchRsp; lowFareSearchReq = SetUpLFSSearch(lowFareSearchReq, solutionResult, searchModel); AirLowFareSearchPortTypeClient client = new AirLowFareSearchPortTypeClient("AirLowFareSearchPort", WsdlService.AIR_ENDPOINT); client.ClientCredentials.UserName.UserName = Helper.RetrunUsername(); client.ClientCredentials.UserName.Password = Helper.ReturnPassword(); try { var httpHeaders = Helper.ReturnHttpHeader(); client.Endpoint.EndpointBehaviors.Add(new HttpHeadersEndpointBehavior(httpHeaders)); lowFareSearchRsp = client.service(null, lowFareSearchReq); return(Json(ConverToModelForLFS(lowFareSearchRsp), JsonRequestBehavior.AllowGet)); } catch (Exception se) { Console.WriteLine("Error : " + se.Message); client.Abort(); return(null); } }