You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by mm...@apache.org on 2006/11/10 08:12:57 UTC

svn commit: r473217 - in /incubator/cxf/trunk/distribution/src/main/release/samples/integration/jca/hello_world_soap_http: README.txt build.xml src/demo/client/ src/demo/client/Client.java

Author: mmao
Date: Thu Nov  9 23:12:56 2006
New Revision: 473217

URL: http://svn.apache.org/viewvc?view=rev&rev=473217
Log:
CXF-218
Apply patch contributed by Unreal Jiang
* Add jca outbound demo client side which running in commandline so we can run it in cpi

Added:
    incubator/cxf/trunk/distribution/src/main/release/samples/integration/jca/hello_world_soap_http/src/demo/client/
    incubator/cxf/trunk/distribution/src/main/release/samples/integration/jca/hello_world_soap_http/src/demo/client/Client.java   (with props)
Modified:
    incubator/cxf/trunk/distribution/src/main/release/samples/integration/jca/hello_world_soap_http/README.txt
    incubator/cxf/trunk/distribution/src/main/release/samples/integration/jca/hello_world_soap_http/build.xml

Modified: incubator/cxf/trunk/distribution/src/main/release/samples/integration/jca/hello_world_soap_http/README.txt
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/integration/jca/hello_world_soap_http/README.txt?view=diff&rev=473217&r1=473216&r2=473217
==============================================================================
--- incubator/cxf/trunk/distribution/src/main/release/samples/integration/jca/hello_world_soap_http/README.txt (original)
+++ incubator/cxf/trunk/distribution/src/main/release/samples/integration/jca/hello_world_soap_http/README.txt Thu Nov  9 23:12:56 2006
@@ -154,3 +154,10 @@
 
 The web application provides a simple Web front-end to the Hello World
 Application. 
+
+command-line
+------------
+We can also running a client in command-line.
+
+  (Unix)    % ant client
+  (Windows) > ant client

Modified: incubator/cxf/trunk/distribution/src/main/release/samples/integration/jca/hello_world_soap_http/build.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/integration/jca/hello_world_soap_http/build.xml?view=diff&rev=473217&r1=473216&r2=473217
==============================================================================
--- incubator/cxf/trunk/distribution/src/main/release/samples/integration/jca/hello_world_soap_http/build.xml (original)
+++ incubator/cxf/trunk/distribution/src/main/release/samples/integration/jca/hello_world_soap_http/build.xml Thu Nov  9 23:12:56 2006
@@ -26,8 +26,13 @@
   <property name="wsdl.location" value="${wsdl.dir}/hello_world.wsdl"/>
   <property name="war.name" value="helloworld.war"/>
   <property name="j2ee.resources.dir" location="${basedir}/../common/resources"/>
-  <property name="thirdparty.classpath" value="${basedir}/../common/common.jar"/>
-    
+  <!--property name="thirdparty.classpath" value="${basedir}/../common/common.jar"/-->
+  
+  <path id="thirdParth.classpath">
+    <pathelement location="${basedir}/../common/common.jar"/>
+  </path>
+
+
   <path id="other.classpath">
    	<pathelement location="${basedir}/../../../../lib/servlet-api-2.4.jar"/>
         <pathelement location="${basedir}/../../../../lib/connector.jar"/>
@@ -104,6 +109,10 @@
     </war>
   </target>
 
+    <target name="client" description="run demo client" depends="build">
+        <property name="param" value=""/>
+        <cxfrun classname="demo.client.Client"/>
+    </target>
 
   <target name="clean">
       <delete failonerror="no">

Added: incubator/cxf/trunk/distribution/src/main/release/samples/integration/jca/hello_world_soap_http/src/demo/client/Client.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/integration/jca/hello_world_soap_http/src/demo/client/Client.java?view=auto&rev=473217
==============================================================================
--- incubator/cxf/trunk/distribution/src/main/release/samples/integration/jca/hello_world_soap_http/src/demo/client/Client.java (added)
+++ incubator/cxf/trunk/distribution/src/main/release/samples/integration/jca/hello_world_soap_http/src/demo/client/Client.java Thu Nov  9 23:12:56 2006
@@ -0,0 +1,67 @@
+/**
+ * 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.client;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.io.IOException;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+public class Client {
+
+
+    public Client() {
+    }
+
+    public static void main(String[] args) throws Exception {
+
+        try {
+            URL url = new URL("http://localhost:8080/helloworld/*.do?Operation=sayHi&User=abc");
+            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+
+            conn.setDoOutput(true);
+            conn.connect();
+
+            BufferedReader in = 
+                new BufferedReader( new InputStreamReader( conn.getInputStream() ) );
+            boolean correctReturn = false;
+            String response;
+            while ( (response = in.readLine()) != null ) {
+                if (response.contains("Bonjour")) {
+                    System.out.println(" server return: Bonjour");
+                    correctReturn = true;
+                    break;
+                }
+            }
+            if (!correctReturn) {
+                System.out.println("Can't got correct return from server.");
+            }
+            
+            in.close();
+
+        } catch (MalformedURLException ex) {
+            ex.printStackTrace();
+        } catch (IOException ex) {
+            ex.printStackTrace();
+        }
+    }
+}

Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/integration/jca/hello_world_soap_http/src/demo/client/Client.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/integration/jca/hello_world_soap_http/src/demo/client/Client.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date