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

@@ -1,56 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<!-- Spring-WS beans -->
<bean id="messageDispatcher" class="org.springframework.ws.soap.SoapMessageDispatcher">
<description>
The MessageDispatcher is responsible for routing messages to endpoints.</description>
<property name="endpointMappings" ref="payloadMapping"/>
<property name="endpointExceptionResolvers" ref="endpointExceptionResolver"/>
</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. Every message is passed to the default endpoint. Additionally, messages are logged
using the logging interceptor.</description>
<property name="defaultEndpoint" ref="echoEndpoint"/>
<property name="interceptors">
<list>
<ref local="validatingInterceptor"/>
<ref local="loggingInterceptor"/>
</list>
</property>
</bean>
<bean id="validatingInterceptor" class="org.springframework.ws.endpoint.interceptor.PayloadValidatingInterceptor">
<description>
This interceptor validates both incoming and outgoing message contents according to the 'echo.xsd' XML
Schema file.</description>
<property name="schema" value="/echo.xsd"/>
<property name="validateRequest" value="true"/>
<property name="validateResponse" value="true"/>
</bean>
<bean id="loggingInterceptor" class="org.springframework.ws.endpoint.interceptor.PayloadLoggingInterceptor">
<description>
This interceptor logs the message payload.</description>
</bean>
<bean id="echoEndpoint" class="org.springframework.ws.samples.echo.ws.EchoEndpoint">
<description>
This endpoint handles echo requests.</description>
<property name="echoService" ref="echoService"/>
</bean>
<bean id="echoWsdl" class="org.springframework.ws.wsdl.wsdl11.SimpleWsdl11Definition">
<property name="wsdl" value="/echo.wsdl"/>
</bean>
<bean id="endpointExceptionResolver" class="org.springframework.ws.soap.endpoint.SimpleSoapExceptionResolver"/>
<!-- "Business" (POJO) services -->
<bean id="echoService" class="org.springframework.ws.samples.echo.service.impl.EchoServiceImpl"/>
</beans>

View File

@@ -1,35 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="messageEndpointHandlerAdapter"
class="org.springframework.ws.transport.http.MessageEndpointHandlerAdapter">
<bean id="payloadMapping" class="org.springframework.ws.endpoint.mapping.PayloadRootQNameEndpointMapping">
<description>
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.
</description>
<property name="messageContextFactory">
<bean class="org.springframework.ws.soap.saaj.SaajSoapMessageContextFactory"/>
<property name="defaultEndpoint" ref="echoEndpoint"/>
<property name="interceptors">
<list>
<ref local="validatingInterceptor"/>
<ref local="loggingInterceptor"/>
</list>
</property>
</bean>
<bean id="wsdlDefinitionHandlerAdapter" class="org.springframework.ws.transport.http.WsdlDefinitionHandlerAdapter">
<bean id="validatingInterceptor" class="org.springframework.ws.endpoint.interceptor.PayloadValidatingInterceptor">
<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.
This interceptor validates both incoming and outgoing message contents according to the 'echo.xsd' XML
Schema file.
</description>
<property name="transformLocations" value="true"/>
<property name="schema" value="/echo.xsd"/>
<property name="validateRequest" value="true"/>
<property name="validateResponse" value="true"/>
</bean>
<bean id="handlerMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<bean id="loggingInterceptor" class="org.springframework.ws.endpoint.interceptor.PayloadLoggingInterceptor">
<description>
All incoming request are mapped to the messageDispatcher defined in applicationContext-ws.xml
This interceptor logs the message payload.
</description>
<property name="defaultHandler" ref="messageDispatcher"/>
<property name="mappings">
<props>
<prop key="/services/*">messageDispatcher</prop>
<prop key="echo.wsdl">echoWsdl</prop>
</props>
</property>
</bean>
<bean id="echoEndpoint" class="org.springframework.ws.samples.echo.ws.EchoEndpoint">
<description>
This endpoint handles echo requests.
</description>
<property name="echoService" ref="echoService"/>
</bean>
<!-- "Business" (POJO) services -->
<bean id="echoService" class="org.springframework.ws.samples.echo.service.impl.EchoServiceImpl"/>
</beans>

View File

@@ -22,21 +22,10 @@
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
<!-- Loads the root application context of this web app at startup.
Use WebApplicationContextUtils.getWebApplicationContext(servletContext)
to access it anywhere in the web application, outside of the framework.
The root context is the parent of all servlet-specific contexts.
This means that its beans are automatically available in these child contexts,
both for getBean(name) calls and (external) bean references. -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- Starts the web service servlet. -->
<servlet>
<servlet-name>spring-ws</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class>
</servlet>
<!-- We map all service request to the springws servlet. -->
@@ -45,10 +34,10 @@
<url-pattern>/services</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>spring-ws</servlet-name>
<url-pattern>*.wsdl</url-pattern>
</servlet-mapping>
<mime-mapping>
<extension>wsdl</extension>
<mime-type>text/xml</mime-type>
</mime-mapping>
<mime-mapping>
<extension>xsd</extension>