Travelport uAPI SoapClient响应问题

时间:2014-03-25 08:53:16

标签: c# asp.net web-services wcf wsdl

我是travelport universal api的新手。我收到来自api的回复。我执行LOW FARE SEARCH并作为回应,票价信息和航班信息返回两个不同的列表。问题是我在这些LIST中找不到任何关系。什么是解决WSDL响应的最佳方式。我在下面使用WSDL是我的代码

string TargetBranch = "P7004961";
string OriginApplication = "uAPI";
string Origin="DXB";
string   Destination="LHR";
string Departuredate = "2014-03-25T00:00:00";
string FlightStatus = "One-way";
string url = "https://americas-uapi.copy-webservices.travelport.com/B2BGateway/connect/uAPI/AirService";
string ReturnDate = "2014-04-05T00:00:00";
string UserName = "Universal API/uAPI6035036525-8ff7f8fc", Password = "DSXSEDn3fme9d6m2DfKP5rEaW";
LowFareSearchReq req = new LowFareSearchReq();
req.TargetBranch = TargetBranch;
BillingPointOfSaleInfo biPOS = new BillingPointOfSaleInfo();
biPOS.OriginApplication = OriginApplication;
req.BillingPointOfSaleInfo = biPOS;
/////////// Origin to Destination////////////////
SearchAirLeg airLeg = new SearchAirLeg();
Airport fromAirPort = new Airport() { Code = Origin };
typeSearchLocation fromTypLoc = new typeSearchLocation() { Item = fromAirPort };
airLeg.SearchOrigin = new typeSearchLocation[1] { fromTypLoc };
Airport toAirPort = new Airport() { Code = Destination };
typeSearchLocation toTypLoc = new typeSearchLocation() { Item = toAirPort };
airLeg.SearchDestination = new typeSearchLocation[1] { toTypLoc };        
typeTimeSpec origDep = new typeTimeSpec() { PreferredTime = Departuredate };
airLeg.Items = new typeTimeSpec[1] { origDep };
/////////////////// Destination to Origin ////////////////////
SearchAirLeg returnLeg = new SearchAirLeg();
Airport RetfromAirport = new Airport() { Code = Destination };
typeSearchLocation fromLocation = new typeSearchLocation() { Item = RetfromAirport };
returnLeg.SearchOrigin = new typeSearchLocation[1] { fromLocation };
Airport retToAirpot = new Airport() { Code = Origin };
typeSearchLocation tolocation = new typeSearchLocation() { Item = retToAirpot };
returnLeg.SearchDestination = new typeSearchLocation[1] { tolocation };
typeTimeSpec retdate = new typeTimeSpec() { PreferredTime = ReturnDate };
returnLeg.Items = new typeTimeSpec[1] { retdate };
///////// checking for one way or return//////////////////////////
if (FlightStatus == "One-way")
{
    req.Items = new object[] { airLeg };
}
else
{
    req.Items = new object[] { airLeg, returnLeg };
}       
AirSearchModifiers AirsearchModifier = new AirSearchModifiers()
{
    DistanceType = typeDistance.KM,
    IncludeFlightDetails = true,
    PreferNonStop = true,
    MaxSolutions = "300",
    PreferredProviders=  new Provider[1]{ new Provider(){ Code="1G"}}
};
req.AirSearchModifiers = AirsearchModifier;
SearchPassenger pass1 = new SearchPassenger() { Code = "ADT" };
req.SearchPassenger = new SearchPassenger[] { pass1 };
string Currency = "PKR";
AirPricingModifiers AirPriceMode = new AirPricingModifiers() { CurrencyType = Currency, };
req.AirPricingModifiers = AirPriceMode;
LowFareSearchRsp response = new LowFareSearchRsp();
AirLowFareSearchBinding binding = new AirLowFareSearchBinding();
binding.Url = url;
binding.Credentials = new NetworkCredential(UserName, Password);

response = binding.service(req);

1 个答案:

答案 0 :(得分:1)

感谢all.Finally我发现以下结果易于退出在LowFareSearch响应中,您可以在其他信息中找到AirSegments列表和AirPricingSolutions列表。每个AirPricingSolution都包含AirPricingInfo以及适用的SegmentRef键和BookingCode信息。每个SegmentRef键对应于AirSegment列表中的航班。这就是您如何知道哪些航班(AirSegments)对应于特定价格(AirPricingSolution)。