You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2008/08/01 13:19:18 UTC

svn commit: r681653 - in /cxf/trunk/distribution/src/main/release/samples/ws_addressing: ./ src/demo/ws_addressing/client/ src/demo/ws_addressing/server/

Author: seanoc
Date: Fri Aug  1 04:19:18 2008
New Revision: 681653

URL: http://svn.apache.org/viewvc?rev=681653&view=rev
Log:
Enabled demo to be built and run using maven

Added:
    cxf/trunk/distribution/src/main/release/samples/ws_addressing/pom.xml
    cxf/trunk/distribution/src/main/release/samples/ws_addressing/src/demo/ws_addressing/client/client.xml
    cxf/trunk/distribution/src/main/release/samples/ws_addressing/src/demo/ws_addressing/server/server.xml
Removed:
    cxf/trunk/distribution/src/main/release/samples/ws_addressing/client.xml
    cxf/trunk/distribution/src/main/release/samples/ws_addressing/server.xml
Modified:
    cxf/trunk/distribution/src/main/release/samples/ws_addressing/README.txt
    cxf/trunk/distribution/src/main/release/samples/ws_addressing/build.xml
    cxf/trunk/distribution/src/main/release/samples/ws_addressing/src/demo/ws_addressing/client/Client.java
    cxf/trunk/distribution/src/main/release/samples/ws_addressing/src/demo/ws_addressing/server/Server.java

Modified: cxf/trunk/distribution/src/main/release/samples/ws_addressing/README.txt
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/ws_addressing/README.txt?rev=681653&r1=681652&r2=681653&view=diff
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/ws_addressing/README.txt (original)
+++ cxf/trunk/distribution/src/main/release/samples/ws_addressing/README.txt Fri Aug  1 04:19:18 2008
@@ -65,6 +65,24 @@
 files, run "ant clean".
 
 
+Building and running the demo using maven
+---------------------------------------
+From the base directory of this sample (i.e., where this README file is
+located), the maven pom.xml file can be used to build and run the demo. 
+
+Using either UNIX or Windows:
+
+  mvn install (builds the demo)
+  mvn -Pserver  (from one command line window)
+  Mvn -Pclient  (from a second command line window)
+
+Both client and server will use the MAPAggregator and MAPCodec
+handlers to aggregate and encode the WS-Addressing MAPs.
+
+To remove the code generated from the WSDL file and the .class
+files, run "mvn clean".
+
+
 Building the demo using wsdl2java and javac
 -------------------------------------------
 

Modified: cxf/trunk/distribution/src/main/release/samples/ws_addressing/build.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/ws_addressing/build.xml?rev=681653&r1=681652&r2=681653&view=diff
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/ws_addressing/build.xml (original)
+++ cxf/trunk/distribution/src/main/release/samples/ws_addressing/build.xml Fri Aug  1 04:19:18 2008
@@ -24,14 +24,11 @@
     <target name="client" description="run demo client" depends="build">
         <cxfrun classname="demo.ws_addressing.client.Client"
                 param1="${basedir}/wsdl/hello_world_addr.wsdl"
-                jvmarg1="-Dcxf.config.file=client.xml"
                 logging-properties-file="./logging.properties"/>
     </target>
 
     <target name="server" description="run demo server" depends="build">
         <cxfrun classname="demo.ws_addressing.server.Server"
-                param1="${basedir}/wsdl/hello_world_addr.wsdl"
-                jvmarg1="-Dcxf.config.file=server.xml"
                 logging-properties-file="./logging.properties"/>
     </target>
 
@@ -48,8 +45,7 @@
 
     <target name="client-servlet" description="run demo client hitting servlet" depends="build">
         <property name="param" value=""/>
-        <cxfrun classname="demo.ws_addressing.client.Client" 
-            jvmarg1="-Dcxf.config.file=client.xml"
+        <cxfrun classname="demo.ws_addressing.client.Client"
             param1="${base.url}/helloworld_wsaddr/services/hello_world?wsdl" 
             param2="${op}" param3="${param}"/>
     </target>

Added: cxf/trunk/distribution/src/main/release/samples/ws_addressing/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/ws_addressing/pom.xml?rev=681653&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/ws_addressing/pom.xml (added)
+++ cxf/trunk/distribution/src/main/release/samples/ws_addressing/pom.xml Fri Aug  1 04:19:18 2008
@@ -0,0 +1,179 @@
+<?xml version="1.0"?>
+<project>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.apache.cxf.samples</groupId>
+    <artifactId>ws_addressing</artifactId>
+    <version>1.0</version>
+    <properties>
+        <cxf.version>[2,)</cxf.version>
+    </properties>
+    <build>
+        <sourceDirectory>src</sourceDirectory>
+        <plugins>
+            <plugin>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.5</source> 
+                    <target>1.5</target>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.cxf</groupId>
+                <artifactId>cxf-codegen-plugin</artifactId>
+                <version>LATEST</version>
+                <executions>
+                    <execution>
+                        <id>generate-sources</id>
+                        <phase>generate-sources</phase>
+                        <configuration>
+                            <wsdlOptions>
+                                <wsdlOption>
+                                    <wsdl>${basedir}/wsdl/hello_world_addr.wsdl</wsdl>
+                                </wsdlOption>
+                            </wsdlOptions>
+                        </configuration>
+                        <goals>
+                            <goal>wsdl2java</goal>
+                        </goals>
+                    </execution>
+               </executions>
+           </plugin>
+           <plugin>
+                <artifactId>maven-antrun-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>copyxmlfiles</id>
+                        <phase>generate-sources</phase>
+	    	        <goals>
+	    	            <goal>run</goal>
+	    	        </goals>
+	    	        <configuration>
+	    	            <tasks>
+	    	               <copy file="${basedir}/src/demo/ws_addressing/client/client.xml" todir="${basedir}/target/classes/demo/ws_addressing/client"/>
+	    	               <copy file="${basedir}/src/demo/ws_addressing/server/server.xml" todir="${basedir}/target/classes/demo/ws_addressing/server"/>
+	    	            </tasks>
+	    	        </configuration>
+	    	    </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>exec</goal>
+                                </goals>
+                                <configuration>
+                                    <executable>java</executable>
+                                    <arguments>
+                                        <argument>-classpath</argument>
+                                        <classpath/>
+                                        <argument>demo.ws_addressing.server.Server</argument>
+                                    </arguments>
+                                </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>demo.ws_addressing.client.Client</mainClass>
+                                    <arguments>
+                                        <argument>${basedir}/wsdl/hello_world_addr.wsdl</argument>
+                                        <argument>insecure</argument>
+                                   </arguments>
+                               </configuration>
+                           </execution>
+                       </executions>
+                   </plugin>
+               </plugins>
+           </build>
+        </profile>
+    </profiles>
+    <repositories>
+        <repository>
+            <id>apache-snapshots</id>
+            <name>Apache SNAPSHOT Repository</name>
+            <url>http://people.apache.org/repo/m2-snapshot-repository/</url>
+            <snapshots>
+                <enabled>true</enabled>
+            </snapshots>
+        </repository>
+        <repository>
+	    <id>apache-incubating</id>
+	    <name>Apache Incubating Repository</name>
+	    <url>http://people.apache.org/repo/m2-incubating-repository/</url>
+	</repository>
+	<!-- for jaxb-impl -->
+        <repository>
+            <id>java.net</id>
+            <url>http://download.java.net/maven/1/</url>
+            <layout>legacy</layout>
+        </repository>
+    </repositories>
+    <pluginRepositories>
+        <pluginRepository>
+            <id>apache-plugin-snapshots</id>
+            <name>Apache Maven Plugin Snapshots</name>
+            <url>http://people.apache.org/repo/m2-snapshot-repository</url>
+            <releases>
+                <enabled>false</enabled>
+            </releases>
+            <snapshots>
+                <enabled>true</enabled>
+            </snapshots>
+        </pluginRepository>
+        <pluginRepository>
+            <id>apache-plugin-incubating</id>
+            <name>Apache Plugin Incubating Repository</name>
+            <url>http://people.apache.org/repo/m2-incubating-repository/</url>
+        </pluginRepository>
+    </pluginRepositories>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-frontend-jaxws</artifactId>
+            <version>${cxf.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-transports-http</artifactId>
+            <version>${cxf.version}</version>
+        </dependency>
+        <dependency>
+             <groupId>org.apache.cxf</groupId>
+             <artifactId>cxf-rt-transports-http-jetty</artifactId>
+             <version>${cxf.version}</version>
+        </dependency>
+        <dependency>
+             <groupId>org.apache.cxf</groupId>
+             <artifactId>cxf-rt-ws-addr</artifactId>
+             <version>${cxf.version}</version>
+        </dependency>
+   </dependencies>
+</project>

Modified: cxf/trunk/distribution/src/main/release/samples/ws_addressing/src/demo/ws_addressing/client/Client.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/ws_addressing/src/demo/ws_addressing/client/Client.java?rev=681653&r1=681652&r2=681653&view=diff
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/ws_addressing/src/demo/ws_addressing/client/Client.java (original)
+++ cxf/trunk/distribution/src/main/release/samples/ws_addressing/src/demo/ws_addressing/client/Client.java Fri Aug  1 04:19:18 2008
@@ -26,6 +26,8 @@
 import javax.xml.namespace.QName;
 import javax.xml.ws.BindingProvider;
 
+import org.apache.cxf.Bus;
+import org.apache.cxf.bus.spring.SpringBusFactory;
 import org.apache.cxf.ws.addressing.AddressingBuilder;
 import org.apache.cxf.ws.addressing.AddressingProperties;
 import org.apache.cxf.ws.addressing.AttributedURIType;
@@ -39,25 +41,25 @@
 
 
 public final class Client {
-    
-    private static final QName SERVICE_NAME = 
+
+    private static final QName SERVICE_NAME =
         new QName("http://apache.org/hello_world_soap_http", "SOAPService");
-    private static final ObjectFactory WSA_OBJECT_FACTORY = 
+    private static final ObjectFactory WSA_OBJECT_FACTORY =
         new ObjectFactory();
     private static final String USER_NAME = System.getProperty("user.name");
 
 
     private Client() {
-    } 
+    }
 
     public static void main(String args[]) throws Exception {
-        if (args.length == 0) { 
+        if (args.length == 0) {
             System.out.println("please specify wsdl");
-            System.exit(1); 
+            System.exit(1);
         }
-        
+
         try {
-            URL wsdlURL; 
+            URL wsdlURL;
             File wsdlFile = new File(args[0]);
             if (wsdlFile.exists()) {
                 wsdlURL = wsdlFile.toURL();
@@ -65,6 +67,12 @@
                 wsdlURL = new URL(args[0]);
             }
 
+            SpringBusFactory bf = new SpringBusFactory();
+            URL busFile = Client.class.getResource("client.xml");
+            Bus bus = bf.createBus(busFile.toString());
+            bf.setDefaultBus(bus);
+
+
             SOAPService service = new SOAPService(wsdlURL, SERVICE_NAME);
             Greeter port = service.getSoapPort();
 
@@ -74,12 +82,12 @@
 
             implicitPropagation(port);
 
-        } catch (UndeclaredThrowableException ex) { 
+        } catch (UndeclaredThrowableException ex) {
             ex.getUndeclaredThrowable().printStackTrace();
-        } catch (Exception ex) { 
+        } catch (Exception ex) {
             ex.printStackTrace();
-        }  finally { 
-            System.exit(0); 
+        }  finally {
+            System.exit(0);
         }
     }
 
@@ -126,7 +134,7 @@
         AddressingProperties maps = builder.newAddressingProperties();
 
         // set MessageID property
-        AttributedURIType messageID = 
+        AttributedURIType messageID =
             WSA_OBJECT_FACTORY.createAttributedURIType();
         messageID.setValue("urn:uuid:" + System.currentTimeMillis());
         maps.setMessageID(messageID);
@@ -140,7 +148,7 @@
         String resp = port.sayHi();
         System.out.println("Server responded with: " + resp + "\n");
 
-        // clear the message ID to ensure a duplicate is not sent on the 
+        // clear the message ID to ensure a duplicate is not sent on the
         // next invocation
         maps.setMessageID(null);
 

Added: cxf/trunk/distribution/src/main/release/samples/ws_addressing/src/demo/ws_addressing/client/client.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/ws_addressing/src/demo/ws_addressing/client/client.xml?rev=681653&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/ws_addressing/src/demo/ws_addressing/client/client.xml (added)
+++ cxf/trunk/distribution/src/main/release/samples/ws_addressing/src/demo/ws_addressing/client/client.xml Fri Aug  1 04:19:18 2008
@@ -0,0 +1,40 @@
+<?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:cxf="http://cxf.apache.org/core"
+       xmlns:wsa="http://cxf.apache.org/ws/addressing"
+       xmlns:http="http://cxf.apache.org/transports/http/configuration"
+       xsi:schemaLocation="
+       http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
+       http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+  
+    <http:conduit name="{http://apache.org/hello_world_soap_http}SoapPort.http-conduit">
+      <http:client DecoupledEndpoint="http://localhost:9990/decoupled_endpoint"/>
+    </http:conduit>
+
+    <cxf:bus>
+        <cxf:features>
+            <wsa:addressing/>
+        </cxf:features>
+    </cxf:bus>
+    
+</beans>

Modified: cxf/trunk/distribution/src/main/release/samples/ws_addressing/src/demo/ws_addressing/server/Server.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/ws_addressing/src/demo/ws_addressing/server/Server.java?rev=681653&r1=681652&r2=681653&view=diff
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/ws_addressing/src/demo/ws_addressing/server/Server.java (original)
+++ cxf/trunk/distribution/src/main/release/samples/ws_addressing/src/demo/ws_addressing/server/Server.java Fri Aug  1 04:19:18 2008
@@ -19,24 +19,32 @@
 
 package demo.ws_addressing.server;
 
+import java.net.URL;
 import javax.xml.ws.Endpoint;
 
+import org.apache.cxf.Bus;
+import org.apache.cxf.bus.spring.SpringBusFactory;
+
 public class Server {
 
     protected Server() throws Exception {
         System.out.println("Starting Server");
 
+        SpringBusFactory bf = new SpringBusFactory();
+        URL busFile = Server.class.getResource("server.xml");
+        Bus bus = bf.createBus(busFile.toString());
+        bf.setDefaultBus(bus);
 
         Object implementor = new GreeterImpl();
         String address = "http://localhost:9000/SoapContext/SoapPort";
         Endpoint.publish(address, implementor);
     }
-    
+
     public static void main(String args[]) throws Exception {
         new Server();
-        System.out.println("Server ready..."); 
-        
-        Thread.sleep(5 * 60 * 1000); 
+        System.out.println("Server ready...");
+
+        Thread.sleep(5 * 60 * 1000);
         System.out.println("Server exiting");
         System.exit(0);
     }

Added: cxf/trunk/distribution/src/main/release/samples/ws_addressing/src/demo/ws_addressing/server/server.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/ws_addressing/src/demo/ws_addressing/server/server.xml?rev=681653&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/ws_addressing/src/demo/ws_addressing/server/server.xml (added)
+++ cxf/trunk/distribution/src/main/release/samples/ws_addressing/src/demo/ws_addressing/server/server.xml Fri Aug  1 04:19:18 2008
@@ -0,0 +1,34 @@
+<?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:cxf="http://cxf.apache.org/core"
+       xmlns:wsa="http://cxf.apache.org/ws/addressing"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+  
+    <cxf:bus>
+        <cxf:features>
+            <wsa:addressing/>
+        </cxf:features>
+    </cxf:bus>
+
+</beans>