-1

我正在研究 Expedia 酒店 API。除预订外,所有功能都在工作。所有其他请求都使用 GET 方法进行请求。但在预订时,我们必须使用具有不同 URL 的 POST 方法。所以我更改了请求的 URL,但仍然得到错误。我的代码是

 HotelServicesImplService client = new HotelServicesImplService();
    HotelRoomReservationRequest bookreq = new HotelRoomReservationRequest();
    HotelRoomReservationResponse bookres = new HotelRoomReservationResponse();
    addressInfo bookad = new addressInfo();
    reservationInfo bookinfo = new reservationInfo();
    client.Url = "https://book.api.ean.com/ean-services/rs/hotel/v3";

    //bookreq.minorRevSpecified = true;
    //bookreq.minorRev = 25;
    bookreq.hotelId = 106347;
    bookreq.apiKey = "api";
    bookreq.cid = "cid";
    bookreq.arrivalDate = "12/11/2013";
    bookreq.departureDate = "12/13/2013";
    bookreq.supplierType = SupplierType.E;
    bookreq.rateKey = "af00b688-acf4-409e-8bdc-fcfc3d1cb80c";
    bookreq.roomTypeCode = "198058";
    bookreq.rateCode = "484072";
    bookreq.RoomGroup = new[] { new Room
    {
        numberOfAdults=Convert.ToInt32(2),
        numberOfChildren=Convert.ToInt32(0),
        childAges=new int[] {} ,
        firstName="Test Booking",
        lastName="Test Booking",
        bedTypeId="23",
        smokingPreference=SmokingPreference.NS,
    }};
    float i = float.Parse("231.18");
    bookreq.currencyCode = "USD";
    bookreq.chargeableRate = i;
    bookinfo.email = "ranaabhi007@yahoo.com";
    bookinfo.firstName = "TestBooking";
    bookinfo.lastName = "TestBooking";
    bookinfo.homePhone = "2145370159";
    bookinfo.workPhone = "2145370159";
    bookinfo.creditCardType = "CA";
    bookinfo.creditCardNumber = "5401999999999999";
    bookinfo.creditCardIdentifier = "TestBooking";
    bookinfo.creditCardExpirationMonth = "12";
    bookinfo.creditCardExpirationYear = "2015";
    bookad.city = "Seattle";
    bookad.stateProvinceCode = "WA";
    bookad.countryCode = "US";
    bookad.postalCode = "98004";
    bookreq.ReservationInfo = bookinfo;
    bookad.address1 = "travelnow";
    //bookad.city = txtCity.Text;
    //bookad.stateProvinceCode = txtState.Text;
    //bookad.countryCode = txtCountry.Text;
    //bookad.postalCode = txtPostal.Text;
    bookreq.AddressInfo = bookad;
    bookres = client.getReservation(bookreq);
   // HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(client);
    Response.Write(bookres.confirmationNumbers);
    Response.Write(bookres.departureDate);
    Response.Write(bookres.drivingDirections);
    Response.Write(bookres.CouponInformationResponse);

但我仍然收到错误

The request failed with HTTP status 404: Not Found.
4

1 回答 1

0

你确定你的网址是正确的吗?根据文档,它应该是

https://book.api.ean.com/ean-services/rs/hotel/v3/res
于 2013-11-12T05:10:05.630 回答