Author: ningjiang
Date: Thu Oct  9 22:51:41 2008
New Revision: 703324

URL: http://svn.apache.org/viewvc?rev=703324&view=rev
Log:
CXF-1842 added an example to show how to publish the WSDL first endpoints from 
spring

Added:
    
cxf/trunk/distribution/src/main/release/samples/wsdl_first/src/demo/hw/client/SpringClient.java
   (with props)
    
cxf/trunk/distribution/src/main/release/samples/wsdl_first/src/demo/hw/client/client-beans.xml
   (with props)
    
cxf/trunk/distribution/src/main/release/samples/wsdl_first/src/demo/hw/server/SpringServer.java
   (with props)
    
cxf/trunk/distribution/src/main/release/samples/wsdl_first/src/demo/hw/server/server-beans.xml
   (with props)
Modified:
    cxf/trunk/distribution/src/main/release/samples/wsdl_first/README.txt
    cxf/trunk/distribution/src/main/release/samples/wsdl_first/build.xml

Modified: cxf/trunk/distribution/src/main/release/samples/wsdl_first/README.txt
URL: 
http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/wsdl_first/README.txt?rev=703324&r1=703323&r2=703324&view=diff
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/wsdl_first/README.txt 
(original)
+++ cxf/trunk/distribution/src/main/release/samples/wsdl_first/README.txt Thu 
Oct  9 22:51:41 2008
@@ -52,7 +52,11 @@
 
   ant server  (from one command line window)
   ant client  (from a second command line window)
-    
+  
+  You can also publish or consumer the demo webservice from spring
+  
+  ant spring.server  (from one command line window)
+  ant spring.client  (from a second command line window)
 
 To remove the code generated from the WSDL file and the .class
 files, run "ant clean".
@@ -70,7 +74,6 @@
   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".
 

Modified: cxf/trunk/distribution/src/main/release/samples/wsdl_first/build.xml
URL: 
http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/wsdl_first/build.xml?rev=703324&r1=703323&r2=703324&view=diff
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/wsdl_first/build.xml 
(original)
+++ cxf/trunk/distribution/src/main/release/samples/wsdl_first/build.xml Thu 
Oct  9 22:51:41 2008
@@ -27,13 +27,23 @@
             param1="${basedir}/wsdl/hello_world.wsdl" 
             param2="${op}" 
             param3="${param}"/>
-    </target> 
+    </target>
+    
+    <target name="spring.client" description="run demo client which is created 
from the spring context" depends="build">
+        <property name="param" value=""/>
+        <cxfrun classname="demo.hw.client.SpringClient"/>
+    </target>     
         
     <target name="server" description="run demo server" depends="build">
         <cxfrun classname="demo.hw.server.Server" 
             param1="${basedir}/wsdl/hello_world.wsdl"/>
     </target>
 
+    <target name="spring.server" description="run demo server which is created 
from the spring context" depends="build">
+        <cxfrun classname="demo.hw.server.SpringServer"/>
+    </target>
+
+
     <target name="client.get" description="run demo client through HTTP GET" 
depends="build">
         <property name="param" value=""/>
         <cxfrun classname="demo.hw.client.Get"

Added: 
cxf/trunk/distribution/src/main/release/samples/wsdl_first/src/demo/hw/client/SpringClient.java
URL: 
http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/wsdl_first/src/demo/hw/client/SpringClient.java?rev=703324&view=auto
==============================================================================
--- 
cxf/trunk/distribution/src/main/release/samples/wsdl_first/src/demo/hw/client/SpringClient.java
 (added)
+++ 
cxf/trunk/distribution/src/main/release/samples/wsdl_first/src/demo/hw/client/SpringClient.java
 Thu Oct  9 22:51:41 2008
@@ -0,0 +1,83 @@
+/**
+ * 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 javax.xml.ws.WebServiceException;
+
+import org.apache.hello_world_soap_http.Greeter;
+import org.apache.hello_world_soap_http.PingMeFault;
+import org.apache.hello_world_soap_http.types.FaultDetail;
+
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+
+public final class SpringClient {
+
+    private SpringClient() {
+    }
+
+    public static void main(String args[]) throws Exception {
+        // START SNIPPET: client
+        ClassPathXmlApplicationContext context 
+            = new ClassPathXmlApplicationContext(new String[] 
{"/demo/hw/client/client-beans.xml"});
+
+        Greeter port = (Greeter)context.getBean("client");
+
+        String resp; 
+
+        System.out.println("Invoking sayHi...");
+        resp = port.sayHi();
+        System.out.println("Server responded with: " + resp);
+        System.out.println();
+
+        System.out.println("Invoking greetMe...");
+        resp = port.greetMe(System.getProperty("user.name"));
+        System.out.println("Server responded with: " + resp);
+        System.out.println();
+
+        System.out.println("Invoking greetMe with invalid length string, 
expecting exception...");
+        try {
+            resp = port.greetMe("Invoking greetMe with invalid length string, 
expecting exception...");
+        } catch (WebServiceException ex) {
+            System.out.println("Caught expected WebServiceException:");
+            System.out.println("    " + ex.getMessage());
+        }
+
+        System.out.println();
+
+        System.out.println("Invoking greetMeOneWay...");
+        port.greetMeOneWay(System.getProperty("user.name"));
+        System.out.println("No response from server as method is OneWay");
+        System.out.println();
+
+        try {
+            System.out.println("Invoking pingMe, expecting exception...");
+            port.pingMe();
+        } catch (PingMeFault ex) {
+            System.out.println("Expected exception: PingMeFault has occurred: 
" + ex.getMessage());
+            FaultDetail detail = ex.getFaultInfo();
+            System.out.println("FaultDetail major:" + detail.getMajor());
+            System.out.println("FaultDetail minor:" + detail.getMinor());      
      
+        }          
+
+        System.exit(0);
+        // END SNIPPET: client
+    }
+}

Propchange: 
cxf/trunk/distribution/src/main/release/samples/wsdl_first/src/demo/hw/client/SpringClient.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
cxf/trunk/distribution/src/main/release/samples/wsdl_first/src/demo/hw/client/SpringClient.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
cxf/trunk/distribution/src/main/release/samples/wsdl_first/src/demo/hw/client/client-beans.xml
URL: 
http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/wsdl_first/src/demo/hw/client/client-beans.xml?rev=703324&view=auto
==============================================================================
--- 
cxf/trunk/distribution/src/main/release/samples/wsdl_first/src/demo/hw/client/client-beans.xml
 (added)
+++ 
cxf/trunk/distribution/src/main/release/samples/wsdl_first/src/demo/hw/client/client-beans.xml
 Thu Oct  9 22:51:41 2008
@@ -0,0 +1,36 @@
+<?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.
+-->
+<!-- START SNIPPET: beans -->
+<beans xmlns="http://www.springframework.org/schema/beans";
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+       xmlns:jaxws="http://cxf.apache.org/jaxws";
+       xsi:schemaLocation="
+http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd";>
+
+   <jaxws:client id="client" 
+    serviceClass="org.apache.hello_world_soap_http.Greeter"
+    serviceName="s:SOAPService"
+    endpointName="s:SoapPort"
+    xmlns:s="http://apache.org/hello_world_soap_http";
+    wsdlLocation="wsdl/hello_world.wsdl"
+    address="http://localhost:9000/SoapContext/SoapPort"/>       
+</beans>
+<!-- END SNIPPET: beans -->

Propchange: 
cxf/trunk/distribution/src/main/release/samples/wsdl_first/src/demo/hw/client/client-beans.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
cxf/trunk/distribution/src/main/release/samples/wsdl_first/src/demo/hw/client/client-beans.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: 
cxf/trunk/distribution/src/main/release/samples/wsdl_first/src/demo/hw/client/client-beans.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: 
cxf/trunk/distribution/src/main/release/samples/wsdl_first/src/demo/hw/server/SpringServer.java
URL: 
http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/wsdl_first/src/demo/hw/server/SpringServer.java?rev=703324&view=auto
==============================================================================
--- 
cxf/trunk/distribution/src/main/release/samples/wsdl_first/src/demo/hw/server/SpringServer.java
 (added)
+++ 
cxf/trunk/distribution/src/main/release/samples/wsdl_first/src/demo/hw/server/SpringServer.java
 Thu Oct  9 22:51:41 2008
@@ -0,0 +1,40 @@
+/**
+ * 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.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class SpringServer {
+
+    protected SpringServer() throws Exception {
+        System.out.println("Starting Server");
+        ClassPathXmlApplicationContext context 
+            = new ClassPathXmlApplicationContext(new String[] 
{"/demo/hw/server/server-beans.xml"});
+    }
+
+    public static void main(String args[]) throws Exception {
+        new SpringServer();
+        System.out.println("Server ready...");
+
+        Thread.sleep(5 * 60 * 1000);
+        System.out.println("Server exiting");
+        System.exit(0);
+    }
+}

Propchange: 
cxf/trunk/distribution/src/main/release/samples/wsdl_first/src/demo/hw/server/SpringServer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
cxf/trunk/distribution/src/main/release/samples/wsdl_first/src/demo/hw/server/SpringServer.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
cxf/trunk/distribution/src/main/release/samples/wsdl_first/src/demo/hw/server/server-beans.xml
URL: 
http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/wsdl_first/src/demo/hw/server/server-beans.xml?rev=703324&view=auto
==============================================================================
--- 
cxf/trunk/distribution/src/main/release/samples/wsdl_first/src/demo/hw/server/server-beans.xml
 (added)
+++ 
cxf/trunk/distribution/src/main/release/samples/wsdl_first/src/demo/hw/server/server-beans.xml
 Thu Oct  9 22:51:41 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.
+-->
+<!-- START SNIPPET: beans -->
+<beans xmlns="http://www.springframework.org/schema/beans";
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+       xmlns:jaxws="http://cxf.apache.org/jaxws";
+       xsi:schemaLocation="
+http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+http://cxf.apache.org/jaxws
+http://cxf.apache.org/schemas/jaxws.xsd";>
+
+    <jaxws:endpoint id="server"
+    implementor="demo.hw.server.GreeterImpl"    
+    address="http://localhost:9000/SoapContext/SoapPort";
+    wsdlLocation="wsdl/hello_world.wsdl"/>
+         
+</beans>
+<!-- END SNIPPET: beans -->

Propchange: 
cxf/trunk/distribution/src/main/release/samples/wsdl_first/src/demo/hw/server/server-beans.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
cxf/trunk/distribution/src/main/release/samples/wsdl_first/src/demo/hw/server/server-beans.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: 
cxf/trunk/distribution/src/main/release/samples/wsdl_first/src/demo/hw/server/server-beans.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml


Reply via email to