Echo sample now uses MessageDispatcherServlet; airline sample uses WsdlDefinitionHandlerAdapter

This commit is contained in:
Arjen Poutsma
2006-10-08 16:36:59 +00:00
parent 3fd06347c3
commit 6a169a49bc
7 changed files with 94 additions and 117 deletions

View File

@@ -3,11 +3,15 @@
<beans>
<description>
This application context contains the Spring-WS beans.</description>
This application context contains the Spring-WS beans.
</description>
<bean id="messageDispatcher" class="org.springframework.ws.soap.SoapMessageDispatcher">
<description>
The MessageDispatcher is responsible for routing messages to endpoints.</description>
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.
</description>
<property name="endpointMappings">
<list>
<ref local="payloadMapping"/>
@@ -23,16 +27,26 @@
</property>
</bean>
<bean id="airlineWsdl" class="org.springframework.ws.wsdl.wsdl11.SimpleWsdl11Definition">
<description>
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.
</description>
<property name="wsdl" value="/airline.wsdl"/>
</bean>
<bean id="payloadMapping" class="org.springframework.ws.endpoint.mapping.PayloadRootQNameEndpointMapping">
<description>
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.</description>
Additionally, messages are logged using the logging interceptor.
</description>
<property name="mappings">
<props>
<prop key="{http://www.springframework.org/spring-ws/samples/airline/schemas}GetFlightsRequest">
getFlightsEndpoint</prop>
getFlightsEndpoint
</prop>
</props>
</property>
<property name="interceptors">
@@ -44,11 +58,13 @@
<description>
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.</description>
Additionally, message are logged and validated.
</description>
<property name="mappings">
<props>
<prop key="http://www.springframework.org/spring-ws/samples/airline/BookFlight">
bookFlightEndpoint</prop>
bookFlightEndpoint
</prop>
</props>
</property>
<property name="interceptors">
@@ -62,7 +78,8 @@
<bean id="validatingInterceptor" class="org.springframework.ws.endpoint.interceptor.PayloadValidatingInterceptor">
<description>
This interceptor validates both incoming and outgoing message contents according to the 'airline.xsd' XML
Schema file.</description>
Schema file.
</description>
<property name="schema" value="airline.xsd"/>
<property name="validateRequest" value="true"/>
<property name="validateResponse" value="true"/>
@@ -70,18 +87,21 @@
<bean id="loggingInterceptor" class="org.springframework.ws.endpoint.interceptor.PayloadLoggingInterceptor">
<description>
This interceptor logs the message payload.</description>
This interceptor logs the message payload.
</description>
</bean>
<bean id="bookFlightEndpoint" class="org.springframework.ws.samples.airline.ws.BookFlightEndpoint">
<description>
This endpoint handles book flight request.</description>
This endpoint handles book flight request.
</description>
<property name="airlineService" ref="airlineService"/>
</bean>
<bean id="getFlightsEndpoint" class="org.springframework.ws.samples.airline.ws.GetFlightsEndpoint">
<description>
This endpoint handles get flights request.</description>
This endpoint handles get flights request.
</description>
<property name="airlineService" ref="airlineService"/>
<property name="marshaller" ref="jaxbMarshaller"/>
<property name="unmarshaller" ref="jaxbMarshaller"/>
@@ -90,7 +110,8 @@
<bean id="jaxbMarshaller" class="org.springframework.oxm.jaxb.Jaxb1Marshaller">
<description>
The validating JAXB Marshaller is used by the getFlightsEndpoint to unmarshal XML to objects and
vice-versa.</description>
vice-versa.
</description>
<property name="contextPath" value="org.springframework.ws.samples.airline.schema"/>
<property name="validating" value="true"/>
</bean>
@@ -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.</description>
All other exceptions are mapped to a "Receiver" error code, the default.
</description>
<property name="defaultFault">
<value>RECEIVER,Server error</value>
</property>
@@ -108,10 +130,12 @@
<props>
<prop key="org.springframework.ws.samples.airline.service.NoSeatAvailableException">
{http://www.springframework.org/spring-ws/samples/airline}airline:NoMoreSeats, No more seats
available</prop>
available
</prop>
<prop key="org.springframework.ws.samples.airline.service.NoSuchFlightException">
{http://www.springframework.org/spring-ws/samples/airline}airline:NoSuchFlight, No such flight
exists</prop>
exists
</prop>
<prop key="org.springframework.oxm.UnmarshallingFailureException">SENDER,Invalid request</prop>
<prop key="org.springframework.oxm.ValidationFailureException">SENDER,Invalid request</prop>
</props>

View File

@@ -14,12 +14,25 @@
<bean id="messageContextFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageContextFactory"/>
<bean id="wsdlDefinitionHandlerAdapter" class="org.springframework.ws.transport.http.WsdlDefinitionHandlerAdapter">
<description>
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.
</description>
<property name="transformLocations" value="true"/>
</bean>
<bean id="handlerMapping"
class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<description>
All incoming request are mapped to the messageDispatcher defined in applicationContext-ws.xml
</description>
<property name="defaultHandler" ref="messageDispatcher"/>
<property name="mappings">
<props>
<prop key="airline.wsdl">airlineWsdl</prop>
</props>
</property>
</bean>
</beans>

View File

@@ -37,10 +37,10 @@
<servlet-name>airline</servlet-name>
<url-pattern>/Airline</url-pattern>
</servlet-mapping>
<mime-mapping>
<extension>wsdl</extension>
<mime-type>text/xml</mime-type>
</mime-mapping>
<servlet-mapping>
<servlet-name>airline</servlet-name>
<url-pattern>*.wsdl</url-pattern>
</servlet-mapping>
<mime-mapping>
<extension>xsd</extension>
<mime-type>text/xml</mime-type>