From 6a169a49bcddfcc62bc4b64b06d8d24b014a51db Mon Sep 17 00:00:00 2001 From: Arjen Poutsma Date: Sun, 8 Oct 2006 16:36:59 +0000 Subject: [PATCH] Echo sample now uses MessageDispatcherServlet; airline sample uses WsdlDefinitionHandlerAdapter --- .../ws/soap/SoapMessageDispatcher.java | 9 +-- .../airline/ws/applicationContext-ws.xml | 52 ++++++++++++----- .../main/webapp/WEB-INF/airline-servlet.xml | 13 +++++ .../airline/src/main/webapp/WEB-INF/web.xml | 8 +-- .../webapp/WEB-INF/applicationContext.xml | 56 ------------------- .../main/webapp/WEB-INF/spring-ws-servlet.xml | 52 ++++++++++------- samples/echo/src/main/webapp/WEB-INF/web.xml | 21 ++----- 7 files changed, 94 insertions(+), 117 deletions(-) delete mode 100755 samples/echo/src/main/webapp/WEB-INF/applicationContext.xml diff --git a/core/src/main/java/org/springframework/ws/soap/SoapMessageDispatcher.java b/core/src/main/java/org/springframework/ws/soap/SoapMessageDispatcher.java index feb98f09..459cc7e0 100644 --- a/core/src/main/java/org/springframework/ws/soap/SoapMessageDispatcher.java +++ b/core/src/main/java/org/springframework/ws/soap/SoapMessageDispatcher.java @@ -71,14 +71,11 @@ public class SoapMessageDispatcher extends MessageDispatcher { } /** - * Initialize the default implementations for the dispatcher's strategies: MessageEndpointAdapter and - * PayloadEndpointAdapter as endpoint adapters, and a SimpleSoapExceptionResolver as - * exception resolver. + * Initialize the default implementations for the dispatcher's strategies, in addition to the strategies defined in + * the base class: a SimpleSoapExceptionResolver as exception resolver. * - * @see #setEndpointAdapters(java.util.List) + * @see org.springframework.ws.MessageDispatcher#initDefaultStrategies() * @see #setEndpointExceptionResolvers(java.util.List) - * @see org.springframework.ws.endpoint.MessageEndpointAdapter - * @see org.springframework.ws.endpoint.PayloadEndpointAdapter * @see org.springframework.ws.soap.endpoint.SimpleSoapExceptionResolver */ protected void initDefaultStrategies() { diff --git a/samples/airline/src/main/resources/org/springframework/ws/samples/airline/ws/applicationContext-ws.xml b/samples/airline/src/main/resources/org/springframework/ws/samples/airline/ws/applicationContext-ws.xml index 88511404..5f6a416d 100644 --- a/samples/airline/src/main/resources/org/springframework/ws/samples/airline/ws/applicationContext-ws.xml +++ b/samples/airline/src/main/resources/org/springframework/ws/samples/airline/ws/applicationContext-ws.xml @@ -3,11 +3,15 @@ - This application context contains the Spring-WS beans. + This application context contains the Spring-WS beans. + - The MessageDispatcher is responsible for routing messages to endpoints. + The MessageDispatcher is responsible for routing messages to endpoints. It uses three endpoint mappings to + determine the endpoint suitable for handling a particular incoming request. This is not a recommended + approach, it's done here only for illustration purposes. + @@ -23,16 +27,26 @@ + + + This bean definition represents the airline.wsdl file found in the root of the web application. It is used + by the WsdlDefinitionHandlerAdapter in airline-servlet.xml. + + + + This endpoint mapping uses the qualified name of the payload (body contents) to determine the endpoint for an incoming message. The name GetFlightsRequest with namespace http://www.springframework.org/spring-ws/samples/airline/schemas is mapped to the getFlightsEndpoint. - Additionally, messages are logged using the logging interceptor. + Additionally, messages are logged using the logging interceptor. + - getFlightsEndpoint + getFlightsEndpoint + @@ -44,11 +58,13 @@ This endpoint mapping uses SOAP Actions to determine the endpoint for an incoming message. The key http://www.springframework.org/spring-ws/samples/airline/BookFlight is mapped to the bookFlightEndpoint. - Additionally, message are logged and validated. + Additionally, message are logged and validated. + - bookFlightEndpoint + bookFlightEndpoint + @@ -62,7 +78,8 @@ This interceptor validates both incoming and outgoing message contents according to the 'airline.xsd' XML - Schema file. + Schema file. + @@ -70,18 +87,21 @@ - This interceptor logs the message payload. + This interceptor logs the message payload. + - This endpoint handles book flight request. + This endpoint handles book flight request. + - This endpoint handles get flights request. + This endpoint handles get flights request. + @@ -90,7 +110,8 @@ The validating JAXB Marshaller is used by the getFlightsEndpoint to unmarshal XML to objects and - vice-versa. + vice-versa. + @@ -100,7 +121,8 @@ This exception resolver maps exceptions to SOAP Faults. The business logic exceptions NoSeatAvailableException and NoSuchFlightException are mapped to custom SOAP Fault. Both UnmarshallingException andValidationFailureException are mapped to a SOAP Fault with a "Sender" fault code. - All other exceptions are mapped to a "Receiver" error code, the default. + All other exceptions are mapped to a "Receiver" error code, the default. + RECEIVER,Server error @@ -108,10 +130,12 @@ {http://www.springframework.org/spring-ws/samples/airline}airline:NoMoreSeats, No more seats - available + available + {http://www.springframework.org/spring-ws/samples/airline}airline:NoSuchFlight, No such flight - exists + exists + SENDER,Invalid request SENDER,Invalid request diff --git a/samples/airline/src/main/webapp/WEB-INF/airline-servlet.xml b/samples/airline/src/main/webapp/WEB-INF/airline-servlet.xml index c6a6419e..2717623b 100644 --- a/samples/airline/src/main/webapp/WEB-INF/airline-servlet.xml +++ b/samples/airline/src/main/webapp/WEB-INF/airline-servlet.xml @@ -14,12 +14,25 @@ + + + This handler adapter adds support for WsdlDefinitions to Spring's DispatcherServlet. It transforms location + attributes in the original WSDL to reflect the URL of the incoming HTTP request. + + + + All incoming request are mapped to the messageDispatcher defined in applicationContext-ws.xml + + + airlineWsdl + + \ 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 b3bb8244..cbb3f63d 100644 --- a/samples/airline/src/main/webapp/WEB-INF/web.xml +++ b/samples/airline/src/main/webapp/WEB-INF/web.xml @@ -37,10 +37,10 @@ airline /Airline - - wsdl - text/xml - + + airline + *.wsdl + xsd text/xml diff --git a/samples/echo/src/main/webapp/WEB-INF/applicationContext.xml b/samples/echo/src/main/webapp/WEB-INF/applicationContext.xml deleted file mode 100755 index 53eca912..00000000 --- a/samples/echo/src/main/webapp/WEB-INF/applicationContext.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - The MessageDispatcher is responsible for routing messages to endpoints. - - - - - - - This endpoint mapping uses the qualified name of the payload (body contents) to determine the endpoint for - an incoming message. Every message is passed to the default endpoint. Additionally, messages are logged - using the logging interceptor. - - - - - - - - - - - - This interceptor validates both incoming and outgoing message contents according to the 'echo.xsd' XML - Schema file. - - - - - - - - This interceptor logs the message payload. - - - - - This endpoint handles echo requests. - - - - - - - - - - - - - - diff --git a/samples/echo/src/main/webapp/WEB-INF/spring-ws-servlet.xml b/samples/echo/src/main/webapp/WEB-INF/spring-ws-servlet.xml index 54a2ac6e..2ec8cf18 100755 --- a/samples/echo/src/main/webapp/WEB-INF/spring-ws-servlet.xml +++ b/samples/echo/src/main/webapp/WEB-INF/spring-ws-servlet.xml @@ -1,35 +1,45 @@ - + + - + - This handler adapter makes sure that Spring's DispatcherServlet supports MessageEndpoint instances as - handlers. It uses a SAAJ to construct SoapMessageContexts (and SoapMessages). + This endpoint mapping uses the qualified name of the payload (body contents) to determine the endpoint for + an incoming message. Every message is passed to the default endpoint. Additionally, messages are logged + using the logging interceptor. - - + + + + + + - + - This handler adapter adds support for WsdlDefinitions to Spring's DispatcherServlet. It transforms location - attributes in the original WSDL to reflect the URL of the incoming HTTP request. + This interceptor validates both incoming and outgoing message contents according to the 'echo.xsd' XML + Schema file. - + + + - + - All incoming request are mapped to the messageDispatcher defined in applicationContext-ws.xml + This interceptor logs the message payload. - - - - messageDispatcher - echoWsdl - - + + + + This endpoint handles echo requests. + + + + + + + \ No newline at end of file diff --git a/samples/echo/src/main/webapp/WEB-INF/web.xml b/samples/echo/src/main/webapp/WEB-INF/web.xml index 47987163..6dc265f2 100755 --- a/samples/echo/src/main/webapp/WEB-INF/web.xml +++ b/samples/echo/src/main/webapp/WEB-INF/web.xml @@ -22,21 +22,10 @@ org.springframework.web.util.Log4jConfigListener - - - org.springframework.web.context.ContextLoaderListener - - spring-ws - org.springframework.web.servlet.DispatcherServlet + org.springframework.ws.transport.http.MessageDispatcherServlet @@ -45,10 +34,10 @@ /services - - spring-ws - *.wsdl - + + wsdl + text/xml + xsd