2

我现在在试用模式下使用Travelport 通用 API 。我的目标是开发一个 Web 门户来处理客户的 B2B 需求。一切都很好,直到我来到最后一步,即创建预订(Booking)。我已尝试按照下面附加的示例 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 服务的期望,通常响应总是包含关于请求中缺少什么或不存在什么的线索。

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

如果我故意跳过文档中提到的某些内容,我会得到一个清晰的回复,其中提到了缺失的项目或细节,但不是在原始案例中。

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

4

1 回答 1

5

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

由于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"
    }
 },
于 2014-12-01T21:18:02.533 回答