【问题标题】:Travelport uAPI SoapClient response issueTravelport uAPI SoapClient 响应问题
【发布时间】:2014-03-25 08:53:15
【问题描述】:

我是 travelport 通用 API 的新手。我收到来自 api 的响应。我执行低票价搜索,作为响应,票价信息和航班信息在两个不同的列表中返回。问题是我在这些列表中找不到任何关系。以及解码 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);

【问题讨论】:

  • 您的具体问题是什么? response的类型是什么?
  • 响应由多个列表组成,我想知道解码这些列表或将其转换为数据表或数据集的最佳方法是什么
  • 为什么要转换它们?照原样处理它们。
  • 我必须找到关系,因为我说数组列表的长度不同,而且我还没有使用数组列表
  • 你应该更清楚你的问题是什么。如果两个列表之间存在关系,那么服务肯定必须返回足够的信息,以便您清楚地确定关系。例如,一个列表必须包含另一个列表中的关键字段。正如您所写的那样,您的问题并未描述您遇到的问题。您应该编辑您的问题并添加一个明确的问题陈述。实际上,听起来您甚至不知道如何获取结果对象的属性。

标签: c# web-services wcf wsdl travelport-api


【解决方案1】:

感谢所有。最后,我发现下面的结果很容易事实上在 LowFareSearch 响应中,您会返回其他信息中的 AirSegments 列表和 AirPricingSolutions 列表。每个 AirPricingSolution 都包含 AirPricingInfo 以及适用的 SegmentRef 键和 BookingCode 信息。每个 SegmentRef 键对应于 AirSegment 列表中的一个航班。这就是您知道哪些航班 (AirSegments) 对应于特定价格 (AirPricingSolution) 的方式。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-11-17
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多