2014-03-25 54 views
0

我是travelport universal api的新手。我收到來自API的迴應。我執行LOW FARE SEARCH,並將票價信息和航班信息返回到兩個不同的列表中。問題是我沒有在這些LIST中找到任何關係。還有什麼是解碼WSDL響應的最佳途徑。我使用WSDL以下是我的代碼Travelport uAPI SoapClient響應問題

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); 
+0

您確切的問題是什麼?什麼是「響應」類型? –

+0

響應由多個列表組成,並且我想知道什麼是解碼這些列表或將其轉換爲數據表或數據集的最佳方法 – Tanveer

+0

爲什麼要轉換它們?現在就處理它們。 –

回答

0

由於all.Finally我發現結果是低於戒菸容易,其實在你以及其他信息回AirSegments的列表,並AirPricingSolutions的列表LowFareSearch響應。每個AirPricingSolution包含AirPricingInfo和適用的SegmentRef鍵和BookingCode信息。每個SegmentRef鍵都對應於AirSegment列表中的航班。這就是您如何知道哪些航班(AirSegments)對應特定的價格(AirPricingSolution)。