cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r600672 - in /incubator/cxf/trunk: rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/ rt/transports/local/src/main/java/org/apache/cxf/transport/local/ rt/transports/local/src/test/java/org/apache/cxf/transport/local/ systests/src/...
Date Mon, 03 Dec 2007 20:34:57 GMT
Author: dkulp
Date: Mon Dec  3 12:34:55 2007
New Revision: 600672

URL: http://svn.apache.org/viewvc?rev=600672&view=rev
Log:
[CXF-1245] Fix problems with DIRECT_DISPATCH with large messages
Add WrappedOutInterceptor if any wrapped ops are on the wsdl.  (it's coded defensively so
it's a no-op if a BOP is not wrapped so it can always be there)  This may fix CXF-885, but
need to test that some more.

Modified:
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
    incubator/cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalConduit.java
    incubator/cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalDestination.java
    incubator/cxf/trunk/rt/transports/local/src/test/java/org/apache/cxf/transport/local/LocalTransportFactoryTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java?rev=600672&r1=600671&r2=600672&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
(original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
Mon Dec  3 12:34:55 2007
@@ -305,6 +305,8 @@
         String parameterStyle = SoapBindingConstants.PARAMETER_STYLE_WRAPPED;
         String bindingStyle = SoapBindingConstants.BINDING_STYLE_DOC;
 
+        boolean hasWrapped = false;
+        
         org.apache.cxf.binding.soap.SoapBinding sb = null;
         SoapVersion version = null;
         if (binding instanceof SoapBindingInfo) {
@@ -323,6 +325,8 @@
                 }
                 if (boi.getUnwrappedOperation() == null) {
                     parameterStyle = SoapBindingConstants.PARAMETER_STYLE_BARE;
+                } else {
+                    hasWrapped = true;
                 }
             }
         } else {
@@ -349,6 +353,9 @@
                             && SoapBindingConstants.PARAMETER_STYLE_BARE.equalsIgnoreCase(parameterStyle))
{
                 //sb.getInInterceptors().add(new BareInInterceptor());
                 sb.getInInterceptors().add(new DocLiteralInInterceptor());
+                if (hasWrapped) {
+                    sb.getOutInterceptors().add(new WrappedOutInterceptor());           
        
+                }
                 sb.getOutInterceptors().add(new BareOutInterceptor());
             } else {
                 //sb.getInInterceptors().add(new WrappedInInterceptor());

Modified: incubator/cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalConduit.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalConduit.java?rev=600672&r1=600671&r2=600672&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalConduit.java
(original)
+++ incubator/cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalConduit.java
Mon Dec  3 12:34:55 2007
@@ -30,6 +30,7 @@
 
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.helpers.CastUtils;
+import org.apache.cxf.io.CachedOutputStream;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.ExchangeImpl;
 import org.apache.cxf.message.Message;
@@ -60,9 +61,8 @@
             dispatchViaPipe(message);
         } else {
             // prepare the stream here
-            PipedInputStream stream = new PipedInputStream();
-            message.setContent(InputStream.class, stream);
-            message.setContent(OutputStream.class, new PipedOutputStream(stream));
+            CachedOutputStream stream = new CachedOutputStream();
+            message.setContent(OutputStream.class, stream);
         }
     }
 
@@ -76,7 +76,7 @@
         super.close(message);
     }
 
-    private void dispatchDirect(Message message) {
+    private void dispatchDirect(Message message) throws IOException {
         if (destination.getMessageObserver() == null) {
             throw new IllegalStateException("Local destination does not have a MessageObserver
on address " 
                                             + destination.getAddress().getAddress().getValue());
@@ -88,6 +88,9 @@
         
         copy(message, copy, transportFactory.getMessageFilterProperties());
         
+        CachedOutputStream stream = (CachedOutputStream)message.getContent(OutputStream.class);
+        copy.setContent(InputStream.class, stream.getInputStream());
+
         // Create a new incoming exchange and store the original exchange for the response
         ExchangeImpl ex = new ExchangeImpl();
         ex.setInMessage(copy);

Modified: incubator/cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalDestination.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalDestination.java?rev=600672&r1=600671&r2=600672&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalDestination.java
(original)
+++ incubator/cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalDestination.java
Mon Dec  3 12:34:55 2007
@@ -27,6 +27,7 @@
 import java.util.logging.Logger;
 
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.io.CachedOutputStream;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageImpl;
@@ -94,9 +95,8 @@
                 new Thread(receiver).start();
                 
             } else {
-                PipedInputStream stream = new PipedInputStream();
-                message.setContent(InputStream.class, stream);
-                message.setContent(OutputStream.class, new PipedOutputStream(stream));
+                CachedOutputStream stream = new CachedOutputStream();
+                message.setContent(OutputStream.class, stream);
             }
         }
 
@@ -104,10 +104,12 @@
         public void close(Message message) throws IOException {
             if (Boolean.TRUE.equals(message.getExchange().get(LocalConduit.DIRECT_DISPATCH)))
{
                 final Exchange exchange = (Exchange)message.getExchange().get(LocalConduit.IN_EXCHANGE);
+                
                 MessageImpl copy = new MessageImpl();
                 copy.putAll(message);
                 MessageImpl.copyContent(message, copy);
-                
+                CachedOutputStream stream = (CachedOutputStream)message.getContent(OutputStream.class);
+                copy.setContent(InputStream.class, stream.getInputStream());
                 if (exchange != null && exchange.getInMessage() == null) {
                     exchange.setInMessage(copy);
                 }                

Modified: incubator/cxf/trunk/rt/transports/local/src/test/java/org/apache/cxf/transport/local/LocalTransportFactoryTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/local/src/test/java/org/apache/cxf/transport/local/LocalTransportFactoryTest.java?rev=600672&r1=600671&r2=600672&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/transports/local/src/test/java/org/apache/cxf/transport/local/LocalTransportFactoryTest.java
(original)
+++ incubator/cxf/trunk/rt/transports/local/src/test/java/org/apache/cxf/transport/local/LocalTransportFactoryTest.java
Mon Dec  3 12:34:55 2007
@@ -70,11 +70,16 @@
         conduit.prepare(m);
         
         OutputStream out = m.getContent(OutputStream.class);
-        out.write("hello".getBytes());
+        
+        StringBuilder builder = new StringBuilder();
+        for (int x = 0; x < 1000; x++) {
+            builder.append("hello");
+        }
+        out.write(builder.toString().getBytes());
         out.close();
         conduit.close(m);
 
-        assertEquals("hello", obs.getResponseStream().toString());
+        assertEquals(builder.toString(), obs.getResponseStream().toString());
     }
     static class EchoObserver implements MessageObserver {
 

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java?rev=600672&r1=600671&r2=600672&view=diff
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
Mon Dec  3 12:34:55 2007
@@ -837,7 +837,24 @@
         assertEquals("Bonjour", reply);
                                    
     }
-    
+
+    /*
+    @Test
+    public void testDynamicClientFactory2() throws Exception {
+        String wsdlUrl = "http://sdpwsparam.strikeiron.com/sdpNFLTeams?WSDL";
+
+        //TODO test fault exceptions 
+        DynamicClientFactory dcf = DynamicClientFactory.newInstance();
+        Client client = dcf.createClient(wsdlUrl);
+        Object o = Class.forName("com.strikeiron.GetTeamInfoByCity", true, 
+                                 Thread.currentThread().getContextClassLoader()).newInstance();
+        Object[] result = client.invoke("GetTeamInfoByCity", "a", "b", "New England");
+        
+        
+        //System.out.println(Arrays.asList(result));
+        
+    }
+    */
     @Test
     public void testDynamicClientFactory() throws Exception {
         URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");



Mime
View raw message