예제 #1
0
  @Override
  public String getHotelParams() {
    // TODO Auto-generated method stub
    final XmlNode hotelAvailNode = new XmlNode("ns:OTA_HotelAvailRQ");
    hotelAvailNode.putAttribute("Version", "1.0");
    hotelAvailNode.putAttribute("TimeStamp", "2013-02-27T18:26:00.000+08:00"); // 还是用当前日期

    final XmlNode availRequestSegmentsNode = new XmlNode("ns:AvailRequestSegments");
    hotelAvailNode.addChildNode(availRequestSegmentsNode);

    final XmlNode availRequestSegmentNode = new XmlNode("ns:AvailRequestSegment");
    availRequestSegmentsNode.addChildNode(availRequestSegmentNode);

    final XmlNode hotelSearchCriteriaNode = new XmlNode("ns:HotelSearchCriteria");
    availRequestSegmentNode.addChildNode(hotelSearchCriteriaNode);

    final XmlNode criterionNode = new XmlNode("ns:Criterion");
    hotelSearchCriteriaNode.addChildNode(criterionNode);

    final XmlNode hotelRefNode = new XmlNode("ns:HotelRef");
    hotelRefNode.putAttribute("HotelCode", getHotelCode());
    criterionNode.addChildNode(hotelRefNode);

    final XmlNode stayDateRangeNode = new XmlNode("ns:StayDateRange");
    stayDateRangeNode.putAttribute("Start", getStartTime());
    stayDateRangeNode.putAttribute("End", getEndTime());
    criterionNode.addChildNode(stayDateRangeNode);

    final XmlNode ratePlanCandidatesNode = new XmlNode("ns:RatePlanCandidates");
    criterionNode.addChildNode(ratePlanCandidatesNode);

    final XmlNode RatePlanCandidateNode = new XmlNode("ns:RatePlanCandidate");
    RatePlanCandidateNode.putAttribute("RatePlanCode", getRatePlanCode());
    ratePlanCandidatesNode.addChildNode(RatePlanCandidateNode);

    final XmlNode roomStayCandidatesNode = new XmlNode("ns:RoomStayCandidates");
    criterionNode.addChildNode(roomStayCandidatesNode);

    final XmlNode roomStayCandidateNode = new XmlNode("ns:RoomStayCandidate");
    roomStayCandidateNode.putAttribute("Quantity", getQuantity());
    roomStayCandidatesNode.addChildNode(roomStayCandidateNode);

    final XmlNode guestCountsNode = new XmlNode("ns:GuestCounts");
    guestCountsNode.putAttribute("IsPerRoom", String.valueOf(getIsPerRoom()));
    roomStayCandidateNode.addChildNode(guestCountsNode);

    final XmlNode guestCountNode = new XmlNode("ns:GuestCount");
    guestCountNode.putAttribute("Count", getCount());
    guestCountsNode.addChildNode(guestCountNode);

    final XmlNode tPAExtensionsNode = new XmlNode("ns:TPA_Extensions");
    criterionNode.addChildNode(tPAExtensionsNode);

    final XmlNode lateArrivalTimeNode = new XmlNode("ns:LateArrivalTime");
    lateArrivalTimeNode.setInnerValue(getLateArrivalTime());
    tPAExtensionsNode.addChildNode(lateArrivalTimeNode);

    if (Log.D) {
      Log.d(TAG, hotelAvailNode.toString());
    }
    return hotelAvailNode.toString();
  }
예제 #2
0
  @Override
  public String getHotelParams() {
    // TODO Auto-generated method stub

    final XmlNode hotelResNode = new XmlNode("ns:OTA_HotelResRQ");
    hotelResNode.putAttribute("Version", "1.0");
    hotelResNode.putAttribute("TimeStamp", "2013-03-12T18:26:00.000+08:00"); // 还是用当前日期

    for (int i = 0; i < getUniqueIDList().size(); i++) {
      final XmlNode uniqueIDNode = new XmlNode("ns:UniqueID");
      uniqueIDNode.putAttribute("Type", getUniqueIDList().get(i).getType());
      uniqueIDNode.putAttribute("ID", getUniqueIDList().get(i).getId());
      hotelResNode.addChildNode(uniqueIDNode);
    }

    final XmlNode hotelReservationsNode = new XmlNode("ns:HotelReservations");
    hotelResNode.addChildNode(hotelReservationsNode);

    final XmlNode hotelReservationNode = new XmlNode("ns:HotelReservation");
    hotelReservationsNode.addChildNode(hotelReservationNode);

    final XmlNode roomStaysNode = new XmlNode("ns:RoomStays");
    hotelReservationNode.addChildNode(roomStaysNode);
    final XmlNode roomStayNode = new XmlNode("ns:RoomStay");
    roomStaysNode.addChildNode(roomStayNode);

    final XmlNode roomTypesNode = new XmlNode("ns:RoomTypes");
    roomStayNode.addChildNode(roomTypesNode);
    final XmlNode roomTypeNode = new XmlNode("ns:RoomType");
    roomTypeNode.putAttribute("NumberOfUnits", getNumberOfUnits());
    roomTypesNode.addChildNode(roomTypeNode);

    final XmlNode roomPlansNode = new XmlNode("ns:RatePlans");
    roomStayNode.addChildNode(roomPlansNode);
    final XmlNode roomPlanNode = new XmlNode("ns:RatePlan");
    roomPlanNode.putAttribute("RatePlanCode", getRatePlanCode());
    roomPlansNode.addChildNode(roomPlanNode);

    final XmlNode basicPropertyInfoNode = new XmlNode("ns:BasicPropertyInfo");
    basicPropertyInfoNode.putAttribute("HotelCode", getHotelCode());
    roomStayNode.addChildNode(basicPropertyInfoNode);

    final XmlNode resGuestsNode = new XmlNode("ns:ResGuests");
    hotelReservationNode.addChildNode(resGuestsNode);
    final XmlNode resGuestNode = new XmlNode("ns:ResGuest");
    resGuestNode.putAttribute("ArrivalTime", getArrivalTime());
    resGuestsNode.addChildNode(resGuestNode);

    final XmlNode profilesNode = new XmlNode("ns:Profiles");
    resGuestNode.addChildNode(profilesNode);
    final XmlNode profileInfoNode = new XmlNode("ns:ProfileInfo");
    profilesNode.addChildNode(profileInfoNode);
    final XmlNode profileNode = new XmlNode("ns:Profile");
    profileInfoNode.addChildNode(profileNode);

    final XmlNode customerNode = new XmlNode("ns:Customer");
    profileNode.addChildNode(customerNode);
    final XmlNode personNameNode = new XmlNode("ns:PersonName");
    customerNode.addChildNode(personNameNode);
    final XmlNode surNameNode = new XmlNode("ns:Surname");
    surNameNode.setInnerValue(getCustomer().getCustomerSurname());
    personNameNode.addChildNode(surNameNode);

    final XmlNode contactPersonNode = new XmlNode("ns:ContactPerson");
    contactPersonNode.putAttribute("ContactType", getCustomer().getContactType());
    customerNode.addChildNode(contactPersonNode);
    final XmlNode personName2Node = new XmlNode("ns:PersonName");
    contactPersonNode.addChildNode(personName2Node);
    final XmlNode surName2Node = new XmlNode("ns:Surname");
    surName2Node.setInnerValue(getCustomer().getContactSurname());
    personName2Node.addChildNode(surNameNode);
    final XmlNode telephoneNode = new XmlNode("ns:Telephone");
    telephoneNode.putAttribute("PhoneNumber", getCustomer().getPhoneNumber());
    telephoneNode.putAttribute("PhoneTechType", getCustomer().getPhoneTechType());
    contactPersonNode.addChildNode(telephoneNode);

    final XmlNode extensionsNode = new XmlNode("ns:TPA_Extensions");
    resGuestNode.addChildNode(extensionsNode);
    final XmlNode lateArrivalTimeNode = new XmlNode("ns:LateArrivalTime");
    lateArrivalTimeNode.setInnerValue(getLateArrivalTime());
    System.out.println("XC time" + getLateArrivalTime());
    extensionsNode.addChildNode(lateArrivalTimeNode);

    final XmlNode resGlobalInfoNode = new XmlNode("ns:ResGlobalInfo");
    hotelReservationNode.addChildNode(resGlobalInfoNode);
    final XmlNode guestCountsNode = new XmlNode("ns:GuestCounts");
    guestCountsNode.putAttribute("IsPerRoom", String.valueOf(isPerRoom()));
    resGlobalInfoNode.addChildNode(guestCountsNode);
    final XmlNode guestCountNode = new XmlNode("ns:GuestCount");
    guestCountNode.putAttribute("Count", getGuestCount());
    guestCountsNode.addChildNode(guestCountNode);

    final XmlNode timeSpanNode = new XmlNode("ns:TimeSpan");
    timeSpanNode.putAttribute("Start", getStart());
    timeSpanNode.putAttribute("End", getEnd());
    resGlobalInfoNode.addChildNode(timeSpanNode);

    final XmlNode specialRequestsNode = new XmlNode("ns:SpecialRequests");
    resGlobalInfoNode.addChildNode(specialRequestsNode);
    final XmlNode specialRequestNode = new XmlNode("ns:SpecialRequest");
    specialRequestsNode.addChildNode(specialRequestNode);
    final XmlNode textNode = new XmlNode("ns:Text");
    specialRequestNode.addChildNode(textNode);

    // DepositPayments可选的

    final XmlNode totalNode = new XmlNode("ns:Total");
    totalNode.putAttribute("AmountBeforeTax", getTotalAmountBeforeTax());
    totalNode.putAttribute("CurrencyCode", getTotalCurrencyCode());
    resGlobalInfoNode.addChildNode(totalNode);

    // CancelPenalties可选的
    System.out.println("XC hotelResRequest:" + hotelResNode.toString());
    return hotelResNode.toString();
  }
  @Override
  public String getHotelParams() {
    // TODO Auto-generated method stub
    final XmlNode descriptionRQNode = new XmlNode("OTA_HotelDescriptiveInfoRQ");
    descriptionRQNode.putAttribute("Version", "1.0");
    descriptionRQNode.putAttribute(
        "xsi:schemaLocation",
        "http://www.opentravel.org/OTA/2003/05 OTA_HotelDescriptiveInfoRQ.xsd");
    descriptionRQNode.putAttribute("xmlns", "http://www.opentravel.org/OTA/2003/05");
    descriptionRQNode.putAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");

    final XmlNode descriptionInfosNode = new XmlNode("HotelDescriptiveInfos");
    descriptionRQNode.addChildNode(descriptionInfosNode);

    final XmlNode descriptionInfoNode = new XmlNode("HotelDescriptiveInfo");
    descriptionInfoNode.putAttribute("HotelCode", getHotelCode());
    descriptionInfosNode.addChildNode(descriptionInfoNode);

    final XmlNode hotelInfoNode = new XmlNode("HotelInfo");
    hotelInfoNode.putAttribute("SendData", String.valueOf(getSendHotelInfoData()));
    descriptionInfoNode.addChildNode(hotelInfoNode);

    final XmlNode facilityInfoNode = new XmlNode("FacilityInfo");
    facilityInfoNode.putAttribute("SendGuestRooms", String.valueOf(getSendFacilityGuestRooms()));
    descriptionInfoNode.addChildNode(facilityInfoNode);

    final XmlNode areaInfoNode = new XmlNode("AreaInfo");
    areaInfoNode.putAttribute("SendAttractions", String.valueOf(getSendAttractions()));
    areaInfoNode.putAttribute("SendRecreations", String.valueOf(getSendRecreations()));
    descriptionInfoNode.addChildNode(areaInfoNode);

    final XmlNode contactInfoNode = new XmlNode("ContactInfo");
    contactInfoNode.putAttribute("SendData", String.valueOf(getSendContactData()));
    descriptionInfoNode.addChildNode(contactInfoNode);

    final XmlNode multimediaObjects = new XmlNode("MultimediaObjects");
    multimediaObjects.putAttribute("SendData", String.valueOf(getSendMultimediaData()));
    descriptionInfoNode.addChildNode(multimediaObjects);

    return descriptionRQNode.toString();
  }
 @Override
 public String getFlightProductParams() {
   XmlNode GetAirlineInfosRequestNode = new XmlNode("GetAirlineInfosRequest");
   GetAirlineInfosRequestNode.addNodeByNameAndValue("AirportCode", getAirLine());
   return GetAirlineInfosRequestNode.toString();
 }