Added JMS support & client.
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
<target name="clean-all">
|
||||
<ant dir="axis1" target="clean"/>
|
||||
<ant dir="jax-ws" target="clean"/>
|
||||
<ant dir="jms" target="clean"/>
|
||||
<ant dir="saaj" target="clean"/>
|
||||
<ant dir="spring-ws" target="clean"/>
|
||||
</target>
|
||||
@@ -11,6 +12,7 @@
|
||||
<target name="run-all">
|
||||
<ant dir="axis1" target="run"/>
|
||||
<ant dir="jax-ws" target="run"/>
|
||||
<ant dir="jms" target="run"/>
|
||||
<ant dir="saaj" target="run"/>
|
||||
<ant dir="spring-ws" target="run"/>
|
||||
</target>
|
||||
|
||||
59
samples/airline/client/jms/build.xml
Normal file
59
samples/airline/client/jms/build.xml
Normal file
@@ -0,0 +1,59 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<project name="spring-ws-airline-sample-saaj-client" default="build"
|
||||
xmlns:artifact="urn:maven-artifact-ant">
|
||||
<property name="bin.dir" value="bin"/>
|
||||
<property name="src.dir" value="src"/>
|
||||
|
||||
<target name="init">
|
||||
<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant">
|
||||
<classpath>
|
||||
<pathelement location="${basedir}/../../../maven-artifact-ant-2.0.4-dep.jar"/>
|
||||
</classpath>
|
||||
</typedef>
|
||||
|
||||
<artifact:remoteRepository id="java.net" url="https://maven-repository.dev.java.net/nonav/repository"
|
||||
layout="legacy"/>
|
||||
|
||||
<artifact:dependencies pathId="compile.classpath">
|
||||
<remoteRepository refid="java.net"/>
|
||||
<dependency groupId="javax.xml.soap" artifactId="saaj-api" version="1.3"/>
|
||||
<dependency groupId="org.apache.activemq" artifactId="activemq-core" version="4.1.1"/>
|
||||
<dependency groupId="org.springframework.ws" artifactId="spring-ws-core" version="1.1-SNAPSHOT"/>
|
||||
</artifact:dependencies>
|
||||
|
||||
<artifact:dependencies pathId="runtime.classpath">
|
||||
<remoteRepository refid="java.net"/>
|
||||
<dependency groupId="com.sun.xml.messaging.saaj" artifactId="saaj-impl" version="1.3"/>
|
||||
<dependency groupId="org.springframework.ws" artifactId="spring-ws-support" version="1.1-SNAPSHOT"/>
|
||||
<dependency groupId="org.springframework" artifactId="spring-jms" version="2.0.7"/>
|
||||
</artifact:dependencies>
|
||||
|
||||
</target>
|
||||
|
||||
|
||||
<target name="build" depends="init">
|
||||
<mkdir dir="${bin.dir}"/>
|
||||
<javac srcdir="${src.dir}" destdir="${bin.dir}" debug="true">
|
||||
<classpath refid="compile.classpath"/>
|
||||
</javac>
|
||||
<copy todir="${bin.dir}">
|
||||
<fileset dir="${src.dir}">
|
||||
<exclude name="**/*.java"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<target name="clean">
|
||||
<delete dir="${bin.dir}"/>
|
||||
</target>
|
||||
|
||||
<target name="run" depends="build">
|
||||
<java classname="org.springframework.ws.samples.airline.client.jms.JmsClient" fork="true" failonerror="true">
|
||||
<classpath refid="compile.classpath"/>
|
||||
<classpath refid="runtime.classpath"/>
|
||||
<classpath location="${bin.dir}"/>
|
||||
</java>
|
||||
</target>
|
||||
|
||||
</project>
|
||||
10
samples/airline/client/jms/readme.txt
Normal file
10
samples/airline/client/jms/readme.txt
Normal file
@@ -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
|
||||
|
||||
7
samples/airline/client/jms/src/log4j.properties
Normal file
7
samples/airline/client/jms/src/log4j.properties
Normal file
@@ -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
|
||||
@@ -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 =
|
||||
"<airline:GetFlightsRequest xmlns:airline=\"http://www.springframework.org/spring-ws/samples/airline/schemas/messages\">" +
|
||||
"<airline:from>AMS</airline:from>" + "<airline:to>VCE</airline:to>" +
|
||||
"<airline:departureDate>2006-01-31</airline:departureDate>" + "</airline:GetFlightsRequest>";
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
|
||||
|
||||
<bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
|
||||
<property name="brokerURL" value="tcp://localhost:61616"/>
|
||||
</bean>
|
||||
|
||||
<bean id="jmsClient" class="org.springframework.ws.samples.airline.client.jms.JmsClient">
|
||||
<property name="defaultUri" value="jms:RequestQueue"/>
|
||||
<property name="messageSenders">
|
||||
<bean class="org.springframework.ws.transport.jms.JmsMessageSender">
|
||||
<property name="connectionFactory" ref="connectionFactory"/>
|
||||
</bean>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
Reference in New Issue
Block a user