cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject svn commit: r469103 - in /incubator/cxf/trunk: distribution/src/main/release/samples/soap12/ distribution/src/main/release/samples/soap12/src/demo/hw/client/ rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ systests/src/test/java...
Date Mon, 30 Oct 2006 09:36:20 GMT
Author: mmao
Date: Mon Oct 30 01:36:19 2006
New Revision: 469103

URL: http://svn.apache.org/viewvc?view=rev&rev=469103
Log:
* Added soap1.2 GET demo. 
* Removed print out

Added:
    incubator/cxf/trunk/distribution/src/main/release/samples/soap12/src/demo/hw/client/Get.java
  (with props)
Modified:
    incubator/cxf/trunk/distribution/src/main/release/samples/soap12/build.xml
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/RPCOutInterceptor.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/soap12/Soap12ClientServerTest.java

Modified: incubator/cxf/trunk/distribution/src/main/release/samples/soap12/build.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/soap12/build.xml?view=diff&rev=469103&r1=469102&r2=469103
==============================================================================
--- incubator/cxf/trunk/distribution/src/main/release/samples/soap12/build.xml (original)
+++ incubator/cxf/trunk/distribution/src/main/release/samples/soap12/build.xml Mon Oct 30
01:36:19 2006
@@ -28,6 +28,14 @@
             param2="${op}" 
             param3="${param}"/>
     </target> 
+
+    <target name="client.get" description="run demo client through HTTP GET" depends="build">
+        <property name="param" value=""/>
+        <cxfrun classname="demo.hw.client.Get"
+            param1="${basedir}/wsdl/hello_world_soap12.wsdl" 
+            param2="${op}" 
+            param3="${param}"/>
+    </target>
         
     <target name="server" description="run demo server" depends="build">
         <cxfrun classname="demo.hw.server.Server" 

Added: incubator/cxf/trunk/distribution/src/main/release/samples/soap12/src/demo/hw/client/Get.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/soap12/src/demo/hw/client/Get.java?view=auto&rev=469103
==============================================================================
--- incubator/cxf/trunk/distribution/src/main/release/samples/soap12/src/demo/hw/client/Get.java
(added)
+++ incubator/cxf/trunk/distribution/src/main/release/samples/soap12/src/demo/hw/client/Get.java
Mon Oct 30 01:36:19 2006
@@ -0,0 +1,100 @@
+/**
+ * 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 org.apache.cxf.systest.soap12;
+
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.Properties;
+
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+public final class Get {
+
+    private Get() {
+    } 
+
+    public static void main(String args[]) throws Exception {
+        // Sent HTTP GET request to invoke sayHi
+        String target = "http://localhost:9000/SoapContext/SoapPort/sayHi";
+        URL url = new URL(target);
+        HttpURLConnection httpConnection = (HttpURLConnection) url.openConnection();
+        httpConnection.connect();
+        System.out.println("Invoking server through HTTP GET to invoke sayHi");
+
+        InputStream in = httpConnection.getInputStream();
+        StreamSource source = new StreamSource(in);
+        printSource(source);
+
+
+        // Sent HTTP GET request to invoke greetMe
+        target = "http://localhost:9000/SoapContext/SoapPort/greetMe/me/CXF";
+        url = new URL(target);
+        httpConnection = (HttpURLConnection) url.openConnection();
+        httpConnection.connect();
+        System.out.println("Invoking server through HTTP GET to invoke greetMe");
+
+        in = httpConnection.getInputStream();
+        source = new StreamSource(in);
+        printSource(source);
+
+        // Sent HTTP GET request to invoke pingMe
+        target = "http://localhost:9000/SoapContext/SoapPort/pingMe";
+        url = new URL(target);
+        httpConnection = (HttpURLConnection) url.openConnection();
+        httpConnection.connect();
+        System.out.println("Invoking server through HTTP GET to invoke pingMe");
+
+        try {
+            in = httpConnection.getInputStream();
+        } catch (Exception e) {
+            System.out.println("PingMe fault raised");
+        }
+        InputStream err = httpConnection.getErrorStream();
+        source = new StreamSource(err);
+        printSource(source);
+    }
+
+    private static void printSource(Source source) {
+        try {
+            ByteArrayOutputStream bos = new ByteArrayOutputStream();
+            StreamResult sr = new StreamResult(bos);
+            Transformer trans = TransformerFactory.newInstance().newTransformer();
+            Properties oprops = new Properties();
+            oprops.put(OutputKeys.OMIT_XML_DECLARATION, "yes");
+            trans.setOutputProperties(oprops);
+            trans.transform(source, sr);
+            System.out.println();
+            System.out.println("**** Response ******");
+            System.out.println();
+            System.out.println(bos.toString());
+            bos.close();
+            System.out.println();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }    
+}

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

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

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/RPCOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/RPCOutInterceptor.java?view=diff&rev=469103&r1=469102&r2=469103
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/RPCOutInterceptor.java
(original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/RPCOutInterceptor.java
Mon Oct 30 01:36:19 2006
@@ -63,10 +63,6 @@
             int countParts = 0;
             List<MessagePartInfo> parts = null;
 
-            System.out.println("operation " + operation);
-            System.out.println("name " + operation.getName());
-            System.out.println("output " + operation.getOutput());
-            
             if (!isRequestor(message)) {
                 parts = operation.getOutput().getMessageInfo().getMessageParts();
             } else {

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/soap12/Soap12ClientServerTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/soap12/Soap12ClientServerTest.java?view=diff&rev=469103&r1=469102&r2=469103
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/soap12/Soap12ClientServerTest.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/soap12/Soap12ClientServerTest.java
Mon Oct 30 01:36:19 2006
@@ -115,7 +115,7 @@
         
         assertEquals("Fault+Occurred", httpConnection.getResponseMessage());
 
-        InputStream in = httpConnection.getErrorStream();                  
+        InputStream in = httpConnection.getErrorStream();
         assertNotNull(in);     
         assertEquals("application/soap+xml", httpConnection.getContentType());
         



Mime
View raw message