diff --git a/samples/airline/pom.xml b/samples/airline/pom.xml
index bce3bbaf..a9aff40e 100644
--- a/samples/airline/pom.xml
+++ b/samples/airline/pom.xml
@@ -267,43 +267,6 @@
spring-mock
test
-
-
- jdom
- jdom
-
-
- jaxen
- jaxen
- runtime
-
-
- dom4j
- dom4j
-
-
- jdom
- jdom
-
-
- xerces
- xmlParserAPIs
-
-
- xerces
- xercesImpl
-
-
- xom
- xom
-
-
-
-
- xalan
- xalan
- test
-
javax.servlet
@@ -335,7 +298,7 @@
org.hibernate
hibernate
- 3.2.1.ga
+ 3.2.4.sp1
commons-dbcp
@@ -371,6 +334,11 @@
1.0
runtime
+
+ aspectj
+ aspectjweaver
+ 1.5.3
+
org.acegisecurity
acegi-security
diff --git a/samples/airline/src/main/java/org/springframework/ws/samples/airline/domain/Flight.java b/samples/airline/src/main/java/org/springframework/ws/samples/airline/domain/Flight.java
index d5248a6a..a94b8ff2 100644
--- a/samples/airline/src/main/java/org/springframework/ws/samples/airline/domain/Flight.java
+++ b/samples/airline/src/main/java/org/springframework/ws/samples/airline/domain/Flight.java
@@ -21,6 +21,7 @@ import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
@@ -35,7 +36,7 @@ public class Flight implements Serializable {
@Id
@Column(name = "ID")
- @GeneratedValue
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "NUMBER")
diff --git a/samples/airline/src/main/java/org/springframework/ws/samples/airline/domain/Passenger.java b/samples/airline/src/main/java/org/springframework/ws/samples/airline/domain/Passenger.java
index 28d75be4..3aeb6282 100644
--- a/samples/airline/src/main/java/org/springframework/ws/samples/airline/domain/Passenger.java
+++ b/samples/airline/src/main/java/org/springframework/ws/samples/airline/domain/Passenger.java
@@ -19,6 +19,7 @@ import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
@@ -30,7 +31,7 @@ import javax.persistence.Table;
public class Passenger implements Serializable {
@Id
- @GeneratedValue
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "ID")
private Long id;
diff --git a/samples/airline/src/main/java/org/springframework/ws/samples/airline/domain/Ticket.java b/samples/airline/src/main/java/org/springframework/ws/samples/airline/domain/Ticket.java
index cc6abc5d..6eed2097 100644
--- a/samples/airline/src/main/java/org/springframework/ws/samples/airline/domain/Ticket.java
+++ b/samples/airline/src/main/java/org/springframework/ws/samples/airline/domain/Ticket.java
@@ -23,6 +23,7 @@ import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
@@ -38,7 +39,7 @@ import org.joda.time.LocalDate;
public class Ticket implements Serializable {
@Id
- @GeneratedValue
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "ISSUE_DATE")
diff --git a/samples/airline/src/main/java/org/springframework/ws/samples/airline/service/AirlineService.java b/samples/airline/src/main/java/org/springframework/ws/samples/airline/service/AirlineService.java
index c997e668..593d9f18 100644
--- a/samples/airline/src/main/java/org/springframework/ws/samples/airline/service/AirlineService.java
+++ b/samples/airline/src/main/java/org/springframework/ws/samples/airline/service/AirlineService.java
@@ -17,8 +17,10 @@ package org.springframework.ws.samples.airline.service;
import java.util.List;
+import org.acegisecurity.annotation.Secured;
import org.joda.time.DateTime;
import org.joda.time.LocalDate;
+import org.springframework.transaction.annotation.Transactional;
import org.springframework.ws.samples.airline.domain.Flight;
import org.springframework.ws.samples.airline.domain.FrequentFlyer;
import org.springframework.ws.samples.airline.domain.Passenger;
@@ -30,6 +32,7 @@ import org.springframework.ws.samples.airline.domain.Ticket;
*
* @author Arjen Poutsma
*/
+@Transactional(readOnly = true)
public interface AirlineService {
/**
@@ -69,6 +72,7 @@ public interface AirlineService {
* @see org.springframework.ws.samples.airline.domain.Passenger
* @see org.springframework.ws.samples.airline.domain.FrequentFlyer
*/
+ @Transactional(rollbackFor = {NoSuchFlightException.class, NoSeatAvailableException.class})
Ticket bookFlight(String flightNumber, DateTime departureTime, List passengers)
throws NoSuchFlightException, NoSeatAvailableException;
@@ -77,5 +81,6 @@ public interface AirlineService {
*
* @return the amount of frequent flyer miles
*/
+ @Secured({"ROLE_FREQUENT_FLYER"})
int getFrequentFlyerMileage();
}
diff --git a/samples/airline/src/main/java/org/springframework/ws/samples/airline/service/NoSuchFlightException.java b/samples/airline/src/main/java/org/springframework/ws/samples/airline/service/NoSuchFlightException.java
index d8ffbc5a..b79db40a 100644
--- a/samples/airline/src/main/java/org/springframework/ws/samples/airline/service/NoSuchFlightException.java
+++ b/samples/airline/src/main/java/org/springframework/ws/samples/airline/service/NoSuchFlightException.java
@@ -17,12 +17,15 @@
package org.springframework.ws.samples.airline.service;
import org.joda.time.DateTime;
+import org.springframework.ws.soap.server.endpoint.annotation.FaultCode;
+import org.springframework.ws.soap.server.endpoint.annotation.SoapFault;
/**
* Exception thrown when a specified flight cannot be found.
*
* @author Arjen Poutsma
*/
+@SoapFault(faultCode = FaultCode.CLIENT)
public class NoSuchFlightException extends Exception {
private String flightNumber;
diff --git a/samples/airline/src/main/java/org/springframework/ws/samples/airline/service/impl/AirlineServiceImpl.java b/samples/airline/src/main/java/org/springframework/ws/samples/airline/service/impl/AirlineServiceImpl.java
index d9710f42..155290b6 100644
--- a/samples/airline/src/main/java/org/springframework/ws/samples/airline/service/impl/AirlineServiceImpl.java
+++ b/samples/airline/src/main/java/org/springframework/ws/samples/airline/service/impl/AirlineServiceImpl.java
@@ -17,12 +17,10 @@ package org.springframework.ws.samples.airline.service.impl;
import java.util.List;
-import org.acegisecurity.annotation.Secured;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.joda.time.DateTime;
import org.joda.time.LocalDate;
-import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import org.springframework.ws.samples.airline.dao.FlightDao;
import org.springframework.ws.samples.airline.dao.TicketDao;
@@ -61,7 +59,6 @@ public class AirlineServiceImpl implements AirlineService {
this.frequentFlyerSecurityService = frequentFlyerSecurityService;
}
- @Transactional(rollbackFor = {NoSuchFlightException.class, NoSeatAvailableException.class})
public Ticket bookFlight(String flightNumber, DateTime departureTime, List passengers)
throws NoSuchFlightException, NoSeatAvailableException {
Assert.notEmpty(passengers, "No passengers given");
@@ -96,7 +93,6 @@ public class AirlineServiceImpl implements AirlineService {
return ticketDao.save(ticket);
}
- @Transactional(readOnly = true)
public Flight getFlight(Long id) throws NoSuchFlightException {
Flight flight = flightDao.getFlight(id);
if (flight != null) {
@@ -107,7 +103,6 @@ public class AirlineServiceImpl implements AirlineService {
}
}
- @Transactional(readOnly = true)
public List getFlights(String fromAirportCode,
String toAirportCode,
LocalDate departureDate,
@@ -127,9 +122,10 @@ public class AirlineServiceImpl implements AirlineService {
return flights;
}
- @Transactional(readOnly = true)
- @Secured({"ROLE_FREQUENT_FLYER"})
public int getFrequentFlyerMileage() {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Using " + frequentFlyerSecurityService + " for security");
+ }
FrequentFlyer frequentFlyer = frequentFlyerSecurityService.getCurrentlyAuthenticatedFrequentFlyer();
return frequentFlyer != null ? frequentFlyer.getMiles() : 0;
}
diff --git a/samples/airline/src/main/java/org/springframework/ws/samples/airline/ws/AirlineWebServiceConstants.java b/samples/airline/src/main/java/org/springframework/ws/samples/airline/ws/AirlineWebServiceConstants.java
index fe77510f..48590162 100644
--- a/samples/airline/src/main/java/org/springframework/ws/samples/airline/ws/AirlineWebServiceConstants.java
+++ b/samples/airline/src/main/java/org/springframework/ws/samples/airline/ws/AirlineWebServiceConstants.java
@@ -19,5 +19,13 @@ package org.springframework.ws.samples.airline.ws;
/** @author Arjen Poutsma */
public interface AirlineWebServiceConstants {
+ String BOOK_FLIGHT_REQUEST = "BookFlightRequest";
+
+ String GET_FLIGHTS_REQUEST = "GetFlightsRequest";
+
+ String GET_FREQUENT_FLYER_MILEAGE_RESPONSE = "GetFrequentFlyerMileageResponse";
+
String NAMESPACE = "http://www.springframework.org/spring-ws/samples/airline/schemas";
+
+ String GET_FREQUENT_FLYER_MILEAGE_REQUEST = "GetFrequentFlyerMileageRequest";
}
diff --git a/samples/airline/src/main/java/org/springframework/ws/samples/airline/ws/GetFrequentFlyerMileageEndpoint.java b/samples/airline/src/main/java/org/springframework/ws/samples/airline/ws/GetFrequentFlyerMileageEndpoint.java
new file mode 100644
index 00000000..64b9bf38
--- /dev/null
+++ b/samples/airline/src/main/java/org/springframework/ws/samples/airline/ws/GetFrequentFlyerMileageEndpoint.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2006 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.ws.samples.airline.ws;
+
+import org.springframework.ws.samples.airline.service.AirlineService;
+import org.springframework.ws.server.endpoint.AbstractDomPayloadEndpoint;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * Endpoint that returns the amount of frequent flyer miles for the currently logged in user. Secured via a WS-Security
+ * UsernameToken
+ *
+ * @author Arjen Poutsma
+ */
+public class GetFrequentFlyerMileageEndpoint extends AbstractDomPayloadEndpoint implements AirlineWebServiceConstants {
+
+ private final AirlineService airlineService;
+
+ public GetFrequentFlyerMileageEndpoint(AirlineService airlineService) {
+ this.airlineService = airlineService;
+ }
+
+ protected Element invokeInternal(Element ignored, Document responseDocument) throws Exception {
+ int mileage = airlineService.getFrequentFlyerMileage();
+ Element response = responseDocument.createElementNS(NAMESPACE, GET_FREQUENT_FLYER_MILEAGE_RESPONSE);
+ response.setTextContent(Integer.toString(mileage));
+ return response;
+ }
+}
\ No newline at end of file
diff --git a/samples/airline/src/main/java/org/springframework/ws/samples/airline/ws/MarshallingAirlineEndpoint.java b/samples/airline/src/main/java/org/springframework/ws/samples/airline/ws/MarshallingAirlineEndpoint.java
index 0a88f70b..3b8b9145 100644
--- a/samples/airline/src/main/java/org/springframework/ws/samples/airline/ws/MarshallingAirlineEndpoint.java
+++ b/samples/airline/src/main/java/org/springframework/ws/samples/airline/ws/MarshallingAirlineEndpoint.java
@@ -58,7 +58,7 @@ public class MarshallingAirlineEndpoint implements AirlineWebServiceConstants {
private static final Log logger = LogFactory.getLog(MarshallingAirlineEndpoint.class);
- private AirlineService airlineService;
+ private final AirlineService airlineService;
private ObjectFactory objectFactory = new ObjectFactory();
@@ -72,7 +72,7 @@ public class MarshallingAirlineEndpoint implements AirlineWebServiceConstants {
*
* @param request the JAXB2 representation of a <GetFlightsRequest>
*/
- @PayloadRoot(localPart = "GetFlightsRequest", namespace = NAMESPACE)
+ @PayloadRoot(localPart = GET_FLIGHTS_REQUEST, namespace = NAMESPACE)
public GetFlightsResponse getFlights(GetFlightsRequest request) throws DatatypeConfigurationException {
if (logger.isDebugEnabled()) {
logger.debug("Received GetFlightsRequest '" + request.getFrom() + "' to '" + request.getTo() + "' on " +
@@ -106,7 +106,7 @@ public class MarshallingAirlineEndpoint implements AirlineWebServiceConstants {
* @param request the JAXB2 representation of a <BookFlightRequest>
* @return the JAXB2 representation of a <BookFlightResponse>
*/
- @PayloadRoot(localPart = "BookFlightRequest", namespace = NAMESPACE)
+ @PayloadRoot(localPart = BOOK_FLIGHT_REQUEST, namespace = NAMESPACE)
public JAXBElement bookFlight(BookFlightRequest request)
throws NoSeatAvailableException, DatatypeConfigurationException, NoSuchFlightException {
if (logger.isDebugEnabled()) {
@@ -143,18 +143,4 @@ public class MarshallingAirlineEndpoint implements AirlineWebServiceConstants {
return SchemaConversionUtils.toSchemaType(domainTicket);
}
- /**
- * This endpoint method uses marshalling to handle message with a <GetFrequentFlyerMileageRequest>
- * payload.
- *
- * @param ignored is ignored
- * @return the JAXB2 representation of a <GetFrequentFlyerMileageResponse>
- */
- @PayloadRoot(localPart = "GetFrequentFlyerMileageRequest", namespace = NAMESPACE)
- public JAXBElement getFrequentFlyerMileage(JAXBElement ignored) {
- logger.debug("Received GetFrequentFlyerMileageRequest request");
- int result = airlineService.getFrequentFlyerMileage();
- return objectFactory.createGetFrequentFlyerMileageResponse(result);
- }
-
}
\ No newline at end of file
diff --git a/samples/airline/src/main/java/org/springframework/ws/samples/airline/ws/XPathAirlineEndpoint.java b/samples/airline/src/main/java/org/springframework/ws/samples/airline/ws/XPathAirlineEndpoint.java
index 552c86d8..89660f24 100644
--- a/samples/airline/src/main/java/org/springframework/ws/samples/airline/ws/XPathAirlineEndpoint.java
+++ b/samples/airline/src/main/java/org/springframework/ws/samples/airline/ws/XPathAirlineEndpoint.java
@@ -63,11 +63,11 @@ public class XPathAirlineEndpoint implements AirlineWebServiceConstants {
private static final Log logger = LogFactory.getLog(XPathAirlineEndpoint.class);
- private AirlineService airlineService;
+ private final AirlineService airlineService;
private ObjectFactory objectFactory = new ObjectFactory();
- private Marshaller marshaller;
+ private final Marshaller marshaller;
public XPathAirlineEndpoint(AirlineService airlineService, Marshaller marshaller) {
Assert.notNull(airlineService, "airlineService must not be null");
@@ -84,7 +84,7 @@ public class XPathAirlineEndpoint implements AirlineWebServiceConstants {
* @param departureDateString the string representation of the departure date
* @param serviceClassString the string representation of the service class
*/
- @PayloadRoot(localPart = "GetFlightsRequest", namespace = NAMESPACE)
+ @PayloadRoot(localPart = GET_FLIGHTS_REQUEST, namespace = NAMESPACE)
public Source getFlights(@XPathParam("//tns:from")String from,
@XPathParam("//tns:to")String to,
@XPathParam("//tns:departureDate")String departureDateString,
@@ -115,7 +115,7 @@ public class XPathAirlineEndpoint implements AirlineWebServiceConstants {
* @param passengerNodes the passenger nodes
* @param frequentFlyerNodes the frequent flyer nodes
*/
- @PayloadRoot(localPart = "BookFlightRequest", namespace = NAMESPACE)
+ @PayloadRoot(localPart = BOOK_FLIGHT_REQUEST, namespace = NAMESPACE)
public Source bookFlight(@XPathParam("//tns:flightNumber")String flightNumber,
@XPathParam("//tns:departureTime")String departureTimeString,
@XPathParam("//tns:passengers/tns:passenger")NodeList passengerNodes,
@@ -161,17 +161,5 @@ public class XPathAirlineEndpoint implements AirlineWebServiceConstants {
}
}
- /**
- * This endpoint method uses XPath to handle message with a <GetFrequentFlyerMileageRequest>
- * payload.
- */
- @PayloadRoot(localPart = "GetFrequentFlyerMileageRequest", namespace = NAMESPACE)
- public Source getFrequentFlyerMileage() {
- logger.debug("Received GetFrequentFlyerMileageRequest request");
- int result = airlineService.getFrequentFlyerMileage();
- JAXBElement response = objectFactory.createGetFrequentFlyerMileageResponse(result);
- return new MarshallingSource(marshaller, response);
- }
-
}
diff --git a/samples/airline/src/main/resources/org/springframework/ws/samples/airline/dao/jpa/applicationContext-jpa.xml b/samples/airline/src/main/resources/org/springframework/ws/samples/airline/dao/jpa/applicationContext-jpa.xml
index f61f2f49..e375f89b 100644
--- a/samples/airline/src/main/resources/org/springframework/ws/samples/airline/dao/jpa/applicationContext-jpa.xml
+++ b/samples/airline/src/main/resources/org/springframework/ws/samples/airline/dao/jpa/applicationContext-jpa.xml
@@ -25,7 +25,6 @@
-
diff --git a/samples/airline/src/main/resources/org/springframework/ws/samples/airline/security/applicationContext-security.xml b/samples/airline/src/main/resources/org/springframework/ws/samples/airline/security/applicationContext-security.xml
index fa31b9a3..1ed5f316 100644
--- a/samples/airline/src/main/resources/org/springframework/ws/samples/airline/security/applicationContext-security.xml
+++ b/samples/airline/src/main/resources/org/springframework/ws/samples/airline/security/applicationContext-security.xml
@@ -1,42 +1,30 @@
+ xmlns:aop="http://www.springframework.org/schema/aop"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+ http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
This application context contains the WS-Security and Acegi beans.
+
+
+
+
+
- A transactional security service used to obtain Frequent Flyer information.
+ A security service used to obtain Frequent Flyer information.
-
+
-
-
- This SOAP Action endpoint mapping is used for endpoints that are secured via WS-Security. It uses a
- securityInterceptor to validate incoming messages.
-
-
-
-
- getFrequentFlyerMileageEndpoint
-
-
-
-
-
-
-
-
-
-
-
This interceptor validates incoming messages according to the policy defined in 'securityPolicy.xml'.
@@ -53,6 +41,7 @@
+
@@ -76,7 +65,7 @@
-
+
diff --git a/samples/airline/src/main/resources/org/springframework/ws/samples/airline/service/applicationContext.xml b/samples/airline/src/main/resources/org/springframework/ws/samples/airline/service/applicationContext.xml
index 9d4b7bb7..bc49f28c 100644
--- a/samples/airline/src/main/resources/org/springframework/ws/samples/airline/service/applicationContext.xml
+++ b/samples/airline/src/main/resources/org/springframework/ws/samples/airline/service/applicationContext.xml
@@ -1,53 +1,22 @@
-
-
+
+ http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
+ http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
+
+ The Airline business service. It requires a flight DAO and ticket DAO to work. The
+ frequentFlyerSecurityService property is not required, so we use a property to configure it.
+
+
-
-
- The MessageFactory is used to create new SOAP messages from incoming requests. It is referenced to in
- airline-servlet.xml.
-
-
-
-
-
-
\ No newline at end of file
diff --git a/samples/airline/src/main/webapp/WEB-INF/web.xml b/samples/airline/src/main/webapp/WEB-INF/web.xml
index 1aada590..f3090845 100644
--- a/samples/airline/src/main/webapp/WEB-INF/web.xml
+++ b/samples/airline/src/main/webapp/WEB-INF/web.xml
@@ -10,9 +10,7 @@
classpath:org/springframework/ws/samples/airline/dao/jpa/applicationContext-jpa.xml
classpath:org/springframework/ws/samples/airline/service/applicationContext.xml
-
-
-
+ classpath:org/springframework/ws/samples/airline/security/applicationContext-security.xml
diff --git a/samples/airline/src/main/webapp/WEB-INF/ws-servlet.xml b/samples/airline/src/main/webapp/WEB-INF/ws-servlet.xml
index 0e6049f1..5b96e8df 100644
--- a/samples/airline/src/main/webapp/WEB-INF/ws-servlet.xml
+++ b/samples/airline/src/main/webapp/WEB-INF/ws-servlet.xml
@@ -8,23 +8,36 @@
+
+
+
+ This endpoint handles the Airline Web Service messages using JAXB2 marshalling.
+
+
+
+
+
-
+
- This endpoint handles the Airline Web Service messages using XPath expressions and JAXB2 marshalling.
+ This endpoint handles get frequent flyer mileage requests.
-
-
The JAXB 2 Marshaller is used by the endpoints.
@@ -33,9 +46,14 @@
-
+
+
Detects @PayloadRoot annotations on @Endpoint bean methods. The MarshallingAirlineEndpoint
@@ -52,10 +70,40 @@
+
+
+
+ This endpoint mapping is used for endpoints that are secured via WS-Security. It uses a
+ securityInterceptor, defined in applicationContext-security.xml, to validate incoming messages.
+
+
+
+
+ getFrequentFlyerMileageEndpoint
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
This adapter allows for methods that need and returns marshalled objects. The MarshallingEndpoint
@@ -75,25 +123,44 @@
+
+
+ This adapter allows for endpoints which implement the PayloadEndpoint interface. The Get
+ FrequentFlyerMileageEndpoint implements this interface.
+
+
+
+
+
+
+ This exception resolver maps exceptions with the @SoapFault annotation to SOAP Faults. The business logic
+ exceptions NoSeatAvailableException and NoSuchFlightException have these.
+
+
+
+
- This exception resolver maps exceptions to SOAP Faults. The business logic exceptions
- NoSeatAvailableException and NoSuchFlightException are explictely mapped. Both
- UnmarshallingException andValidationFailureException are mapped to a SOAP Fault with a "Sender" fault code.
+ This exception resolver maps other exceptions to SOAP Faults. Both UnmarshallingException and
+ ValidationFailureException are mapped to a SOAP Fault with a "Client" fault code.
All other exceptions are mapped to a "Server" error code, the default.
- CLIENT
- SERVER
CLIENT,Invalid request
CLIENT,Invalid request
+
diff --git a/samples/airline/src/test/java/org/springframework/ws/samples/airline/ws/GetFrequentFlyerMileageEndpointTest.java b/samples/airline/src/test/java/org/springframework/ws/samples/airline/ws/GetFrequentFlyerMileageEndpointTest.java
new file mode 100644
index 00000000..d30e3449
--- /dev/null
+++ b/samples/airline/src/test/java/org/springframework/ws/samples/airline/ws/GetFrequentFlyerMileageEndpointTest.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2007 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.ws.samples.airline.ws;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import junit.framework.TestCase;
+import static org.easymock.EasyMock.*;
+import org.springframework.ws.samples.airline.service.AirlineService;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+public class GetFrequentFlyerMileageEndpointTest extends TestCase {
+
+ private GetFrequentFlyerMileageEndpoint endpoint;
+
+ private AirlineService airlineServiceMock;
+
+ private Document document;
+
+ protected void setUp() throws Exception {
+ airlineServiceMock = createMock(AirlineService.class);
+ endpoint = new GetFrequentFlyerMileageEndpoint(airlineServiceMock);
+ DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
+ document = documentBuilder.newDocument();
+ }
+
+ public void testGetFrequentFlyerMileage() throws Exception {
+ expect(airlineServiceMock.getFrequentFlyerMileage()).andReturn(42);
+
+ replay(airlineServiceMock);
+
+ Element response = endpoint.invokeInternal(null, document);
+ assertNotNull("Invalid response", response);
+
+ verify(airlineServiceMock);
+ }
+
+}
\ No newline at end of file
diff --git a/samples/airline/src/test/java/org/springframework/ws/samples/airline/ws/MarshallingAirlineEndpointTest.java b/samples/airline/src/test/java/org/springframework/ws/samples/airline/ws/MarshallingAirlineEndpointTest.java
index 0cf8eda7..c99c5a56 100644
--- a/samples/airline/src/test/java/org/springframework/ws/samples/airline/ws/MarshallingAirlineEndpointTest.java
+++ b/samples/airline/src/test/java/org/springframework/ws/samples/airline/ws/MarshallingAirlineEndpointTest.java
@@ -189,16 +189,4 @@ public class MarshallingAirlineEndpointTest extends TestCase {
verify(airlineServiceMock);
}
- public void testGetFrequentFlyerMileage() throws Exception {
- JAXBElement request = objectFactory.createGetFrequentFlyerMileageRequest(null);
-
- expect(airlineServiceMock.getFrequentFlyerMileage()).andReturn(42);
-
- replay(airlineServiceMock);
-
- JAXBElement response = endpoint.getFrequentFlyerMileage(request);
- assertEquals("Invalid amount of miles received", 42, response.getValue().intValue());
-
- verify(airlineServiceMock);
- }
}
\ No newline at end of file
diff --git a/samples/airline/src/test/java/org/springframework/ws/samples/airline/ws/XPathAirlineEndpointTest.java b/samples/airline/src/test/java/org/springframework/ws/samples/airline/ws/XPathAirlineEndpointTest.java
index 4491b254..71f49ef0 100644
--- a/samples/airline/src/test/java/org/springframework/ws/samples/airline/ws/XPathAirlineEndpointTest.java
+++ b/samples/airline/src/test/java/org/springframework/ws/samples/airline/ws/XPathAirlineEndpointTest.java
@@ -69,16 +69,5 @@ public class XPathAirlineEndpointTest extends TestCase {
return domainFlight;
}
- public void testGetFrequentFlyerMileage() throws Exception {
- expect(airlineServiceMock.getFrequentFlyerMileage()).andReturn(42);
-
- replay(airlineServiceMock);
-
- Source response = endpoint.getFrequentFlyerMileage();
- assertNotNull("Invalid response", response);
-
- verify(airlineServiceMock);
- }
-
}
\ No newline at end of file