JBossWS SVN: r17430 - stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/jaxws/client.
by jbossws-commits@lists.jboss.org
Author: klape
Date: 2013-04-02 14:22:15 -0400 (Tue, 02 Apr 2013)
New Revision: 17430
Modified:
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java
Log:
[JBPAPP-10697] JBossWS Native Dispatch clients don't configure MTOM properly
Modified: stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java 2013-03-29 13:37:43 UTC (rev 17429)
+++ stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java 2013-04-02 18:22:15 UTC (rev 17430)
@@ -38,6 +38,7 @@
import javax.xml.transform.Source;
import javax.xml.ws.AsyncHandler;
import javax.xml.ws.Binding;
+import javax.xml.ws.soap.SOAPBinding;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Dispatch;
import javax.xml.ws.EndpointReference;
@@ -53,6 +54,7 @@
import org.jboss.logging.Logger;
import org.jboss.util.NotImplementedException;
import org.jboss.ws.WSException;
+import org.jboss.ws.core.StubExt;
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.ConfigProvider;
import org.jboss.ws.core.EndpointMetadataProvider;
@@ -228,6 +230,7 @@
msgContext.setEndpointMetaData(epMetaData);
msgContext.setSOAPMessage(reqMsg);
msgContext.putAll(reqContext);
+ configureMTOM(msgContext, reqMsg);
// Try to find out the operation metadata corresponding to the message we're sending
msgContext.setOperationMetaData(getOperationMetaData(epMetaData,reqMsg));
@@ -305,6 +308,23 @@
return retObj;
}
+ /* This will enable MTOM if the BindingId is MTOM-enabled
+ * or if the MTOMFeature was passed in to the createDispatch method
+ */
+ private void configureMTOM(CommonMessageContext msgContext, SOAPMessageImpl reqMsg)
+ {
+ if(getBinding() instanceof SOAPBinding)
+ {
+ SOAPBinding soapBinding = (SOAPBinding)getBinding();
+ if(soapBinding.isMTOMEnabled())
+ {
+ log.info("Enabling MTOM for this request");
+ msgContext.put(StubExt.PROPERTY_MTOM_ENABLED, true);
+ reqMsg.setXOPMessage(true);
+ }
+ }
+ }
+
private Object invokeInternalNonSOAP(Object obj) throws IOException
{
MessageAbstraction reqMsg = getRequestMessage(obj);