/**
   * This endpoint method uses a combination of XPath expressions and marshalling to handle message
   * with a <code>&lt;GetFlightsRequest&gt;</code> payload.
   *
   * @param from the from airport
   * @param to the to airport
   * @param departureDateString the string representation of the departure date
   * @param serviceClassString the string representation of the service class
   * @return the JAXB2 representation of a <code>&lt;GetFlightsResponse&gt;</code>
   */
  @PayloadRoot(localPart = GET_FLIGHTS_REQUEST, namespace = MESSAGES_NAMESPACE)
  @Namespace(prefix = "m", uri = MESSAGES_NAMESPACE)
  @ResponsePayload
  public GetFlightsResponse getFlights(
      @XPathParam("//m:from") String from,
      @XPathParam("//m:to") String to,
      @XPathParam("//m:departureDate") String departureDateString,
      @XPathParam("//m:serviceClass") String serviceClassString)
      throws DatatypeConfigurationException {
    if (logger.isDebugEnabled()) {
      logger.debug(
          "Received GetFlightsRequest '" + from + "' to '" + to + "' on " + departureDateString);
    }
    LocalDate departureDate = new LocalDate(departureDateString);
    ServiceClass serviceClass = null;
    if (StringUtils.hasLength(serviceClassString)) {
      serviceClass = ServiceClass.valueOf(serviceClassString.toUpperCase());
    }
    List<org.springframework.ws.samples.airline.domain.Flight> flights =
        airlineService.getFlights(from, to, departureDate, serviceClass);

    GetFlightsResponse response = objectFactory.createGetFlightsResponse();
    for (org.springframework.ws.samples.airline.domain.Flight domainFlight : flights) {
      response.getFlight().add(SchemaConversionUtils.toSchemaType(domainFlight));
    }
    return response;
  }
 @PayloadRoot(localPart = GET_FREQUENT_FLYER_MILEAGE_REQUEST, namespace = MESSAGES_NAMESPACE)
 @ResponsePayload
 public Element getFrequentFlyerMileage() throws Exception {
   if (logger.isDebugEnabled()) {
     logger.debug("Received GetFrequentFlyerMileageRequest");
   }
   int mileage = airlineService.getFrequentFlyerMileage();
   DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
   Document document = documentBuilder.newDocument();
   Element response =
       document.createElementNS(MESSAGES_NAMESPACE, GET_FREQUENT_FLYER_MILEAGE_RESPONSE);
   response.setTextContent(Integer.toString(mileage));
   return response;
 }
 /** Converts between the domain and schema types. */
 private Ticket bookSchemaFlight(
     String flightNumber,
     XMLGregorianCalendar xmlDepartureTime,
     List<Object> passengerOrUsernameList)
     throws NoSeatAvailableException, NoSuchFlightException, NoSuchFrequentFlyerException,
         DatatypeConfigurationException {
   DateTime departureTime = SchemaConversionUtils.toDateTime(xmlDepartureTime);
   List<Passenger> passengers = new ArrayList<Passenger>(passengerOrUsernameList.size());
   for (Iterator<Object> iterator = passengerOrUsernameList.iterator(); iterator.hasNext(); ) {
     Object passengerOrUsername = iterator.next();
     if (passengerOrUsername instanceof Name) {
       Name passengerName = (Name) passengerOrUsername;
       Passenger passenger = new Passenger(passengerName.getFirst(), passengerName.getLast());
       passengers.add(passenger);
     } else if (passengerOrUsername instanceof String) {
       String frequentFlyerUsername = (String) passengerOrUsername;
       FrequentFlyer frequentFlyer = new FrequentFlyer(frequentFlyerUsername);
       passengers.add(frequentFlyer);
     }
   }
   org.springframework.ws.samples.airline.domain.Ticket domainTicket =
       airlineService.bookFlight(flightNumber, departureTime, passengers);
   return SchemaConversionUtils.toSchemaType(domainTicket);
 }