Added JMS support & client.
This commit is contained in:
@@ -0,0 +1,188 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:oxm="http://www.springframework.org/spring-ws/schema/oxm"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
|
||||
http://www.springframework.org/spring-ws/schema/oxm http://www.springframework.org/spring-ws/schema/oxm/spring-oxm-1.1.xsd">
|
||||
|
||||
<bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory"/>
|
||||
|
||||
<bean id="messageReceiver" class="org.springframework.ws.soap.server.SoapMessageDispatcher"/>
|
||||
|
||||
<!-- ===================== ENDPOINTS ===================================== -->
|
||||
|
||||
<!--
|
||||
The marshallingEndpoint and xpathEndpoint handle the same messages. So, you can only use one of them at the
|
||||
same time. This is done for illustration purposes only, typically you would not create two endpoints which
|
||||
handle the same messages.
|
||||
-->
|
||||
|
||||
<bean id="marshallingEndpoint" class="org.springframework.ws.samples.airline.ws.MarshallingAirlineEndpoint">
|
||||
<description>
|
||||
This endpoint handles the Airline Web Service messages using JAXB2 marshalling.
|
||||
</description>
|
||||
<constructor-arg ref="airlineService"/>
|
||||
</bean>
|
||||
|
||||
<!--
|
||||
<bean id="xpathEndpoint" class="org.springframework.ws.samples.airline.ws.XPathAirlineEndpoint">
|
||||
<description>
|
||||
This endpoint handles the Airline Web Service messages using XPath expressions and JAXB2 marshalling.
|
||||
</description>
|
||||
<constructor-arg ref="airlineService"/>
|
||||
<constructor-arg ref="marshaller"/>
|
||||
</bean>
|
||||
-->
|
||||
|
||||
<bean id="getFrequentFlyerMileageEndpoint"
|
||||
class="org.springframework.ws.samples.airline.ws.GetFrequentFlyerMileageEndpoint">
|
||||
<description>
|
||||
This endpoint handles get frequent flyer mileage requests.
|
||||
</description>
|
||||
<constructor-arg ref="airlineService"/>
|
||||
</bean>
|
||||
|
||||
<oxm:jaxb2-marshaller id="marshaller" contextPath="org.springframework.ws.samples.airline.schema"/>
|
||||
|
||||
<!-- ===================== ENDPOINT MAPPINGS ============================== -->
|
||||
|
||||
<!--
|
||||
The endpoint mappings map from a request to an endpoint. Because we only want the security interception to
|
||||
occur for the GetFrequentFlyerMileageEndpoint, we define two mappings: one with the securityInterceptor, and
|
||||
a general one without it.
|
||||
-->
|
||||
|
||||
<bean id="annotationMapping" class="org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping">
|
||||
<description>
|
||||
Detects @PayloadRoot annotations on @Endpoint bean methods. The MarshallingAirlineEndpoint
|
||||
has such annotations. It uses two interceptors: one that logs the message payload, and the other validates
|
||||
it accoring to the 'airline.xsd' schema file.
|
||||
</description>
|
||||
<property name="interceptors">
|
||||
<list>
|
||||
<bean class="org.springframework.ws.server.endpoint.interceptor.PayloadLoggingInterceptor"/>
|
||||
<bean class="org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor">
|
||||
<property name="schemas" value="/messages.xsd"/>
|
||||
<property name="validateRequest" value="true"/>
|
||||
<property name="validateResponse" value="true"/>
|
||||
</bean>
|
||||
</list>
|
||||
</property>
|
||||
<property name="order" value="1"/>
|
||||
</bean>
|
||||
|
||||
<bean id="secureMapping" class="org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping">
|
||||
<description>
|
||||
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.
|
||||
</description>
|
||||
<property name="mappings">
|
||||
<props>
|
||||
<prop key="{http://www.springframework.org/spring-ws/samples/airline/schemas/messages}GetFrequentFlyerMileageRequest">
|
||||
getFrequentFlyerMileageEndpoint
|
||||
</prop>
|
||||
</props>
|
||||
</property>
|
||||
<property name="interceptors">
|
||||
<list>
|
||||
<bean class="org.springframework.ws.soap.server.endpoint.interceptor.SoapEnvelopeLoggingInterceptor"/>
|
||||
<ref bean="wsSecurityInterceptor"/>
|
||||
</list>
|
||||
</property>
|
||||
<property name="order" value="2"/>
|
||||
</bean>
|
||||
|
||||
|
||||
<!-- ===================== ENDPOINT ADAPTERS ============================== -->
|
||||
|
||||
<!--
|
||||
Endpoint adapters adapt from the incoming message to a specific object or method signature. Because this
|
||||
example application uses three different endpoint programming models, we have to define three adapters. This
|
||||
is done for illustration purposes only, typically you would use one adapter, for instance the
|
||||
MarshallingMethodEndpointAdapter.
|
||||
-->
|
||||
|
||||
<bean class="org.springframework.ws.server.endpoint.adapter.GenericMarshallingMethodEndpointAdapter">
|
||||
<description>
|
||||
This adapter allows for methods that need and returns marshalled objects. The MarshallingEndpoint
|
||||
uses JAXB 2 objects.
|
||||
</description>
|
||||
<constructor-arg ref="marshaller"/>
|
||||
</bean>
|
||||
|
||||
<bean class="org.springframework.ws.server.endpoint.adapter.XPathParamAnnotationMethodEndpointAdapter">
|
||||
<description>
|
||||
This adapter allows for methods that use @XPathParam annotations. The XPathAirlineEndpoint uses JAXB2 these.
|
||||
</description>
|
||||
<property name="namespaces">
|
||||
<props>
|
||||
<prop key="messages">http://www.springframework.org/spring-ws/samples/airline/schemas/messages</prop>
|
||||
</props>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean class="org.springframework.ws.server.endpoint.adapter.PayloadEndpointAdapter">
|
||||
<description>
|
||||
This adapter allows for endpoints which implement the PayloadEndpoint interface. The Get
|
||||
FrequentFlyerMileageEndpoint implements this interface.
|
||||
</description>
|
||||
</bean>
|
||||
|
||||
<!-- ===================== ENDPOINT EXCEPTION RESOLVER ===================== -->
|
||||
|
||||
<!--
|
||||
Endpoint exception resolvers can handle exceptions as they occur in the Web service. We have two sorts of
|
||||
exceptions we want to handle: the business logic exceptions NoSeatAvailableException and NoSuchFlightException,
|
||||
which both have a @SoapFault annotation, and other exceptions, which don't have the annotation. Therefore, we
|
||||
have two exception resolvers here.
|
||||
-->
|
||||
|
||||
<bean class="org.springframework.ws.soap.server.endpoint.SoapFaultAnnotationExceptionResolver">
|
||||
<description>
|
||||
This exception resolver maps exceptions with the @SoapFault annotation to SOAP Faults. The business logic
|
||||
exceptions NoSeatAvailableException and NoSuchFlightException have these.
|
||||
</description>
|
||||
<property name="order" value="1"/>
|
||||
</bean>
|
||||
|
||||
<bean class="org.springframework.ws.soap.server.endpoint.SoapFaultMappingExceptionResolver">
|
||||
<description>
|
||||
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.
|
||||
</description>
|
||||
<property name="defaultFault" value="SERVER"/>
|
||||
<property name="exceptionMappings">
|
||||
<props>
|
||||
<prop key="org.springframework.oxm.UnmarshallingFailureException">CLIENT,Invalid request</prop>
|
||||
<prop key="org.springframework.oxm.ValidationFailureException">CLIENT,Invalid request</prop>
|
||||
</props>
|
||||
</property>
|
||||
<property name="order" value="2"/>
|
||||
</bean>
|
||||
|
||||
|
||||
<!-- ===================== JMS TRANSPORT ===================================== -->
|
||||
|
||||
<bean id="broker" class="org.apache.activemq.broker.BrokerFactory" factory-method="createBroker" init-method="start">
|
||||
<constructor-arg value="broker:tcp://localhost:61616?persistent=false"/>
|
||||
</bean>
|
||||
|
||||
<bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
|
||||
<property name="brokerURL" value="tcp://localhost:61616"/>
|
||||
</bean>
|
||||
|
||||
<bean class="org.springframework.jms.listener.DefaultMessageListenerContainer">
|
||||
<property name="connectionFactory" ref="connectionFactory"/>
|
||||
<property name="destinationName" value="RequestQueue"/>
|
||||
<property name="messageListener">
|
||||
<bean class="org.springframework.ws.transport.jms.WebServiceMessageListener">
|
||||
<property name="messageFactory" ref="messageFactory"/>
|
||||
<property name="messageReceiver" ref="messageReceiver"/>
|
||||
</bean>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
|
||||
|
||||
</beans>
|
||||
@@ -11,6 +11,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
|
||||
classpath:org/springframework/ws/samples/airline/ws/applicationContext-ws.xml
|
||||
</param-value>
|
||||
</context-param>
|
||||
<listener>
|
||||
|
||||
@@ -3,162 +3,6 @@
|
||||
xmlns:util="http://www.springframework.org/schema/util" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd">
|
||||
|
||||
<!-- ===================== ENDPOINTS ===================================== -->
|
||||
|
||||
<!--
|
||||
The marshallingEndpoint and xpathEndpoint handle the same messages. So, you can only use one of them at the
|
||||
same time. This is done for illustration purposes only, typically you would not create two endpoints which
|
||||
handle the same messages.
|
||||
-->
|
||||
|
||||
<bean id="marshallingEndpoint" class="org.springframework.ws.samples.airline.ws.MarshallingAirlineEndpoint">
|
||||
<description>
|
||||
This endpoint handles the Airline Web Service messages using JAXB2 marshalling.
|
||||
</description>
|
||||
<constructor-arg ref="airlineService"/>
|
||||
</bean>
|
||||
|
||||
<!--
|
||||
<bean id="xpathEndpoint" class="org.springframework.ws.samples.airline.ws.XPathAirlineEndpoint">
|
||||
<description>
|
||||
This endpoint handles the Airline Web Service messages using XPath expressions and JAXB2 marshalling.
|
||||
</description>
|
||||
<constructor-arg ref="airlineService"/>
|
||||
<constructor-arg ref="marshaller"/>
|
||||
</bean>
|
||||
-->
|
||||
|
||||
<bean id="getFrequentFlyerMileageEndpoint"
|
||||
class="org.springframework.ws.samples.airline.ws.GetFrequentFlyerMileageEndpoint">
|
||||
<description>
|
||||
This endpoint handles get frequent flyer mileage requests.
|
||||
</description>
|
||||
<constructor-arg ref="airlineService"/>
|
||||
</bean>
|
||||
|
||||
<bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
|
||||
<description>
|
||||
The JAXB 2 Marshaller is used by the endpoints.
|
||||
</description>
|
||||
<property name="contextPath" value="org.springframework.ws.samples.airline.schema"/>
|
||||
</bean>
|
||||
|
||||
<!-- ===================== ENDPOINT MAPPINGS ============================== -->
|
||||
|
||||
<!--
|
||||
The endpoint mappings map from a request to an endpoint. Because we only want the security interception to
|
||||
occur for the GetFrequentFlyerMileageEndpoint, we define two mappings: one with the securityInterceptor, and
|
||||
a general one without it.
|
||||
-->
|
||||
|
||||
<bean class="org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping">
|
||||
<description>
|
||||
Detects @PayloadRoot annotations on @Endpoint bean methods. The MarshallingAirlineEndpoint
|
||||
has such annotations. It uses two interceptors: one that logs the message payload, and the other validates
|
||||
it accoring to the 'airline.xsd' schema file.
|
||||
</description>
|
||||
<property name="interceptors">
|
||||
<list>
|
||||
<bean class="org.springframework.ws.server.endpoint.interceptor.PayloadLoggingInterceptor"/>
|
||||
<bean class="org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor">
|
||||
<property name="schemas" value="/messages.xsd"/>
|
||||
<property name="validateRequest" value="true"/>
|
||||
<property name="validateResponse" value="true"/>
|
||||
</bean>
|
||||
</list>
|
||||
</property>
|
||||
<property name="order" value="1"/>
|
||||
</bean>
|
||||
|
||||
<bean id="secureMapping" class="org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping">
|
||||
<description>
|
||||
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.
|
||||
</description>
|
||||
<property name="mappings">
|
||||
<props>
|
||||
<prop key="{http://www.springframework.org/spring-ws/samples/airline/schemas/messages}GetFrequentFlyerMileageRequest">
|
||||
getFrequentFlyerMileageEndpoint
|
||||
</prop>
|
||||
</props>
|
||||
</property>
|
||||
<property name="interceptors">
|
||||
<list>
|
||||
<bean class="org.springframework.ws.soap.server.endpoint.interceptor.SoapEnvelopeLoggingInterceptor"/>
|
||||
<ref bean="wsSecurityInterceptor"/>
|
||||
</list>
|
||||
</property>
|
||||
<property name="order" value="2"/>
|
||||
</bean>
|
||||
|
||||
|
||||
<!-- ===================== ENDPOINT ADAPTERS ============================== -->
|
||||
|
||||
<!--
|
||||
Endpoint adapters adapt from the incoming message to a specific object or method signature. Because this
|
||||
example application uses three different endpoint programming models, we have to define three adapters. This
|
||||
is done for illustration purposes only, typically you would use one adapter, for instance the
|
||||
MarshallingMethodEndpointAdapter.
|
||||
-->
|
||||
|
||||
<bean class="org.springframework.ws.server.endpoint.adapter.GenericMarshallingMethodEndpointAdapter">
|
||||
<description>
|
||||
This adapter allows for methods that need and returns marshalled objects. The MarshallingEndpoint
|
||||
uses JAXB 2 objects.
|
||||
</description>
|
||||
<constructor-arg ref="marshaller"/>
|
||||
</bean>
|
||||
|
||||
<bean class="org.springframework.ws.server.endpoint.adapter.XPathParamAnnotationMethodEndpointAdapter">
|
||||
<description>
|
||||
This adapter allows for methods that use @XPathParam annotations. The XPathAirlineEndpoint uses JAXB2 these.
|
||||
</description>
|
||||
<property name="namespaces">
|
||||
<props>
|
||||
<prop key="messages">http://www.springframework.org/spring-ws/samples/airline/schemas/messages</prop>
|
||||
</props>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean class="org.springframework.ws.server.endpoint.adapter.PayloadEndpointAdapter">
|
||||
<description>
|
||||
This adapter allows for endpoints which implement the PayloadEndpoint interface. The Get
|
||||
FrequentFlyerMileageEndpoint implements this interface.
|
||||
</description>
|
||||
</bean>
|
||||
|
||||
<!-- ===================== ENDPOINT EXCEPTION RESOLVER ===================== -->
|
||||
|
||||
<!--
|
||||
Endpoint exception resolvers can handle exceptions as they occur in the Web service. We have two sorts of
|
||||
exceptions we want to handle: the business logic exceptions NoSeatAvailableException and NoSuchFlightException,
|
||||
which both have a @SoapFault annotation, and other exceptions, which don't have the annotation. Therefore, we
|
||||
have two exception resolvers here.
|
||||
-->
|
||||
|
||||
<bean class="org.springframework.ws.soap.server.endpoint.SoapFaultAnnotationExceptionResolver">
|
||||
<description>
|
||||
This exception resolver maps exceptions with the @SoapFault annotation to SOAP Faults. The business logic
|
||||
exceptions NoSeatAvailableException and NoSuchFlightException have these.
|
||||
</description>
|
||||
<property name="order" value="1"/>
|
||||
</bean>
|
||||
|
||||
<bean class="org.springframework.ws.soap.server.endpoint.SoapFaultMappingExceptionResolver">
|
||||
<description>
|
||||
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.
|
||||
</description>
|
||||
<property name="defaultFault" value="SERVER"/>
|
||||
<property name="exceptionMappings">
|
||||
<props>
|
||||
<prop key="org.springframework.oxm.UnmarshallingFailureException">CLIENT,Invalid request</prop>
|
||||
<prop key="org.springframework.oxm.ValidationFailureException">CLIENT,Invalid request</prop>
|
||||
</props>
|
||||
</property>
|
||||
<property name="order" value="2"/>
|
||||
</bean>
|
||||
|
||||
<!-- ===================== WSDL DEFINITION ============================== -->
|
||||
|
||||
|
||||
Reference in New Issue
Block a user