cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cschnei...@apache.org
Subject svn commit: r1097532 - in /cxf/trunk/distribution/src/main/release/samples: ./ jms_spring_config/ jms_spring_config/src/ jms_spring_config/src/main/ jms_spring_config/src/main/java/ jms_spring_config/src/main/java/com/ jms_spring_config/src/main/java/c...
Date Thu, 28 Apr 2011 16:21:22 GMT
Author: cschneider
Date: Thu Apr 28 16:21:22 2011
New Revision: 1097532

URL: http://svn.apache.org/viewvc?rev=1097532&view=rev
Log:
Added example showing the jmsConfigfeature in action

Added:
    cxf/trunk/distribution/src/main/release/samples/jms_spring_config/   (with props)
    cxf/trunk/distribution/src/main/release/samples/jms_spring_config/README.txt
    cxf/trunk/distribution/src/main/release/samples/jms_spring_config/pom.xml
    cxf/trunk/distribution/src/main/release/samples/jms_spring_config/src/
    cxf/trunk/distribution/src/main/release/samples/jms_spring_config/src/main/
    cxf/trunk/distribution/src/main/release/samples/jms_spring_config/src/main/java/
    cxf/trunk/distribution/src/main/release/samples/jms_spring_config/src/main/java/com/
    cxf/trunk/distribution/src/main/release/samples/jms_spring_config/src/main/java/com/example/
    cxf/trunk/distribution/src/main/release/samples/jms_spring_config/src/main/java/com/example/customerservice/
    cxf/trunk/distribution/src/main/release/samples/jms_spring_config/src/main/java/com/example/customerservice/client/
    cxf/trunk/distribution/src/main/release/samples/jms_spring_config/src/main/java/com/example/customerservice/client/CustomerServiceSpringClient.java
    cxf/trunk/distribution/src/main/release/samples/jms_spring_config/src/main/java/com/example/customerservice/client/CustomerServiceTester.java
    cxf/trunk/distribution/src/main/release/samples/jms_spring_config/src/main/java/com/example/customerservice/server/
    cxf/trunk/distribution/src/main/release/samples/jms_spring_config/src/main/java/com/example/customerservice/server/CustomerServiceImpl.java
    cxf/trunk/distribution/src/main/release/samples/jms_spring_config/src/main/java/com/example/customerservice/server/CustomerServiceSpringServer.java
    cxf/trunk/distribution/src/main/release/samples/jms_spring_config/src/main/resources/
    cxf/trunk/distribution/src/main/release/samples/jms_spring_config/src/main/resources/client-applicationContext.xml
    cxf/trunk/distribution/src/main/release/samples/jms_spring_config/src/main/resources/log4j.conf
    cxf/trunk/distribution/src/main/release/samples/jms_spring_config/src/main/resources/server-applicationContext.xml
    cxf/trunk/distribution/src/main/release/samples/jms_spring_config/wsdl/
    cxf/trunk/distribution/src/main/release/samples/jms_spring_config/wsdl/CustomerService.wsdl
    cxf/trunk/distribution/src/main/release/samples/jms_spring_config/wsdl/binding.xml
Modified:
    cxf/trunk/distribution/src/main/release/samples/pom.xml

Propchange: cxf/trunk/distribution/src/main/release/samples/jms_spring_config/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Apr 28 16:21:22 2011
@@ -0,0 +1 @@
+target

Added: cxf/trunk/distribution/src/main/release/samples/jms_spring_config/README.txt
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/jms_spring_config/README.txt?rev=1097532&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/jms_spring_config/README.txt (added)
+++ cxf/trunk/distribution/src/main/release/samples/jms_spring_config/README.txt Thu Apr 28
16:21:22 2011
@@ -0,0 +1,74 @@
+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.
+
+The Demo consist of three parts:
+
+- Creating the server and client code stubs from the WSDL
+- Service implementation (using Spring)
+- Client implementation (using Spring)
+
+Server implementation
+---------------------
+
+The service is implemented in the class CustomerServiceImpl. The class simply implements
the previously
+generated service interface. The method getCustomersByName demonstrates how a query function
could look like.
+The idea is to search and return all customers with the given name. If the searched name
is none then the method
+returns an exception to indicate that no matching customer was found. (In a real implementation
probably a list with
+zero objects would be used. This is mainly to show how custom exceptions can be used).
+For any other name the method will return a list of two Customer objects. The number of 
objects can be increased to
+test how fast CXF works for larger data.
+
+Now that the service is implemented it needs to be made available. In this example a standalone
server is used. 
+This can be done either with the JAX-WS API demonstrated in the class CustomerService or
using a spring config as
+demonstrated in the class CustomerServiceSpringServer.
+
+Client implementation
+---------------------
+
+The main client code lives in the class CustomerServiceTester. This class needs a proxy to
the service and then 
+demonstrates some calls and their expected outcome using junit assertions.
+
+The first call is a request getCustomersByName for all customers with name "Smith". The result
is then checked.
+Then the same method is called with the invalid name "None". In this case a NoSuchCustomerException
is expected.
+The third call shows that the one way method updateCustomer will return instantly even if
the service needs some
+time to process the request.
+
+The classes CustomerServiceClient and CustomerServiceSpringClient show how to get a service
proxy using JAX-WS 
+or Spring and how to wire it to your business class (in this case CustomerServiceTester).
+
+Prerequisite
+------------
+
+Please review the README in the samples main directory before continuing.
+
+Building and running the demo using Maven
+---------------------------------------
+
+From the base directory of this sample (i.e., where this README file is
+located), the pom.xml file is used to build and run the demo. 
+
+Using either UNIX or Windows:
+
+  mvn install   (builds the demo)
+  mvn -Pjms.broker (from one command line window)
+  mvn -Pserver  (from as second command line window)
+  mvn -Pclient  (from a third command line window)
+
+To remove the code generated from the WSDL file and the .class
+files, run "mvn clean".
+
+
+Using eclipse to run and test the demo
+--------------------------------------
+
+run the following in the demo base directory
+
+mvn eclipse:eclipse
+
+Then use Import / Existing projects into workspace and browse to the wsdl_first directory.
Import the wsdl_first project.
+
+The demo can now be started using "Run as Java Application" on the classes CustomerServiceSpringClient.java

+or CustomerServiceSpringServer.java 

Added: cxf/trunk/distribution/src/main/release/samples/jms_spring_config/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/jms_spring_config/pom.xml?rev=1097532&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/jms_spring_config/pom.xml (added)
+++ cxf/trunk/distribution/src/main/release/samples/jms_spring_config/pom.xml Thu Apr 28 16:21:22
2011
@@ -0,0 +1,202 @@
+<!--
+  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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.apache.cxf.samples</groupId>
+    <artifactId>jms_spring_config</artifactId>
+    <packaging>jar</packaging>
+    <name>WSDL first demo using the jms transport and jmsConfigFeature</name>
+    <version>2.4.1-SNAPSHOT</version>
+
+    <parent>
+        <groupId>org.apache.cxf.samples</groupId>
+        <artifactId>cxf-samples</artifactId>
+        <version>2.4.1-SNAPSHOT</version>
+    </parent>
+    <properties>
+        <cxf.version>${project.version}</cxf.version>
+        <cxf.release.base>${basedir}/../..</cxf.release.base>
+    </properties>
+    <build>
+        <defaultGoal>install</defaultGoal>
+        <resources>
+            <resource>
+                <directory>wsdl</directory>
+            </resource>
+            <resource>
+                <directory>src/main/resources</directory>
+            </resource>
+        </resources>
+        <pluginManagement>
+            <plugins>
+                <plugin>
+                    <artifactId>maven-war-plugin</artifactId>
+                    <version>2.1</version>
+                    <configuration>
+                        <webXml>${cxf.release.base}/etc/web.xml</webXml>
+                        <webResources>
+                            <resource>
+                                <directory>wsdl</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.5</source>
+                        <target>1.5</target>
+                    </configuration>
+                </plugin>
+            </plugins>
+        </pluginManagement>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.cxf</groupId>
+                <artifactId>cxf-codegen-plugin</artifactId>
+                <version>${project.version}</version>
+                <executions>
+                    <execution>
+                        <id>generate-sources</id>
+                        <phase>generate-sources</phase>
+                        <configuration>
+                            <wsdlOptions>
+                                <wsdlOption>
+                                    <wsdl>${basedir}/wsdl/CustomerService.wsdl</wsdl>
+                                    <bindingFiles>
+                                        <bindingFile>${basedir}/wsdl/binding.xml</bindingFile>
+                                    </bindingFiles>
+                                </wsdlOption>
+                            </wsdlOptions>
+                        </configuration>
+                        <goals>
+                            <goal>wsdl2java</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+    <profiles>
+        <profile>
+            <id>server</id>
+            <build>
+                <defaultGoal>test</defaultGoal>
+                <plugins>
+                    <plugin>
+                        <groupId>org.codehaus.mojo</groupId>
+                        <artifactId>exec-maven-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <phase>test</phase>
+                                <goals>
+                                    <goal>java</goal>
+                                </goals>
+                                <configuration>
+                                    <mainClass>com.example.customerservice.server.CustomerServiceSpringServer</mainClass>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+        <profile>
+            <id>client</id>
+            <build>
+                <defaultGoal>test</defaultGoal>
+                <plugins>
+                    <plugin>
+                        <groupId>org.codehaus.mojo</groupId>
+                        <artifactId>exec-maven-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <phase>test</phase>
+                                <goals>
+                                    <goal>java</goal>
+                                </goals>
+                                <configuration>
+                                    <mainClass>com.example.customerservice.client.CustomerServiceSpringClient</mainClass>
+                                    <arguments>
+                                        <argument>${basedir}/wsdl/CustomerService.wsdl</argument>
+                                    </arguments>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+	<profile>
+            <id>jms.broker</id>
+            <build>
+                <defaultGoal>test</defaultGoal>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.activemq.tooling</groupId>
+                        <artifactId>maven-activemq-plugin</artifactId>
+                        <version>5.4.2</version>
+                        <executions>
+                            <execution>
+                                <phase>test</phase>
+                                <goals>
+                                    <goal>run</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-frontend-jaxws</artifactId>
+            <version>2.4.1-SNAPSHOT</version>
+        </dependency>
+                <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-transports-jms</artifactId>
+            <version>2.4.1-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.activemq</groupId>
+            <artifactId>activemq-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.7</version>
+            <scope>compile</scope>
+        </dependency>
+    </dependencies>
+</project>

Added: cxf/trunk/distribution/src/main/release/samples/jms_spring_config/src/main/java/com/example/customerservice/client/CustomerServiceSpringClient.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/jms_spring_config/src/main/java/com/example/customerservice/client/CustomerServiceSpringClient.java?rev=1097532&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/jms_spring_config/src/main/java/com/example/customerservice/client/CustomerServiceSpringClient.java
(added)
+++ cxf/trunk/distribution/src/main/release/samples/jms_spring_config/src/main/java/com/example/customerservice/client/CustomerServiceSpringClient.java
Thu Apr 28 16:21:22 2011
@@ -0,0 +1,39 @@
+/**
+ * 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.
+ */
+package com.example.customerservice.client;
+
+
+
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public final class CustomerServiceSpringClient {
+
+    private CustomerServiceSpringClient() {
+    }
+
+    public static void main(String args[]) throws Exception {
+        // Initialize the spring context and fetch our test client
+        ClassPathXmlApplicationContext context 
+            = new ClassPathXmlApplicationContext(new String[] {"classpath:client-applicationContext.xml"});
+        CustomerServiceTester client = (CustomerServiceTester)context.getBean("tester");
+        
+        client.testCustomerService();
+        System.exit(0);
+    }
+}

Added: cxf/trunk/distribution/src/main/release/samples/jms_spring_config/src/main/java/com/example/customerservice/client/CustomerServiceTester.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/jms_spring_config/src/main/java/com/example/customerservice/client/CustomerServiceTester.java?rev=1097532&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/jms_spring_config/src/main/java/com/example/customerservice/client/CustomerServiceTester.java
(added)
+++ cxf/trunk/distribution/src/main/release/samples/jms_spring_config/src/main/java/com/example/customerservice/client/CustomerServiceTester.java
Thu Apr 28 16:21:22 2011
@@ -0,0 +1,75 @@
+/**
+ * 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.
+ */
+
+package com.example.customerservice.client;
+
+import java.util.List;
+
+import junit.framework.Assert;
+
+import com.example.customerservice.Customer;
+import com.example.customerservice.CustomerService;
+import com.example.customerservice.NoSuchCustomerException;
+
+public final class CustomerServiceTester {
+    
+    // The CustomerService proxy will be injected either by spring or by a direct call to
the setter 
+    CustomerService customerService;
+    
+    public CustomerService getCustomerService() {
+        return customerService;
+    }
+
+    public void setCustomerService(CustomerService customerService) {
+        this.customerService = customerService;
+    }
+
+    public void testCustomerService() throws NoSuchCustomerException {
+        List<Customer> customers = null;
+        
+        // First we test the positive case where customers are found and we retreive
+        // a list of customers
+        System.out.println("Sending request for customers named Smith");
+        customers = customerService.getCustomersByName("Smith");
+        System.out.println("Response received");
+        Assert.assertEquals(2, customers.size());
+        Assert.assertEquals("Smith", customers.get(0).getName());
+        
+        // Then we test for an unknown Customer name and expect the NoSuchCustomerException
+        try {
+            customers = customerService.getCustomersByName("None");
+            Assert.fail("We should get a NoSuchCustomerException here");
+        } catch (NoSuchCustomerException e) {
+            System.out.println(e.getMessage());
+            Assert.assertNotNull("FaultInfo must not be null", e.getFaultInfo());
+            Assert.assertEquals("None", e.getFaultInfo().getCustomerName());
+            System.out.println("NoSuchCustomer exception was received as expected");
+        }
+        
+        // The implementation of updateCustomer is set to sleep for some seconds. 
+        // Still this method should return instantly as the method is declared
+        // as a one way method in the WSDL
+        Customer customer = new Customer();
+        customer.setName("Smith");
+        customerService.updateCustomer(customer);
+        
+        System.out.println("All calls were successful");
+    }
+
+}

Added: cxf/trunk/distribution/src/main/release/samples/jms_spring_config/src/main/java/com/example/customerservice/server/CustomerServiceImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/jms_spring_config/src/main/java/com/example/customerservice/server/CustomerServiceImpl.java?rev=1097532&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/jms_spring_config/src/main/java/com/example/customerservice/server/CustomerServiceImpl.java
(added)
+++ cxf/trunk/distribution/src/main/release/samples/jms_spring_config/src/main/java/com/example/customerservice/server/CustomerServiceImpl.java
Thu Apr 28 16:21:22 2011
@@ -0,0 +1,80 @@
+/**
+ * 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.
+ */
+package com.example.customerservice.server;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.List;
+
+import javax.annotation.Resource;
+import javax.xml.ws.WebServiceContext;
+
+import com.example.customerservice.Customer;
+import com.example.customerservice.CustomerService;
+import com.example.customerservice.CustomerType;
+import com.example.customerservice.NoSuchCustomer;
+import com.example.customerservice.NoSuchCustomerException;
+
+public class CustomerServiceImpl implements CustomerService {
+    
+    /**
+     * The WebServiceContext can be used to retrieve special attributes like the 
+     * user principal. Normally it is not needed
+     */
+    @Resource
+    WebServiceContext wsContext;
+
+    public List<Customer> getCustomersByName(String name) throws NoSuchCustomerException
{
+        if ("None".equals(name)) {
+            NoSuchCustomer noSuchCustomer = new NoSuchCustomer();
+            noSuchCustomer.setCustomerName(name);
+            throw new NoSuchCustomerException("Did not find any matching customer for name="
+ name,
+                                              noSuchCustomer);
+        }
+
+        List<Customer> customers = new ArrayList<Customer>();
+        for (int c = 0; c < 2; c++) {
+            Customer cust = new Customer();
+            cust.setName(name);
+            cust.getAddress().add("Pine Street 200");
+            Date bDate = new GregorianCalendar(2009, 01, 01).getTime();
+            cust.setBirthDate(bDate);
+            cust.setNumOrders(1);
+            cust.setRevenue(10000);
+            cust.setTest(new BigDecimal(1.5));
+            cust.setType(CustomerType.BUSINESS);
+            customers.add(cust);
+        }
+
+        return customers;
+    }
+
+    public void updateCustomer(Customer customer) {
+        System.out.println("update request was received");
+        try {
+            Thread.sleep(10000);
+        } catch (InterruptedException e) {
+            // Nothing to do here
+        }
+        System.out.println("Customer was updated");
+    }
+
+}

Added: cxf/trunk/distribution/src/main/release/samples/jms_spring_config/src/main/java/com/example/customerservice/server/CustomerServiceSpringServer.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/jms_spring_config/src/main/java/com/example/customerservice/server/CustomerServiceSpringServer.java?rev=1097532&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/jms_spring_config/src/main/java/com/example/customerservice/server/CustomerServiceSpringServer.java
(added)
+++ cxf/trunk/distribution/src/main/release/samples/jms_spring_config/src/main/java/com/example/customerservice/server/CustomerServiceSpringServer.java
Thu Apr 28 16:21:22 2011
@@ -0,0 +1,32 @@
+/**
+ * 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.
+ */
+package com.example.customerservice.server;
+
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class CustomerServiceSpringServer {
+    
+    protected CustomerServiceSpringServer() {
+    }
+
+    public static void main(String args[]) throws Exception {
+        new ClassPathXmlApplicationContext("server-applicationContext.xml");
+        System.in.read();
+    }
+}

Added: cxf/trunk/distribution/src/main/release/samples/jms_spring_config/src/main/resources/client-applicationContext.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/jms_spring_config/src/main/resources/client-applicationContext.xml?rev=1097532&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/jms_spring_config/src/main/resources/client-applicationContext.xml
(added)
+++ cxf/trunk/distribution/src/main/release/samples/jms_spring_config/src/main/resources/client-applicationContext.xml
Thu Apr 28 16:21:22 2011
@@ -0,0 +1,53 @@
+<?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.
+	-->
+<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>
+</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:features>
+			<bean class="org.apache.cxf.feature.LoggingFeature" />
+			<bean class="org.apache.cxf.transport.jms.JMSConfigFeature" p:jmsConfig-ref="jmsConfig"
/>
+		</jaxws:features>
+	</jaxws:client>
+	
+	<bean id="tester" class="com.example.customerservice.client.CustomerServiceTester">
+		<property name="customerService" ref="customerService"></property>
+	</bean>
+</beans>

Added: cxf/trunk/distribution/src/main/release/samples/jms_spring_config/src/main/resources/log4j.conf
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/jms_spring_config/src/main/resources/log4j.conf?rev=1097532&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/jms_spring_config/src/main/resources/log4j.conf
(added)
+++ cxf/trunk/distribution/src/main/release/samples/jms_spring_config/src/main/resources/log4j.conf
Thu Apr 28 16:21:22 2011
@@ -0,0 +1,6 @@
+log4j.rootLogger = INFO, console
+
+log4j.appender.console=org.apache.log4j.ConsoleAppender
+
+log4j.appender.console.layout=org.apache.log4j.PatternLayout
+log4j.appender.console.layout.ConversionPattern=%-5p %c %x - %m%n

Added: cxf/trunk/distribution/src/main/release/samples/jms_spring_config/src/main/resources/server-applicationContext.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/jms_spring_config/src/main/resources/server-applicationContext.xml?rev=1097532&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/jms_spring_config/src/main/resources/server-applicationContext.xml
(added)
+++ cxf/trunk/distribution/src/main/release/samples/jms_spring_config/src/main/resources/server-applicationContext.xml
Thu Apr 28 16:21:22 2011
@@ -0,0 +1,49 @@
+<?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.
+	-->
+<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>
+</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:features>
+			<bean class="org.apache.cxf.feature.LoggingFeature" />
+			<bean class="org.apache.cxf.transport.jms.JMSConfigFeature" p:jmsConfig-ref="jmsConfig"
/>
+		</jaxws:features>
+	</jaxws:endpoint>
+
+</beans>

Added: cxf/trunk/distribution/src/main/release/samples/jms_spring_config/wsdl/CustomerService.wsdl
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/jms_spring_config/wsdl/CustomerService.wsdl?rev=1097532&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/jms_spring_config/wsdl/CustomerService.wsdl
(added)
+++ cxf/trunk/distribution/src/main/release/samples/jms_spring_config/wsdl/CustomerService.wsdl
Thu Apr 28 16:21:22 2011
@@ -0,0 +1,123 @@
+<?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.
+-->
+<wsdl:definitions name="CustomerServiceService" targetNamespace="http://customerservice.example.com/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://customerservice.example.com/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
+  <wsdl:types>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://customerservice.example.com/"
attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://customerservice.example.com/">
+<xs:element name="getCustomersByName" type="tns:getCustomersByName"/>
+<xs:element name="getCustomersByNameResponse" type="tns:getCustomersByNameResponse"/>
+<xs:element name="updateCustomer" type="tns:updateCustomer"/>
+<xs:complexType name="updateCustomer">
+<xs:sequence>
+<xs:element minOccurs="0" name="customer" type="tns:customer"/>
+</xs:sequence>
+</xs:complexType>
+<xs:complexType name="customer">
+<xs:sequence>
+<xs:element name="customerId" type="xs:int"/>
+<xs:element minOccurs="0" name="name" type="xs:string"/>
+<xs:element maxOccurs="unbounded" minOccurs="0" name="address" nillable="true" type="xs:string"/>
+<xs:element minOccurs="0" name="numOrders" type="xs:int"/>
+<xs:element name="revenue" type="xs:double"/>
+<xs:element minOccurs="0" name="test" type="xs:decimal"/>
+<xs:element minOccurs="0" name="birthDate" type="xs:date"/>
+<xs:element minOccurs="0" name="type" type="tns:customerType"/>
+</xs:sequence>
+</xs:complexType>
+<xs:complexType name="getCustomersByName">
+<xs:sequence>
+<xs:element minOccurs="0" name="name" type="xs:string"/>
+</xs:sequence>
+</xs:complexType>
+<xs:complexType name="getCustomersByNameResponse">
+<xs:sequence>
+<xs:element maxOccurs="unbounded" minOccurs="0" name="return" type="tns:customer"/>
+</xs:sequence>
+</xs:complexType>
+<xs:simpleType name="customerType">
+<xs:restriction base="xs:string">
+<xs:enumeration value="PRIVATE"/>
+<xs:enumeration value="BUSINESS"/>
+</xs:restriction>
+</xs:simpleType>
+<xs:element name="NoSuchCustomer" type="tns:NoSuchCustomer"/>
+<xs:complexType name="NoSuchCustomer">
+<xs:sequence>
+<xs:element name="customerName" nillable="true" type="xs:string"/>
+</xs:sequence>
+</xs:complexType>
+</xs:schema>
+  </wsdl:types>
+  <wsdl:message name="getCustomersByNameResponse">
+    <wsdl:part name="parameters" element="tns:getCustomersByNameResponse">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:message name="getCustomersByName">
+    <wsdl:part name="parameters" element="tns:getCustomersByName">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:message name="updateCustomer">
+    <wsdl:part name="parameters" element="tns:updateCustomer">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:message name="NoSuchCustomerException">
+    <wsdl:part name="NoSuchCustomerException" element="tns:NoSuchCustomer">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:portType name="CustomerService">
+    <wsdl:operation name="updateCustomer">
+      <wsdl:input name="updateCustomer" message="tns:updateCustomer">
+    </wsdl:input>
+    </wsdl:operation>
+    <wsdl:operation name="getCustomersByName">
+      <wsdl:input name="getCustomersByName" message="tns:getCustomersByName">
+    </wsdl:input>
+      <wsdl:output name="getCustomersByNameResponse" message="tns:getCustomersByNameResponse">
+    </wsdl:output>
+      <wsdl:fault name="NoSuchCustomerException" message="tns:NoSuchCustomerException">
+    </wsdl:fault>
+    </wsdl:operation>
+  </wsdl:portType>
+  <wsdl:binding name="CustomerServiceServiceSoapBinding" type="tns:CustomerService">
+    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+    <wsdl:operation name="updateCustomer">
+      <soap:operation soapAction="" style="document"/>
+      <wsdl:input name="updateCustomer">
+        <soap:body use="literal"/>
+      </wsdl:input>
+    </wsdl:operation>
+    <wsdl:operation name="getCustomersByName">
+      <soap:operation soapAction="" style="document"/>
+      <wsdl:input name="getCustomersByName">
+        <soap:body use="literal"/>
+      </wsdl:input>
+      <wsdl:output name="getCustomersByNameResponse">
+        <soap:body use="literal"/>
+      </wsdl:output>
+      <wsdl:fault name="NoSuchCustomerException">
+        <soap:fault name="NoSuchCustomerException" use="literal"/>
+      </wsdl:fault>
+    </wsdl:operation>
+  </wsdl:binding>
+  <wsdl:service name="CustomerServiceService">
+    <wsdl:port name="CustomerServicePort" binding="tns:CustomerServiceServiceSoapBinding">
+      <soap:address location="http://localhost:9090/CustomerServicePort"/>
+    </wsdl:port>
+  </wsdl:service>
+</wsdl:definitions>

Added: cxf/trunk/distribution/src/main/release/samples/jms_spring_config/wsdl/binding.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/jms_spring_config/wsdl/binding.xml?rev=1097532&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/jms_spring_config/wsdl/binding.xml (added)
+++ cxf/trunk/distribution/src/main/release/samples/jms_spring_config/wsdl/binding.xml Thu
Apr 28 16:21:22 2011
@@ -0,0 +1,17 @@
+<jaxws:bindings wsdlLocation="CustomerService.wsdl"
+          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/">
+  <!-- <jaxws:enableAsyncMapping>true</jaxws:enableAsyncMapping> -->
+  <jaxws:bindings  node="wsdl:definitions/wsdl:types/xs:schema">
+      <jxb:globalBindings>
+        <jxb:javaType name="java.util.Date" xmlType="xs:dateTime"
+                      parseMethod="org.apache.cxf.tools.common.DataTypeAdapter.parseDateTime"
+                      printMethod="org.apache.cxf.tools.common.DataTypeAdapter.printDateTime"/>
+        <jxb:javaType name="java.util.Date" xmlType="xs:date"
+                      parseMethod="org.apache.cxf.tools.common.DataTypeAdapter.parseDate"
+                      printMethod="org.apache.cxf.tools.common.DataTypeAdapter.printDate"/>
+      </jxb:globalBindings>
+  </jaxws:bindings>
+</jaxws:bindings>
\ No newline at end of file

Modified: cxf/trunk/distribution/src/main/release/samples/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/pom.xml?rev=1097532&r1=1097531&r2=1097532&view=diff
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/pom.xml (original)
+++ cxf/trunk/distribution/src/main/release/samples/pom.xml Thu Apr 28 16:21:22 2011
@@ -54,6 +54,7 @@
         <module>wsdl_first_soap12</module>
         <module>wsdl_first_dynamic_client</module>
         <module>jms_queue</module>
+        <module>jms_spring_config</module>
         <module>restful_dispatch</module>
         <module>wsdl_first</module>
         <module>aegis_standalone</module>



Mime
View raw message