检查 Travelport Universal API AirCreateReservationReq 中的格式错误响应



我现在正在试用模式下使用Travelport通用API。我的目标是开发一个用于处理客户的B2B需求的Web门户。一切都很好,直到我来到倒数第二步,即创建预订(预订(。我尝试按照下面附加的示例 Soap 请求 XML 填充请求对象:示例 XML 请求

下面是我编写的请求代码,用于包含示例 xml 请求中所述的详细信息。

var biPoint3 = new BillingPointOfSaleInfo { OriginApplication =      Crediantels.oritionApplication };
var delevieryInfo = new DeliveryInfo
        {
            Email = new Email { EmailID = "test@travelport.com", Type = "Home" },
            PhoneNumber = new PhoneNumber
            {
                CountryCode = "069",
                AreaCode = "49",
                Number = "261111111",
                Type = PhoneNumberType.Mobile,
                Location = "FRA"
            },
            ShippingAddress = new DeliveryInfoShippingAddress
            {
                City = "Como",
                Country = "IT",
                PostalCode = "22100",
                Street = new[] { "Some Street" }
            },
        };
        var travelerDetails = new BookingTraveler
        {
            Key = "0",
            DOB = new DateTime(1976, 11, 18),
            Gender = "M",
            TravelerType = "ADT",
            BookingTravelerName = new BookingTravelerName
            {
                First = "Frederick",
                Last = "Heinrich",
                Prefix = "Herr"
            },
            Address = new[]
            {
                new typeStructuredAddress
                {
                    AddressName = "Smiths",
                    City = "Frankfurt",
                    Country = "DE",
                    PostalCode = "60311",
                    Street = new[] {"Rossmarkt 6"},
                    State = new State {Value = "Hesse"}
                }
            },
            DeliveryInfo = new[]
            {
                new DeliveryInfo
                {
                    Email = new Email {EmailID = "test@travelport.com", Type = "Home"},
                    PhoneNumber = new PhoneNumber
                    {
                        CountryCode = "069",
                        AreaCode = "49",
                        Number = "261111111",
                        Type = PhoneNumberType.Mobile,
                        Location = "FRA"
                    },
                    ShippingAddress = new DeliveryInfoShippingAddress
                    {
                        City = "Frankfurt",
                        Country = "DE",
                        PostalCode = "60311",
                        Street = new[] {"Rossmarkt 6"}
                    }
                }
            },
            Email = new[] { new Email { Type = "Home", EmailID = "test@travelport.com" } },
            PhoneNumber = new[]
            {
                new PhoneNumber
                {
                    CountryCode = "069",
                    AreaCode = "49",
                    Number = "261111111",
                    Type = PhoneNumberType.Mobile,
                    Location = "FRA"
                }
            }
        };
        var reservationRequest = new AirCreateReservationReq
        {
            BillingPointOfSaleInfo = biPoint3,
            TargetBranch = Crediantels.targetBranch,
            AirPricingSolution = airPriceResponse.AirPriceResult[0].AirPricingSolution[0],
            DeliveryInfo = delevieryInfo,
            BookingTraveler = new[] { travelerDetails },
            FormOfPayment = new[]
            {
                new FormOfPayment
                {
                    Type = "Cash",
                    Key = "jwt2mcK1Qp27I2xfpcCtAw=="
                }
            },
            ActionStatus = new[]
            {
                new ActionStatus
                {
                    Type = ActionStatusType.TTL,
                    TicketDate = "2014-12-07T00:00:00",
                    ProviderCode = "1G",
                    QueueCategory = "01"
                }
            },
            AuthorizedBy = "myself",
            RetainReservation = typeRetainReservation.Both,
            TraceId = "1234"
        };
        if (reservationRequest.AirPricingSolution.AirSegmentRef != null)
        {
            var airSegmentRef = reservationRequest.AirPricingSolution.AirSegmentRef[0].Key;
            reservationRequest.AirPricingSolution.AirSegment = new[] { GetAirSegmentByKey(airPriceResponse, airSegmentRef) };
        }
        reservationRequest.AirPricingSolution.AirSegmentRef = null;
        reservationRequest.AirPricingSolution.AirPricingInfo[0].PassengerType[0].BookingTravelerRef = "0";
        var reservationBinding = new AirCreateReservationBinding
        {
            Url = Crediantels.url,
            Credentials = new NetworkCredential(Crediantels.userName, Crediantels.password)
        };
        //SoapException on the following line
        var airReservationResponse = reservationBinding.service(reservationRequest); 

但是当我发送请求时,我在上面代码中提到的最后一行收到 SoapException。例外情况是:Ticketing application failed: CHECK FORMAT .

通常,根据 Web 服务的期望,响应始终包含有关请求中缺少的内容或不存在的内容的线索。

即使我不需要其中一些,我也尝试在请求中添加所有详细信息,只是为了匹配示例请求,但此异常仍然不会消失。

如果我故意跳过文档中要求提及的内容,我会得到一个可理解的响应,提及缺少的项目或细节,但不是在原始情况下。

我将不胜感激任何可能引导我走向正确方向的想法。

通过一些点击和试用解决了这个问题。在这里发布作为答案,以帮助其他人寻找相同的答案。

由于ActionStatusType.TTL而给出错误。它需要设置为 ActionStatusType.TAW .TAW 代表 TicketAtWill .

通过更改我的错误更改为*0 AVAIL/WL Closed*.但这是因为没有可供预订的航班符合输入标准。将标准更改为更延长的出发和返回日期,我收到了包含预订详细信息的有效回复。

ActionStatus = new[]
{
    new ActionStatus
    {
        Type = ActionStatusType.TAW, ***
        TicketDate = "2014-12-07T00:00:00",
        ProviderCode = "1G",
        QueueCategory = "01"
    }
 },

相关内容

  • 没有找到相关文章

最新更新