cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sea...@apache.org
Subject svn commit: r687783 - in /cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean: ./ src/ src/demo/ src/demo/hw/ src/demo/hw/client/ src/demo/hw/server/ wsdl/
Date Thu, 21 Aug 2008 15:37:33 GMT
Author: seanoc
Date: Thu Aug 21 08:37:32 2008
New Revision: 687783

URL: http://svn.apache.org/viewvc?rev=687783&view=rev
Log:
Added demo illustrating use of JaxWSFactoryBeans.
https://issues.apache.org/jira/browse/CXF-1125

Added:
    cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean/
    cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean/README.txt
    cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean/build.xml
    cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean/pom.xml
    cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean/src/
    cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean/src/demo/
    cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean/src/demo/hw/
    cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean/src/demo/hw/client/
    cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean/src/demo/hw/client/Client.java
    cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean/src/demo/hw/server/
    cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean/src/demo/hw/server/HelloWorld.java
    cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean/src/demo/hw/server/HelloWorldImpl.java
    cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean/src/demo/hw/server/Server.java
    cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean/wsdl/
    cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean/wsdl/cxf-servlet.xml

Added: cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean/README.txt
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean/README.txt?rev=687783&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean/README.txt
(added)
+++ cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean/README.txt
Thu Aug 21 08:37:32 2008
@@ -0,0 +1,99 @@
+Java First demo using jax-ws APIs and jsr-181
+=============================================
+
+This demo illustrates how to develop a service using the JAXWSFactoryBeans.
+It also makes use of LoggingInterceptors.
+The demo takes the "code first" approach using JAX-WS APIs.
+
+
+Prerequisite
+------------
+
+If your environment already includes cxf-manifest.jar on the
+CLASSPATH, and the JDK and ant bin directories on the PATH
+it is not necessary to set the environment as described in
+the samples directory README.  If your environment is not
+properly configured, or if you are planning on using wsdl2java,
+javac, and java to build and run the demos, you must set the
+environment.
+
+
+Building and running the demo using ant
+---------------------------------------
+
+From the base directory of this sample (i.e., where this README file is
+located), the Ant build.xml file can be used to build and run the demo.
+The server and client targets automatically build the demo.
+
+Using either UNIX or Windows:
+
+  ant server  (from one command line window)
+  ant client  (from a second command line window)
+
+
+
+
+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 -Pserver  (from one command line window)
+  mvn -Pclient  (from a second command line window)
+
+
+To remove the code generated from the WSDL file and the .class
+files, run "mvn clean".
+
+
+Building the demo using javac
+-----------------------------
+
+From the base directory of this sample (i.e., where this README file is
+located), first create the target directory build/classes and then compile 
+the provided client and server code.
+
+For UNIX:  
+  
+  mkdir -p build/classes
+  export CLASSPATH=$CLASSPATH:$CXF_HOME/lib/cxf-manifest.jar:./build/classes
+  javac -d build/classes src/demo/hw/client/*.java
+  javac -d build/classes src/demo/hw/server/*.java
+
+For Windows:
+  mkdir build\classes
+  set classpath=%classpath%;%CXF_HOME%\lib\cxf-manifest.jar;.\build\classes
+  javac -d build\classes src\demo\hw\client\*.java
+  javac -d build\classes src\demo\hw\server\*.java
+
+
+Running the demo using java
+---------------------------
+
+From the base directory of this sample (i.e., where this README file is
+located) run the commands, entered on a single command line:
+
+For UNIX (must use forward slashes):
+    java -Djava.util.logging.config.file=$CXF_HOME/etc/logging.properties
+         demo.hw.server.Server &
+
+    java -Djava.util.logging.config.file=$CXF_HOME/etc/logging.properties
+         demo.hw.client.Client
+
+The server process starts in the background.  After running the client,
+use the kill command to terminate the server process.
+
+For Windows (may use either forward or back slashes):
+  start 
+    java -Djava.util.logging.config.file=%CXF_HOME%\etc\logging.properties
+         demo.hw.server.Server
+
+    java -Djava.util.logging.config.file=%CXF_HOME%\etc\logging.properties
+       demo.hw.client.Client
+
+A new command windows opens for the server process.  After running the
+client, terminate the server process by issuing Ctrl-C in its command window.

Added: cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean/build.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean/build.xml?rev=687783&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean/build.xml
(added)
+++ cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean/build.xml
Thu Aug 21 08:37:32 2008
@@ -0,0 +1,45 @@
+<?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.
+-->
+<project name="hello world code first demo" default="build" basedir=".">
+
+    <import file="../common_build.xml"/>        
+        
+    <target name="client" description="run demo client" depends="build">
+        <property name="param" value=""/>
+        <cxfrun classname="demo.hw.client.Client"
+            param1="" 
+            param2="${op}" 
+            param3="${param}"/>
+    </target> 
+        
+    <target name="server" description="run demo server" depends="build">
+        <cxfrun classname="demo.hw.server.Server"/>
+    </target>
+	
+    <property name="cxf.war.file.name" value="helloworld"/>
+    <target name="war" depends="build">
+        <cxfwar filename="${cxf.war.file.name}.war"/>
+    </target>
+
+    <target name="client-servlet" description="run demo client hitting servlet" depends="build">
+        <property name="param" value=""/>
+        <cxfrun classname="demo.hw.client.Client" param1="${base.url}/helloworld/services/hello_world?wsdl"
param2="${op}" param3="${param}"/>
+    </target> 
+</project>

Added: cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean/pom.xml?rev=687783&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean/pom.xml
(added)
+++ cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean/pom.xml
Thu Aug 21 08:37:32 2008
@@ -0,0 +1,128 @@
+<?xml version="1.0"?>
+<project>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.apache.cxf.samples</groupId>
+    <artifactId>java_first_jaxws_factory_bean</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>
+        </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>demo.hw.server.Server</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>demo.hw.client.Client</mainClass>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+        <profile>
+            <id>snapshots</id>
+            <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>
+                    <!-- 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>
+            </pluginRepositories>
+        </profile>
+    </profiles>
+    <repositories>
+            <!-- for jaxb-impl -->
+        <repository>
+            <id>java.net</id>
+            <url>http://download.java.net/maven/1/</url>
+            <layout>legacy</layout>
+        </repository>
+    </repositories>
+    <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>
+        <!-- Jetty is needed if you're using the CXFServlet -->
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-transports-http-jetty</artifactId>
+            <version>${cxf.version}</version>
+        </dependency>
+    </dependencies>
+</project>

Added: cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean/src/demo/hw/client/Client.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean/src/demo/hw/client/Client.java?rev=687783&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean/src/demo/hw/client/Client.java
(added)
+++ cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean/src/demo/hw/client/Client.java
Thu Aug 21 08:37:32 2008
@@ -0,0 +1,43 @@
+/**
+ * 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 demo.hw.client;
+
+import demo.hw.server.HelloWorld;
+
+import org.apache.cxf.interceptor.LoggingInInterceptor;
+import org.apache.cxf.interceptor.LoggingOutInterceptor;
+import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
+
+public final class Client {
+
+    private Client() {
+    } 
+
+    public static void main(String args[]) throws Exception {
+        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
+        factory.getInInterceptors().add(new LoggingInInterceptor());
+        factory.getOutInterceptors().add(new LoggingOutInterceptor());
+        factory.setServiceClass(HelloWorld.class);
+        factory.setAddress("http://localhost:9000/helloWorld");
+        HelloWorld client = (HelloWorld) factory.create();
+        System.out.println(client.sayHi("World"));
+    }
+
+}

Added: cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean/src/demo/hw/server/HelloWorld.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean/src/demo/hw/server/HelloWorld.java?rev=687783&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean/src/demo/hw/server/HelloWorld.java
(added)
+++ cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean/src/demo/hw/server/HelloWorld.java
Thu Aug 21 08:37:32 2008
@@ -0,0 +1,28 @@
+/**
+ * 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.
+ */
+// START SNIPPET: service
+package demo.hw.server;
+
+import javax.jws.WebParam;
+import javax.jws.WebService;
+
+@WebService
+public interface HelloWorld {
+    String sayHi(@WebParam(name = "text") String text);
+}

Added: cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean/src/demo/hw/server/HelloWorldImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean/src/demo/hw/server/HelloWorldImpl.java?rev=687783&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean/src/demo/hw/server/HelloWorldImpl.java
(added)
+++ cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean/src/demo/hw/server/HelloWorldImpl.java
Thu Aug 21 08:37:32 2008
@@ -0,0 +1,27 @@
+/**
+ * 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.
+ */
+// START SNIPPET: service
+package demo.hw.server;
+
+public class HelloWorldImpl implements HelloWorld {
+
+    public String sayHi(String text) {
+        return "Hello " + text;
+    }
+}

Added: cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean/src/demo/hw/server/Server.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean/src/demo/hw/server/Server.java?rev=687783&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean/src/demo/hw/server/Server.java
(added)
+++ cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean/src/demo/hw/server/Server.java
Thu Aug 21 08:37:32 2008
@@ -0,0 +1,48 @@
+/**
+ * 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 demo.hw.server;
+
+import org.apache.cxf.interceptor.LoggingInInterceptor;
+import org.apache.cxf.interceptor.LoggingOutInterceptor;
+import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
+
+public class Server {
+
+    protected Server() throws Exception {
+        System.out.println("Starting Server");
+        HelloWorldImpl implementor = new HelloWorldImpl();
+        JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
+        svrFactory.setServiceClass(HelloWorld.class);
+        svrFactory.setAddress("http://localhost:9000/helloWorld");
+        svrFactory.setServiceBean(implementor);
+        svrFactory.getInInterceptors().add(new LoggingInInterceptor());
+        svrFactory.getOutInterceptors().add(new LoggingOutInterceptor());
+        svrFactory.create();
+    }
+
+    public static void main(String args[]) throws Exception {
+        new Server();
+        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/java_first_jaxws_factory_bean/wsdl/cxf-servlet.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean/wsdl/cxf-servlet.xml?rev=687783&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean/wsdl/cxf-servlet.xml
(added)
+++ cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean/wsdl/cxf-servlet.xml
Thu Aug 21 08:37:32 2008
@@ -0,0 +1,35 @@
+<?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:soap="http://cxf.apache.org/bindings/soap"
+      xsi:schemaLocation="
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+http://cxf.apache.org/bindings/soap http://cxf.apache.org/schemas/configuration/soap.xsd
+http://cxf.apache.org/jaxws
+http://cxf.apache.org/schemas/jaxws.xsd">
+
+  <jaxws:server id="jaxwsService" serviceClass="demo.hw.server.HelloWorld" address="/hello_world">
+  	<jaxws:serviceBean>
+  		<bean class="demo.hw.server.HelloWorldImpl" />
+  	</jaxws:serviceBean>
+  </jaxws:server>
+</beans>



Mime
View raw message