diff --git a/samples/airline/client/build.xml b/samples/airline/client/build.xml index d4be3b6c..3b335e99 100644 --- a/samples/airline/client/build.xml +++ b/samples/airline/client/build.xml @@ -4,6 +4,7 @@ + @@ -11,6 +12,7 @@ + diff --git a/samples/airline/client/jms/build.xml b/samples/airline/client/jms/build.xml new file mode 100644 index 00000000..ba8d29f9 --- /dev/null +++ b/samples/airline/client/jms/build.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/airline/client/jms/readme.txt b/samples/airline/client/jms/readme.txt new file mode 100644 index 00000000..36aa269e --- /dev/null +++ b/samples/airline/client/jms/readme.txt @@ -0,0 +1,10 @@ +SPRING WEB SERVICES + +This directory contains a client for the Airline Web Service that uses JMS: Java Message Service. The client can be run +from the provided ant file, by calling "ant run". + +JMS Client Sample table of contents +--------------------------------------------------- +* src - The source files for the client +* build.xml - Ant build file with a 'build' and a 'run' target + diff --git a/samples/airline/client/jms/src/log4j.properties b/samples/airline/client/jms/src/log4j.properties new file mode 100644 index 00000000..ef742979 --- /dev/null +++ b/samples/airline/client/jms/src/log4j.properties @@ -0,0 +1,7 @@ +log4j.rootLogger=WARN, stdout +log4j.logger.org.springframework.ws=DEBUG + + +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - %m%n \ No newline at end of file diff --git a/samples/airline/client/jms/src/org/springframework/ws/samples/airline/client/jms/JmsClient.java b/samples/airline/client/jms/src/org/springframework/ws/samples/airline/client/jms/JmsClient.java new file mode 100644 index 00000000..34c5f683 --- /dev/null +++ b/samples/airline/client/jms/src/org/springframework/ws/samples/airline/client/jms/JmsClient.java @@ -0,0 +1,48 @@ +/* + * 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.client.jms; + +import java.io.IOException; +import javax.jms.JMSException; +import javax.xml.soap.SOAPException; +import javax.xml.transform.TransformerException; +import javax.xml.transform.stream.StreamResult; + +import org.springframework.context.ApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; +import org.springframework.ws.client.core.support.WebServiceGatewaySupport; +import org.springframework.xml.transform.StringSource; + +/** @author Arjen Poutsma */ +public class JmsClient extends WebServiceGatewaySupport { + + private static final String PAYLOAD = + "" + + "AMS" + "VCE" + + "2006-01-31" + ""; + + public void getFlights() throws SOAPException, IOException, TransformerException, JMSException { + getWebServiceTemplate().sendSourceAndReceiveToResult(new StringSource(PAYLOAD), new StreamResult(System.out)); + } + + public static void main(String[] args) throws Exception { + ApplicationContext applicationContext = + new ClassPathXmlApplicationContext("applicationContext.xml", JmsClient.class); + JmsClient jmsClient = (JmsClient) applicationContext.getBean("jmsClient", JmsClient.class); + jmsClient.getFlights(); + } +} \ No newline at end of file diff --git a/samples/airline/client/jms/src/org/springframework/ws/samples/airline/client/jms/applicationContext.xml b/samples/airline/client/jms/src/org/springframework/ws/samples/airline/client/jms/applicationContext.xml new file mode 100644 index 00000000..790904c7 --- /dev/null +++ b/samples/airline/client/jms/src/org/springframework/ws/samples/airline/client/jms/applicationContext.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/samples/airline/pom.xml b/samples/airline/pom.xml index 2b701c7e..4b24a5f0 100644 --- a/samples/airline/pom.xml +++ b/samples/airline/pom.xml @@ -124,6 +124,11 @@ spring-oxm-tiger runtime + + org.springframework.ws + spring-ws-support + runtime + org.springframework.ws spring-ws-security @@ -146,7 +151,6 @@ org.springframework spring-jpa - ${spring.version} runtime @@ -166,6 +170,10 @@ org.springframework spring-webmvc + + org.springframework + spring-jms + org.springframework spring-mock @@ -175,16 +183,23 @@ javax.servlet servlet-api + provided taglibs standard 1.1.2 + runtime javax.persistence persistence-api - 1.0 + runtime + + + javax.jms + jms + runtime stax @@ -305,6 +320,17 @@ + + org.apache.activemq + activemq-core + runtime + + + org.apache.derby + derby + 10.3.1.4 + runtime + org.easymock diff --git a/samples/airline/readme.txt b/samples/airline/readme.txt index 77bc7a4f..976c6231 100644 --- a/samples/airline/readme.txt +++ b/samples/airline/readme.txt @@ -5,8 +5,8 @@ 1. INTRODUCTION Features a web service on top of an airline reservation system, backed by a database. The web service works by using XML -Marshalling techniques (JAXB2), and XPath in combination with XPath queries to pull information from a message. All -messages follow the airline.xsd schema in src/main/webapp. +Marshalling techniques (JAXB2), and XPath in combination with XPath queries to pull information from a message. +Additionally, the Airline service has JMS support. All messages follow the messages.xsd schema in src/main/webapp. Multiple clients are available, showing interoperability with Axis 1, SAAJ, C#, and more. 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 new file mode 100644 index 00000000..2b11ae19 --- /dev/null +++ b/samples/airline/src/main/resources/org/springframework/ws/samples/airline/ws/applicationContext-ws.xml @@ -0,0 +1,188 @@ + + + + + + + + + + + + + + This endpoint handles the Airline Web Service messages using JAXB2 marshalling. + + + + + + + + + This endpoint handles get frequent flyer mileage requests. + + + + + + + + + + + + + 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. + + + + + + + + + + + + + + + + + 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 + uses JAXB 2 objects. + + + + + + + This adapter allows for methods that use @XPathParam annotations. The XPathAirlineEndpoint uses JAXB2 these. + + + + http://www.springframework.org/spring-ws/samples/airline/schemas/messages + + + + + + + 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 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,Invalid request + CLIENT,Invalid request + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ 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 96f560ba..ca2eab32 100644 --- a/samples/airline/src/main/webapp/WEB-INF/web.xml +++ b/samples/airline/src/main/webapp/WEB-INF/web.xml @@ -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 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 122b0e7a..c8e1816c 100644 --- a/samples/airline/src/main/webapp/WEB-INF/ws-servlet.xml +++ b/samples/airline/src/main/webapp/WEB-INF/ws-servlet.xml @@ -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"> - - - - - - - This endpoint handles the Airline Web Service messages using JAXB2 marshalling. - - - - - - - - - This endpoint handles get frequent flyer mileage requests. - - - - - - - The JAXB 2 Marshaller is used by the endpoints. - - - - - - - - - - - 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. - - - - - - - - - - - - - - - - - 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 - uses JAXB 2 objects. - - - - - - - This adapter allows for methods that use @XPathParam annotations. The XPathAirlineEndpoint uses JAXB2 these. - - - - http://www.springframework.org/spring-ws/samples/airline/schemas/messages - - - - - - - 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 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,Invalid request - CLIENT,Invalid request - - - -