Author: klape
Date: 2013-04-02 14:49:25 -0400 (Tue, 02 Apr 2013)
New Revision: 17432
Modified:
stack/native/branches/jbossws-native-3.1.2.SP11_JBPAPP-10698/modules/core/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java
Log:
[JBPAPP-10698] fix for issue: JBossWS Native Dispatch clients don't configure MTOM
properly
Modified:
stack/native/branches/jbossws-native-3.1.2.SP11_JBPAPP-10698/modules/core/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java
===================================================================
---
stack/native/branches/jbossws-native-3.1.2.SP11_JBPAPP-10698/modules/core/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java 2013-04-02
18:44:11 UTC (rev 17431)
+++
stack/native/branches/jbossws-native-3.1.2.SP11_JBPAPP-10698/modules/core/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java 2013-04-02
18:49:25 UTC (rev 17432)
@@ -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);