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 16:00:54 UTC
svn commit: r681698 - in
/cxf/trunk/distribution/src/main/release/samples/ws_policy: ./
src/demo/ws_policy/client/ src/demo/ws_policy/server/
Author: seanoc
Date: Fri Aug 1 07:00:53 2008
New Revision: 681698
URL: http://svn.apache.org/viewvc?rev=681698&view=rev
Log:
Updated ws_policy demo to be built and ran using maven
Added:
cxf/trunk/distribution/src/main/release/samples/ws_policy/pom.xml
cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/ws_policy/client/client.xml
cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/ws_policy/server/server.xml
Removed:
cxf/trunk/distribution/src/main/release/samples/ws_policy/client.xml
cxf/trunk/distribution/src/main/release/samples/ws_policy/server.xml
Modified:
cxf/trunk/distribution/src/main/release/samples/ws_policy/README.txt
cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/ws_policy/client/Client.java
cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/ws_policy/server/Server.java
Modified: cxf/trunk/distribution/src/main/release/samples/ws_policy/README.txt
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/ws_policy/README.txt?rev=681698&r1=681697&r2=681698&view=diff
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/ws_policy/README.txt (original)
+++ cxf/trunk/distribution/src/main/release/samples/ws_policy/README.txt Fri Aug 1 07:00:53 2008
@@ -58,6 +58,26 @@
files, run "ant clean".
+Building and running the demo using maven
+---------------------------------------
+
+From the samples/ws_policy directory, the maven pom.xml can be used to
+build and run the demo.
+
+Using either UNIX or Windows:
+
+ mvn install (builds the demo)
+ mvn -Pserver
+ mvn -Pclient
+
+Although not explicitly instructed to use these interceptors,
+both client and server will use the MAPAggregator and MAPCodec
+interceptors 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
------------------------------------------
Added: cxf/trunk/distribution/src/main/release/samples/ws_policy/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/ws_policy/pom.xml?rev=681698&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/ws_policy/pom.xml (added)
+++ cxf/trunk/distribution/src/main/release/samples/ws_policy/pom.xml Fri Aug 1 07:00:53 2008
@@ -0,0 +1,176 @@
+<?xml version="1.0"?>
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.cxf.samples</groupId>
+ <artifactId>ws_policy</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_policy.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_policy/client/client.xml" todir="${basedir}/target/classes/demo/ws_policy/client"/>
+ <copy file="${basedir}/src/demo/ws_policy/server/server.xml" todir="${basedir}/target/classes/demo/ws_policy/server"/>
+ <copy file="${basedir}/addr-external.xml" todir="${basedir}/target/classes/"/>
+ </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_policy.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_policy.client.Client</mainClass>
+ </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-policy</artifactId>
+ <version>${cxf.version}</version>
+ </dependency>
+ </dependencies>
+</project>
Modified: cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/ws_policy/client/Client.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/ws_policy/client/Client.java?rev=681698&r1=681697&r2=681698&view=diff
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/ws_policy/client/Client.java (original)
+++ cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/ws_policy/client/Client.java Fri Aug 1 07:00:53 2008
@@ -19,44 +19,54 @@
package demo.ws_policy.client;
+import java.net.URL;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.bus.spring.SpringBusFactory;
import org.apache.hello_world_soap_http.Greeter;
import org.apache.hello_world_soap_http.PingMeFault;
import org.apache.hello_world_soap_http.SOAPService;
public final class Client {
-
+
private static final String USER_NAME = System.getProperty("user.name");
private Client() {
- }
+ }
public static void main(String args[]) {
- try {
+ try {
+
+ SpringBusFactory bf = new SpringBusFactory();
+ URL busFile = Client.class.getResource("client.xml");
+ Bus bus = bf.createBus(busFile.toString());
+ bf.setDefaultBus(bus);
+
SOAPService service = new SOAPService();
Greeter port = service.getSoapPort();
System.out.println("Invoking sayHi...");
String resp = port.sayHi();
System.out.println("Server responded with: " + resp + "\n");
-
+
System.out.println("Invoking greetMe...");
resp = port.greetMe(USER_NAME);
System.out.println("Server responded with: " + resp + "\n");
-
+
System.out.println("Invoking greetMeOneWay...");
port.greetMeOneWay(USER_NAME);
System.out.println("No response from server as method is OneWay\n");
-
+
try {
System.out.println("Invoking pingMe, expecting exception...");
port.pingMe();
} catch (PingMeFault ex) {
System.out.println("Expected exception occurred: " + ex);
}
- } catch (Exception ex) {
+ } catch (Exception ex) {
ex.printStackTrace();
- } finally {
- System.exit(0);
+ } finally {
+ System.exit(0);
}
}
Added: cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/ws_policy/client/client.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/ws_policy/client/client.xml?rev=681698&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/ws_policy/client/client.xml (added)
+++ cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/ws_policy/client/client.xml Fri Aug 1 07:00:53 2008
@@ -0,0 +1,41 @@
+<?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:p="http://cxf.apache.org/policy"
+ xmlns:http="http://cxf.apache.org/transports/http/configuration"
+ xsi:schemaLocation="
+http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd
+http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
+http://cxf.apache.org/policy http://cxf.apache.org/schemas/policy.xsd
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.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>
+ <p:policies/>
+ </cxf:features>
+ </cxf:bus>
+
+</beans>
Modified: cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/ws_policy/server/Server.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/ws_policy/server/Server.java?rev=681698&r1=681697&r2=681698&view=diff
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/ws_policy/server/Server.java (original)
+++ cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/ws_policy/server/Server.java Fri Aug 1 07:00:53 2008
@@ -19,24 +19,32 @@
package demo.ws_policy.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_policy/src/demo/ws_policy/server/server.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/ws_policy/server/server.xml?rev=681698&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/ws_policy/server/server.xml (added)
+++ cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/ws_policy/server/server.xml Fri Aug 1 07:00:53 2008
@@ -0,0 +1,37 @@
+<?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:p="http://cxf.apache.org/policy"
+ xsi:schemaLocation="
+http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
+http://cxf.apache.org/policy http://cxf.apache.org/schemas/policy.xsd
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
+
+ <cxf:bus>
+ <cxf:features>
+ <p:policies/>
+ </cxf:features>
+ </cxf:bus>
+
+ <p:externalAttachment location="addr-external.xml"/>
+
+</beans>