cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cschnei...@apache.org
Subject [1/2] git commit: CXF-5857 Fix and improve JMS samples
Date Mon, 07 Jul 2014 12:07:10 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 97dab3da9 -> c39c04b24


CXF-5857 Fix and improve JMS samples

Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/1cf6098c
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/1cf6098c
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/1cf6098c

Branch: refs/heads/master
Commit: 1cf6098c2b063efb53d0d285ab54dd00dbfbf07c
Parents: 1feb5a7
Author: Christian Schneider <chris@die-schneider.net>
Authored: Mon Jul 7 14:03:41 2014 +0200
Committer: Christian Schneider <chris@die-schneider.net>
Committed: Mon Jul 7 14:03:41 2014 +0200

----------------------------------------------------------------------
 .../jms_pubsub/src/main/config/jms_greeter.wsdl | 21 +++++++---
 .../java/demo/jms_greeter/server/Server.java    |  4 +-
 .../jms_queue/src/main/config/jms_greeter.wsdl  | 22 +++++++----
 .../java/demo/jms_greeter/client/Client.java    |  5 +++
 .../java/demo/jms_greeter/server/Server.java    | 23 +++++++++--
 .../samples/jms_spring_config/README.txt        |  8 ++--
 .../release/samples/jms_spring_config/pom.xml   | 27 +------------
 .../src/main/config/binding.xml                 |  8 +++-
 .../client/CustomerServiceSpringClient.java     | 18 ++++-----
 .../client/CustomerServiceTester.java           |  9 ++++-
 .../server/CustomerServiceSpringServer.java     | 14 +++----
 .../resources/client-applicationContext.xml     | 41 +++++++++++++++-----
 .../resources/server-applicationContext.xml     | 39 ++++++++++++++-----
 .../src/main/webapp/WEB-INF/web.xml             | 36 -----------------
 14 files changed, 151 insertions(+), 124 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/1cf6098c/distribution/src/main/release/samples/jms_pubsub/src/main/config/jms_greeter.wsdl
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jms_pubsub/src/main/config/jms_greeter.wsdl
b/distribution/src/main/release/samples/jms_pubsub/src/main/config/jms_greeter.wsdl
index b847a03..9551e40 100644
--- a/distribution/src/main/release/samples/jms_pubsub/src/main/config/jms_greeter.wsdl
+++ b/distribution/src/main/release/samples/jms_pubsub/src/main/config/jms_greeter.wsdl
@@ -19,7 +19,16 @@
   specific language governing permissions and limitations
   under the License.
 -->
-<wsdl:definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:jms="http://cxf.apache.org/transports/jms"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://cxf.apache.org/jms_greeter"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:x1="http://cxf.apache.org/jms_greeter/types" name="JMSGreeterService" targetNamespace="http://cxf.apache.org/jms_greeter">
+<wsdl:definitions 
+	xmlns="http://schemas.xmlsoap.org/wsdl/" 
+	xmlns:soapjms="http://www.w3.org/2010/soapjms/" 
+	xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
+	xmlns:tns="http://cxf.apache.org/jms_greeter" 
+	xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
+	xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
+	xmlns:x1="http://cxf.apache.org/jms_greeter/types" 
+	name="JMSGreeterService" 
+	targetNamespace="http://cxf.apache.org/jms_greeter">
     <wsdl:types>
         <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://cxf.apache.org/jms_greeter/types"
elementFormDefault="qualified">
             <element name="greetMeOneWay">
@@ -40,7 +49,7 @@
         </wsdl:operation>
     </wsdl:portType>
     <wsdl:binding name="JMSGreeterPortBinding" type="tns:JMSGreeterPortType">
-        <soap:binding style="document" transport="http://cxf.apache.org/transports/jms"/>
+        <soap:binding style="document" transport="http://www.w3.org/2010/soapjms/"/>
         <wsdl:operation name="greetMeOneWay">
             <soap:operation style="document"/>
             <wsdl:input name="greetMeOneWayRequest">
@@ -50,10 +59,10 @@
     </wsdl:binding>
     <wsdl:service name="JMSGreeterService">
         <wsdl:port binding="tns:JMSGreeterPortBinding" name="GreeterPort">
-            <jms:address destinationStyle="topic" jndiConnectionFactoryName="ConnectionFactory"
jndiDestinationName="dynamicTopics/test.cxf.jmstransport.topic">
-                <jms:JMSNamingProperty name="java.naming.factory.initial" value="org.apache.activemq.jndi.ActiveMQInitialContextFactory"/>
-                <jms:JMSNamingProperty name="java.naming.provider.url" value="tcp://localhost:61616"/>
-            </jms:address>
+        	<soap:address location="jms:topic:test.cxf.jmstransport.topic"/>
+        	<soapjms:jndiConnectionFactoryName>ConnectionFactory</soapjms:jndiConnectionFactoryName>
+            <soapjms:jndiInitialContextFactory>org.apache.activemq.jndi.ActiveMQInitialContextFactory</soapjms:jndiInitialContextFactory>
+ 			<soapjms:jndiURL>tcp://localhost:61616</soapjms:jndiURL>
         </wsdl:port>
     </wsdl:service>
 </wsdl:definitions>

http://git-wip-us.apache.org/repos/asf/cxf/blob/1cf6098c/distribution/src/main/release/samples/jms_pubsub/src/main/java/demo/jms_greeter/server/Server.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jms_pubsub/src/main/java/demo/jms_greeter/server/Server.java
b/distribution/src/main/release/samples/jms_pubsub/src/main/java/demo/jms_greeter/server/Server.java
index ff7ba9e..1c3464b 100644
--- a/distribution/src/main/release/samples/jms_pubsub/src/main/java/demo/jms_greeter/server/Server.java
+++ b/distribution/src/main/release/samples/jms_pubsub/src/main/java/demo/jms_greeter/server/Server.java
@@ -26,9 +26,7 @@ public class Server {
 
     protected Server() throws Exception {
         System.out.println("Starting Server");
-        Object implementor = new GreeterJMSImpl();
-        String address = "http://cxf.apache.org/transports/jms";
-        ep = Endpoint.publish(address, implementor);
+        ep = Endpoint.publish(null, new GreeterJMSImpl());
 
         Runtime.getRuntime().addShutdownHook(new Thread() {
             public void run() {

http://git-wip-us.apache.org/repos/asf/cxf/blob/1cf6098c/distribution/src/main/release/samples/jms_queue/src/main/config/jms_greeter.wsdl
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jms_queue/src/main/config/jms_greeter.wsdl
b/distribution/src/main/release/samples/jms_queue/src/main/config/jms_greeter.wsdl
index 086fe84..f2c321c 100644
--- a/distribution/src/main/release/samples/jms_queue/src/main/config/jms_greeter.wsdl
+++ b/distribution/src/main/release/samples/jms_queue/src/main/config/jms_greeter.wsdl
@@ -19,7 +19,16 @@
   specific language governing permissions and limitations
   under the License.
 -->
-<wsdl:definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:jms="http://cxf.apache.org/transports/jms"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://cxf.apache.org/jms_greeter"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:x1="http://cxf.apache.org/jms_greeter/types" name="JMSGreeterService" targetNamespace="http://cxf.apache.org/jms_greeter">
+<wsdl:definitions 
+	xmlns="http://schemas.xmlsoap.org/wsdl/" 
+	xmlns:soapjms="http://www.w3.org/2010/soapjms/" 
+	xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
+	xmlns:tns="http://cxf.apache.org/jms_greeter" 
+	xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
+	xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
+	xmlns:x1="http://cxf.apache.org/jms_greeter/types" 
+	name="JMSGreeterService" 
+	targetNamespace="http://cxf.apache.org/jms_greeter">
     <wsdl:types>
         <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://cxf.apache.org/jms_greeter/types"
elementFormDefault="qualified">
             <element name="sayHi">
@@ -84,7 +93,7 @@
         </wsdl:operation>
     </wsdl:portType>
     <wsdl:binding name="JMSGreeterPortBinding" type="tns:JMSGreeterPortType">
-        <soap:binding style="document" transport="http://cxf.apache.org/transports/jms"/>
+        <soap:binding style="document" transport="http://www.w3.org/2010/soapjms/"/>
         <wsdl:operation name="greetMe">
             <soap:operation soapAction="" style="document"/>
             <wsdl:input name="greetMeRequest">
@@ -112,11 +121,10 @@
     </wsdl:binding>
     <wsdl:service name="JMSGreeterService">
         <wsdl:port binding="tns:JMSGreeterPortBinding" name="GreeterPort">
-            <jms:address destinationStyle="queue" jndiConnectionFactoryName="ConnectionFactory"
jndiDestinationName="dynamicQueues/test.cxf.jmstransport.queue">
-                <jms:JMSNamingProperty name="java.naming.factory.initial" value="org.apache.activemq.jndi.ActiveMQInitialContextFactory"/>
-                <jms:JMSNamingProperty name="java.naming.provider.url" value="tcp://localhost:61616"/>
-            </jms:address>
-            <jms:clientConfig useConduitIdSelector="false"/>
+        	<soap:address location="jms:queue:test.cxf.jmstransport.queue"/>
+        	<soapjms:jndiConnectionFactoryName>ConnectionFactory</soapjms:jndiConnectionFactoryName>
+            <soapjms:jndiInitialContextFactory>org.apache.activemq.jndi.ActiveMQInitialContextFactory</soapjms:jndiInitialContextFactory>
+ 			<soapjms:jndiURL>tcp://localhost:61616</soapjms:jndiURL>
         </wsdl:port>
     </wsdl:service>
 </wsdl:definitions>

http://git-wip-us.apache.org/repos/asf/cxf/blob/1cf6098c/distribution/src/main/release/samples/jms_queue/src/main/java/demo/jms_greeter/client/Client.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jms_queue/src/main/java/demo/jms_greeter/client/Client.java
b/distribution/src/main/release/samples/jms_queue/src/main/java/demo/jms_greeter/client/Client.java
index 5120974..d4e8bff 100644
--- a/distribution/src/main/release/samples/jms_queue/src/main/java/demo/jms_greeter/client/Client.java
+++ b/distribution/src/main/release/samples/jms_queue/src/main/java/demo/jms_greeter/client/Client.java
@@ -27,6 +27,7 @@ import java.util.Map;
 
 import javax.xml.namespace.QName;
 import javax.xml.ws.BindingProvider;
+
 import org.apache.cxf.jms_greeter.JMSGreeterPortType;
 import org.apache.cxf.jms_greeter.JMSGreeterService;
 import org.apache.cxf.transport.jms.JMSMessageHeadersType;
@@ -55,6 +56,10 @@ public final class Client {
         JMSGreeterService service = new JMSGreeterService(wsdl.toURI().toURL(), SERVICE_NAME);
         JMSGreeterPortType greeter = (JMSGreeterPortType)service.getPort(PORT_NAME, JMSGreeterPortType.class);
 
+        // If you prefer to define the ConnectionFactory directly instead of using a JNDI
look.
+        // You can inject is like this:
+        //service.getPort(PORT_NAME, JMSGreeterPortType.class, new ConnectionFactoryFeature(cf));
+
         System.out.println("Invoking sayHi...");
         System.out.println("server responded with: " + greeter.sayHi());
         System.out.println();

http://git-wip-us.apache.org/repos/asf/cxf/blob/1cf6098c/distribution/src/main/release/samples/jms_queue/src/main/java/demo/jms_greeter/server/Server.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jms_queue/src/main/java/demo/jms_greeter/server/Server.java
b/distribution/src/main/release/samples/jms_queue/src/main/java/demo/jms_greeter/server/Server.java
index e55bc0f..04928fd 100644
--- a/distribution/src/main/release/samples/jms_queue/src/main/java/demo/jms_greeter/server/Server.java
+++ b/distribution/src/main/release/samples/jms_queue/src/main/java/demo/jms_greeter/server/Server.java
@@ -19,17 +19,22 @@
 
 package demo.jms_greeter.server;
 
+import java.util.Collections;
+
+import javax.jms.ConnectionFactory;
 import javax.xml.ws.Endpoint;
 
+import org.apache.cxf.jaxws.EndpointImpl;
+import org.apache.cxf.transport.jms.ConnectionFactoryFeature;
+
 public class Server {
     Endpoint ep;
 
     protected Server() throws Exception {
         System.out.println("Starting Server");
         Object implementor = new GreeterJMSImpl();
-        String address = "http://cxf.apache.org/transports/jms";
-        ep = Endpoint.publish(address, implementor);
-
+        ep = Endpoint.publish(null, implementor);
+        
         Runtime.getRuntime().addShutdownHook(new Thread() {
             public void run() {
                 shutdown();
@@ -37,6 +42,18 @@ public class Server {
         });
     }
 
+    /**
+     * If you prefer to define the ConnectionFactory directly instead of using a JNDI look.
+    // You can inject is like this:
+     * @param impl
+     * @param cf
+     */
+    protected void publishEndpoint(Object impl, ConnectionFactory cf) {
+    	EndpointImpl ep = (EndpointImpl)Endpoint.create(impl);
+    	ep.setFeatures(Collections.singletonList(new ConnectionFactoryFeature(cf)));
+    	ep.publish();
+    }
+
     public void shutdown() {
         if (ep != null) {
             ep.stop();

http://git-wip-us.apache.org/repos/asf/cxf/blob/1cf6098c/distribution/src/main/release/samples/jms_spring_config/README.txt
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jms_spring_config/README.txt b/distribution/src/main/release/samples/jms_spring_config/README.txt
index ebea026..2c88192 100644
--- a/distribution/src/main/release/samples/jms_spring_config/README.txt
+++ b/distribution/src/main/release/samples/jms_spring_config/README.txt
@@ -1,10 +1,10 @@
 JMS Spring Config Demo
 ======================
 
-This is basically the wsdl first demo adapted to the JMS transport. It uses the JMS config
feature so 
-the JMS transport can be added to any existing service without changing the wsdl (leaving
the wsdl:service
-section disregarded.)  While the service is deployed on Tomcat, no http traffic is used to
connect 
-with the web service, instead the JMS transport is used.
+This is basically the wsdl first demo adapted to the JMS transport. It uses the JMS spec
configuration as well as
+the ConnectionFactoryFeature to show how to add the JMS transport to any existing service
without changing the wsdl
+ (leaving the wsdl:service section disregarded.)  When using the war variant the service
is deployed on Tomcat
+ but only uses it as a runtime the http part of tomcat is not used.
 
 The Demo consist of three parts:
 

http://git-wip-us.apache.org/repos/asf/cxf/blob/1cf6098c/distribution/src/main/release/samples/jms_spring_config/pom.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jms_spring_config/pom.xml b/distribution/src/main/release/samples/jms_spring_config/pom.xml
index 1ac6852..b7d457f 100644
--- a/distribution/src/main/release/samples/jms_spring_config/pom.xml
+++ b/distribution/src/main/release/samples/jms_spring_config/pom.xml
@@ -47,29 +47,6 @@
         <pluginManagement>
             <plugins>
                 <plugin>
-                    <artifactId>maven-war-plugin</artifactId>
-                    <version>2.1</version>
-                    <configuration>
-                        <webXml>src/main/webapp/WEB-INF/web.xml</webXml>
-                        <webResources>
-                            <resource>
-                                <directory>${wsdl.dir}</directory>
-                                <targetPath>WEB-INF</targetPath>
-                                <includes>
-                                    <include>*.wsdl</include>
-                                </includes>
-                            </resource>
-                            <resource>
-                                <directory>src/main/resources</directory>
-                                <targetPath>WEB-INF</targetPath>
-                                <includes>
-                                    <include>**.*</include>
-                                </includes>
-                            </resource>
-                        </webResources>
-                    </configuration>
-                </plugin>
-                <plugin>
                     <artifactId>maven-compiler-plugin</artifactId>
                     <configuration>
                         <source>1.6</source>
@@ -196,11 +173,11 @@
         </dependency>
         <dependency>
             <groupId>org.apache.activemq</groupId>
-            <artifactId>activemq-broker</artifactId>
+            <artifactId>activemq-client</artifactId>
         </dependency>
         <dependency>
             <groupId>org.apache.activemq</groupId>
-            <artifactId>activemq-kahadb-store</artifactId>
+            <artifactId>activemq-pool</artifactId>
         </dependency>
         <dependency>
             <groupId>org.springframework</groupId>

http://git-wip-us.apache.org/repos/asf/cxf/blob/1cf6098c/distribution/src/main/release/samples/jms_spring_config/src/main/config/binding.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jms_spring_config/src/main/config/binding.xml
b/distribution/src/main/release/samples/jms_spring_config/src/main/config/binding.xml
index f40283b..7a24571 100644
--- a/distribution/src/main/release/samples/jms_spring_config/src/main/config/binding.xml
+++ b/distribution/src/main/release/samples/jms_spring_config/src/main/config/binding.xml
@@ -1,5 +1,11 @@
 <?xml version="1.0"?>
-<jaxws:bindings xmlns:jaxws="http://java.sun.com/xml/ns/jaxws" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
wsdlLocation="CustomerService.wsdl">
+<!-- Shows how to replace the difficult to use XMLGregorianCalender with Date -->
+<jaxws:bindings 
+	xmlns:jaxws="http://java.sun.com/xml/ns/jaxws" 
+	xmlns:xs="http://www.w3.org/2001/XMLSchema" 
+	xmlns:jxb="http://java.sun.com/xml/ns/jaxb" 
+	xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
+	wsdlLocation="CustomerService.wsdl">
     <!-- <jaxws:enableAsyncMapping>true</jaxws:enableAsyncMapping> -->
     <jaxws:bindings node="wsdl:definitions/wsdl:types/xs:schema">
         <jxb:globalBindings>

http://git-wip-us.apache.org/repos/asf/cxf/blob/1cf6098c/distribution/src/main/release/samples/jms_spring_config/src/main/java/com/example/customerservice/client/CustomerServiceSpringClient.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jms_spring_config/src/main/java/com/example/customerservice/client/CustomerServiceSpringClient.java
b/distribution/src/main/release/samples/jms_spring_config/src/main/java/com/example/customerservice/client/CustomerServiceSpringClient.java
index 4f0e472..3fe3d87 100644
--- a/distribution/src/main/release/samples/jms_spring_config/src/main/java/com/example/customerservice/client/CustomerServiceSpringClient.java
+++ b/distribution/src/main/release/samples/jms_spring_config/src/main/java/com/example/customerservice/client/CustomerServiceSpringClient.java
@@ -18,24 +18,20 @@
  */
 package com.example.customerservice.client;
 
-
-
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
-public final class CustomerServiceSpringClient {
-
-    private CustomerServiceSpringClient() {
-    }
+/**
+ * Starter that initializes the spring context, fetches our test client and then shuts down
spring 
+ */
+public class CustomerServiceSpringClient {
 
-    public static void main(String args[]) throws Exception {
-        // Initialize the spring context and fetch our test client
+    public static void main(String args[]) throws Exception {      
         ClassPathXmlApplicationContext context 
             = new ClassPathXmlApplicationContext(new String[] {"classpath:client-applicationContext.xml"});
         CustomerServiceTester client = (CustomerServiceTester)context.getBean("tester");
         
         client.testCustomerService();
-        context.stop();
-        context.destroy();
-        //System.exit(0);
+
+        context.close();
     }
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/1cf6098c/distribution/src/main/release/samples/jms_spring_config/src/main/java/com/example/customerservice/client/CustomerServiceTester.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jms_spring_config/src/main/java/com/example/customerservice/client/CustomerServiceTester.java
b/distribution/src/main/release/samples/jms_spring_config/src/main/java/com/example/customerservice/client/CustomerServiceTester.java
index 6245c39..2f1fbfe 100644
--- a/distribution/src/main/release/samples/jms_spring_config/src/main/java/com/example/customerservice/client/CustomerServiceTester.java
+++ b/distribution/src/main/release/samples/jms_spring_config/src/main/java/com/example/customerservice/client/CustomerServiceTester.java
@@ -21,12 +21,19 @@ package com.example.customerservice.client;
 
 import java.util.List;
 
-import junit.framework.Assert;
+import org.junit.Assert;
 
 import com.example.customerservice.Customer;
 import com.example.customerservice.CustomerService;
 import com.example.customerservice.NoSuchCustomerException;
 
+/**
+ * Calls the CustomerService using the proxy created by CXF and does some assertions to make

+ * sure the calls work.
+ * 
+ * This also shows how typical user code on the client side could look like. Make sure to
keep your business code
+ * free from spring and cxf dependencies as far as possible.
+ */
 public final class CustomerServiceTester {
     
     // The CustomerService proxy will be injected either by spring or by a direct call to
the setter 

http://git-wip-us.apache.org/repos/asf/cxf/blob/1cf6098c/distribution/src/main/release/samples/jms_spring_config/src/main/java/com/example/customerservice/server/CustomerServiceSpringServer.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jms_spring_config/src/main/java/com/example/customerservice/server/CustomerServiceSpringServer.java
b/distribution/src/main/release/samples/jms_spring_config/src/main/java/com/example/customerservice/server/CustomerServiceSpringServer.java
index a01d1b7..c85dda0 100644
--- a/distribution/src/main/release/samples/jms_spring_config/src/main/java/com/example/customerservice/server/CustomerServiceSpringServer.java
+++ b/distribution/src/main/release/samples/jms_spring_config/src/main/java/com/example/customerservice/server/CustomerServiceSpringServer.java
@@ -20,16 +20,16 @@ package com.example.customerservice.server;
 
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
+/**
+ * Starter that initializes the spring context and so also creates the service endpoint.
+ */
 public class CustomerServiceSpringServer {
     
-    protected CustomerServiceSpringServer() {
-    }
-
     public static void main(String args[]) throws Exception {
-        ClassPathXmlApplicationContext ctx 
-            = new ClassPathXmlApplicationContext("server-applicationContext.xml");
+        ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("server-applicationContext.xml");
+        System.out.println("Server started. Press any key to shut down.");
         System.in.read();
-        ctx.stop();
-        ctx.destroy();
+        ctx.close();
     }
+
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/1cf6098c/distribution/src/main/release/samples/jms_spring_config/src/main/resources/client-applicationContext.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jms_spring_config/src/main/resources/client-applicationContext.xml
b/distribution/src/main/release/samples/jms_spring_config/src/main/resources/client-applicationContext.xml
index 63011ed..3ca726c 100644
--- a/distribution/src/main/release/samples/jms_spring_config/src/main/resources/client-applicationContext.xml
+++ b/distribution/src/main/release/samples/jms_spring_config/src/main/resources/client-applicationContext.xml
@@ -14,21 +14,42 @@
         the specific language governing permissions and limitations under the
         License.
 -->
-<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context" xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:p="http://www.springframework.org/schema/p" xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd         http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd         http://cxf.apache.org/core
http://cxf.apache.org/schemas/core.xsd         http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
-    <bean id="jmsConnectionFactory" class="org.springframework.jms.connection.SingleConnectionFactory">
-        <property name="targetConnectionFactory">
-            <bean class="org.apache.activemq.ActiveMQConnectionFactory">
-                <property name="brokerURL" value="tcp://localhost:61616"/>
-            </bean>
-        </property>
+<beans xmlns="http://www.springframework.org/schema/beans"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:context="http://www.springframework.org/schema/context"
+	xmlns:jaxws="http://cxf.apache.org/jaxws"
+	xsi:schemaLocation="
+		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
        
+		http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
+		http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
+
+	<!-- Make sure to use ConnectionPooling to achieve a good performance.
+		 Do not forget the destroy-method as else the JVM will hang on shutdown -->
+	<bean id="jmsConnectionFactory" class="org.apache.activemq.jms.pool.PooledConnectionFactory"
destroy-method="stop">
+		<property name="connectionFactory">
+    		<bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
+    			<property name="brokerURL" value="tcp://localhost:61616"/>
+    		</bean>
+    	</property>
     </bean>
-    <bean id="jmsConfig" class="org.apache.cxf.transport.jms.JMSConfiguration" p:connectionFactory-ref="jmsConnectionFactory"
p:targetDestination="test.queue"/>
-    <jaxws:client id="customerService" address="jms://" serviceClass="com.example.customerservice.CustomerService">
+    
+    <jaxws:client 
+    	id="customerService" 
+    	address="jms:queue:test.queue" 
+    	serviceClass="com.example.customerservice.CustomerService">
         <jaxws:features>
             <bean class="org.apache.cxf.feature.LoggingFeature"/>
-            <bean class="org.apache.cxf.transport.jms.JMSConfigFeature" p:jmsConfig-ref="jmsConfig"/>
+            
+            <!-- We use the feature to inject the ConnectionFactory. This approach also
allows to publish
+            	a java first service as we need no jms config in the wsdl.
+            	Alternatively the ConnectionFactory can also be looked up using jndi like shown
in the jms_queue example -->
+            <bean class="org.apache.cxf.transport.jms.ConnectionFactoryFeature">
+            	<constructor-arg ref="jmsConnectionFactory"/>
+            </bean>
         </jaxws:features>
     </jaxws:client>
+
     <bean id="tester" class="com.example.customerservice.client.CustomerServiceTester">
         <property name="customerService" ref="customerService"/>
     </bean>

http://git-wip-us.apache.org/repos/asf/cxf/blob/1cf6098c/distribution/src/main/release/samples/jms_spring_config/src/main/resources/server-applicationContext.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jms_spring_config/src/main/resources/server-applicationContext.xml
b/distribution/src/main/release/samples/jms_spring_config/src/main/resources/server-applicationContext.xml
index 52e7e46..b60251a 100644
--- a/distribution/src/main/release/samples/jms_spring_config/src/main/resources/server-applicationContext.xml
+++ b/distribution/src/main/release/samples/jms_spring_config/src/main/resources/server-applicationContext.xml
@@ -14,20 +14,39 @@
         the specific language governing permissions and limitations under the
         License.
 -->
-<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
        http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd         http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd">
-    <bean id="jmsConnectionFactory" class="org.springframework.jms.connection.SingleConnectionFactory">
-        <property name="targetConnectionFactory">
-            <bean class="org.apache.activemq.ActiveMQConnectionFactory">
-                <property name="brokerURL" value="tcp://localhost:61616"/>
-            </bean>
-        </property>
+<beans xmlns="http://www.springframework.org/schema/beans" 
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+	xmlns:jaxws="http://cxf.apache.org/jaxws" 
+	xsi:schemaLocation="
+		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
+		http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
+		http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
+
+	<!-- Make sure to use ConnectionPooling to achieve a good performance.
+		 Do not forget the destroy-method as else the JVM will hang on shutdown -->
+	<bean id="jmsConnectionFactory" class="org.apache.activemq.jms.pool.PooledConnectionFactory"
destroy-method="stop">
+		<property name="connectionFactory">
+    		<bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
+    			<property name="brokerURL" value="tcp://localhost:61616"/>
+    		</bean>
+    	</property>
     </bean>
-    <bean id="jmsConfig" class="org.apache.cxf.transport.jms.JMSConfiguration" p:connectionFactory-ref="jmsConnectionFactory"
p:targetDestination="test.queue"/>
+
     <!-- JMS Endpoint -->
-    <jaxws:endpoint xmlns:customer="http://customerservice.example.com/" id="CustomerServiceHTTP"
address="jms://" implementor="com.example.customerservice.server.CustomerServiceImpl">
+    <jaxws:endpoint xmlns:customer="http://customerservice.example.com/" 
+    	id="CustomerServiceHTTP" 
+    	address="jms:queue:test.queue" 
+    	implementor="com.example.customerservice.server.CustomerServiceImpl">
         <jaxws:features>
             <bean class="org.apache.cxf.feature.LoggingFeature"/>
-            <bean class="org.apache.cxf.transport.jms.JMSConfigFeature" p:jmsConfig-ref="jmsConfig"/>
+            
+            <!-- We use the feature to inject the ConnectionFactory. This approach also
allows to publish
+            	a java first service as we need no jms config in the wsdl.
+            	Alternatively the ConnectionFactory can also be looked up using jndi like shown
in the jms_queue example -->
+            <bean class="org.apache.cxf.transport.jms.ConnectionFactoryFeature">
+            	<constructor-arg ref="jmsConnectionFactory"/>
+            </bean>
         </jaxws:features>
     </jaxws:endpoint>
 </beans>

http://git-wip-us.apache.org/repos/asf/cxf/blob/1cf6098c/distribution/src/main/release/samples/jms_spring_config/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jms_spring_config/src/main/webapp/WEB-INF/web.xml
b/distribution/src/main/release/samples/jms_spring_config/src/main/webapp/WEB-INF/web.xml
deleted file mode 100644
index cea65d9..0000000
--- a/distribution/src/main/release/samples/jms_spring_config/src/main/webapp/WEB-INF/web.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements. See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership. The ASF licenses this file
-  to you 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.
--->
-<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="2.5" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee           http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
-    <display-name>cxf</display-name>
-    <servlet>
-        <servlet-name>cxf</servlet-name>
-        <display-name>cxf</display-name>
-        <description>Apache CXF Endpoint</description>
-        <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
-        <load-on-startup>1</load-on-startup>
-    </servlet>
-    <servlet-mapping>
-        <servlet-name>cxf</servlet-name>
-        <url-pattern>/services/*</url-pattern>
-    </servlet-mapping>
-    <session-config>
-        <session-timeout>60</session-timeout>
-    </session-config>
-</web-app>


Mime
View raw message