You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by ff...@apache.org on 2008/10/07 10:15:17 UTC

svn commit: r702379 - in /servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src: main/java/org/apache/servicemix/cxfbc/ main/java/org/apache/servicemix/cxfbc/interceptors/ test/java/org/apache/servicemix/cxfbc/prov...

Author: ffang
Date: Tue Oct  7 01:15:16 2008
New Revision: 702379

URL: http://svn.apache.org/viewvc?rev=702379&view=rev
Log:
[SM-1602|SM1603]Cxf bc provider should handle MTOM response correctly regardless of the mtomEnabled flag value

Modified:
    servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcProviderMessageObserver.java
    servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiOutInterceptor.java
    servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/provider/CxfBCSEProviderSystemTest.java
    servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/mtom_bridge_http_jms.xml

Modified: servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcProviderMessageObserver.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcProviderMessageObserver.java?rev=702379&r1=702378&r2=702379&view=diff
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcProviderMessageObserver.java (original)
+++ servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcProviderMessageObserver.java Tue Oct  7 01:15:16 2008
@@ -126,10 +126,8 @@
             inList.add(new MustUnderstandInterceptor());
             inList.add(new StaxInInterceptor());
             inList.add(new JbiInWsdl1Interceptor(this.providerEndpoint.isUseJBIWrapper()));
-            if (providerEndpoint.isMtomEnabled()) {
-                inList.add(new AttachmentInInterceptor());
-                inList.add(new ParseContentTypeInterceptor());
-            }
+            inList.add(new AttachmentInInterceptor());
+            inList.add(new ParseContentTypeInterceptor());
             PhaseInterceptorChain inChain = inboundChainCache.get(pm
                     .getInPhases(), inList);
             inChain.add(providerEndpoint.getInInterceptors());
@@ -174,17 +172,13 @@
         } else if (messageExchange instanceof InOut) {
             NormalizedMessage msg = messageExchange.createMessage();
             msg.setContent(soapMessage.getContent(Source.class));
-            if (providerEndpoint.isMtomEnabled()) {
-                toNMSAttachments(msg, soapMessage);
-            }
+            toNMSAttachments(msg, soapMessage);
             messageExchange.setMessage(msg, "out");
         } else if (messageExchange instanceof InOptionalOut) {
             if (soapMessage.getContent(Source.class) != null) {
                 NormalizedMessage msg = messageExchange.createMessage();
                 msg.setContent(soapMessage.getContent(Source.class));
-                if (providerEndpoint.isMtomEnabled()) {
-                    toNMSAttachments(msg, soapMessage);
-                }
+                toNMSAttachments(msg, soapMessage);
                 messageExchange.setMessage(msg, "out");
             } else {
                 messageExchange.setStatus(ExchangeStatus.DONE);

Modified: servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiOutInterceptor.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiOutInterceptor.java?rev=702379&r1=702378&r2=702379&view=diff
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiOutInterceptor.java (original)
+++ servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiOutInterceptor.java Tue Oct  7 01:15:16 2008
@@ -38,6 +38,7 @@
 import org.apache.cxf.binding.soap.model.SoapHeaderInfo;
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.headers.Header;
+import org.apache.cxf.interceptor.AttachmentOutInterceptor;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.Attachment;
 import org.apache.cxf.message.Message;
@@ -170,6 +171,11 @@
             SoapVersion soapVersion = soapMessage.getVersion();
             message.put(Message.CONTENT_TYPE, soapVersion.getContentType());
         }
+        if (attachmentList.size() > 0) {
+            message.put(org.apache.cxf.message.Message.MTOM_ENABLED, true);
+            message.put("write.attachments", true);
+            message.getInterceptorChain().add(new AttachmentOutInterceptor());
+        }
         
     }
 

Modified: servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/provider/CxfBCSEProviderSystemTest.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/provider/CxfBCSEProviderSystemTest.java?rev=702379&r1=702378&r2=702379&view=diff
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/provider/CxfBCSEProviderSystemTest.java (original)
+++ servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/provider/CxfBCSEProviderSystemTest.java Tue Oct  7 01:15:16 2008
@@ -228,8 +228,10 @@
         if ("ffang".equals(name)) {
             //in this case, the server is intended to sleep 3 sec, 
             //which will cause time out both for sync and async invoke
+            System.out.println("the response is " + new SourceTransformer().contentToString(
+                    io.getFault()));
             assertTrue(new SourceTransformer().contentToString(
-                    io.getFault()).indexOf(" timed out") >= 0);
+                    io.getFault()).indexOf("Timeout receiving message") >= 0);
         } else {
             //in this case, both sync and async invocation shouldn't see the timeout problem
             assertTrue(new SourceTransformer().contentToString(

Modified: servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/mtom_bridge_http_jms.xml
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/mtom_bridge_http_jms.xml?rev=702379&r1=702378&r2=702379&view=diff
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/mtom_bridge_http_jms.xml (original)
+++ servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/mtom_bridge_http_jms.xml Tue Oct  7 01:15:16 2008
@@ -50,7 +50,7 @@
                       service="mtom:TestMtomProviderService"
                       endpoint="TestMtomProviderJmsPort"
                       interfaceName="mtom:TestMtom"
-                      mtomEnabled="true"
+                      mtomEnabled="false"
                      >
           <cxfbc:inInterceptors>
             <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>