简体   繁体   中英

Check Format error response in Travelport Universal API AirCreateReservationReq

I am using the Travelport Universal API in Trial mode right now. My goal is to develop a Web Portal for handling B2B requirements of a client. All is well until I came to the second last step, ie Creating reservation (Booking). I have tried to fill the request object with all the required parameters and data by following the sample Soap request XML attached below: Sample XML Request

Following is the request code that I wrote to include the details as described in the sample xml request.

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

But when I send the request, I receive SoapException on the last line mentioned in the code above. The exception is: Ticketing application failed: CHECK FORMAT .

Usually the response always contains a clue on what is missing or what is not present in the request as per the expectation of the web service.

I have tried to add all the details in the request even if I don't require some of them, just to match the sample request but still this exception is not going away.

If I intentionally skip something that is mentioned as required in the documentation, I get an intelligible response mentioning the missing item or detail but not in the original case.

I would appreciate any thoughts which may lead me to the right direction.

Resolved the issue with some hit and trials. Posting here as an answer to help someone else looking for the same.

The error was given because of the ActionStatusType.TTL . It needed to be set to ActionStatusType.TAW . TAW stands for TicketAtWill .

By changing that my error was changed to *0 AVAIL/WL Closed* . But it was because there were no flights available for booking for the input criteria. Changing the criteria to more extended Departure and Return dates, I got a valid response with reservation details.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM