Author: veithen
Date: Sun Aug 14 14:19:13 2011
New Revision: 1157535

URL: http://svn.apache.org/viewvc?rev=1157535&view=rev
Log:
AXIS2-5062:
* Committed the patch for BaseDispatch provided by Ivan.
* Enabled the corresponding test case.

Modified:
    
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/SOAPMessageDispatchTests.java
    
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/BaseDispatch.java

Modified: 
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/SOAPMessageDispatchTests.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/SOAPMessageDispatchTests.java?rev=1157535&r1=1157534&r2=1157535&view=diff
==============================================================================
--- 
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/SOAPMessageDispatchTests.java
 (original)
+++ 
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/SOAPMessageDispatchTests.java
 Sun Aug 14 14:19:13 2011
@@ -187,7 +187,7 @@ public class SOAPMessageDispatchTests ex
      * 
      * @throws Exception
      */
-    public void _testConnectionReleaseForInvokeOneWayWithMEPMismatch() throws 
Exception {
+    public void testConnectionReleaseForInvokeOneWayWithMEPMismatch() throws 
Exception {
         Service svc = Service.create(serviceName);
         svc.addPort(portName, null, url);
         Dispatch<SOAPMessage> dispatch = svc.createDispatch(portName,

Modified: 
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/BaseDispatch.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/BaseDispatch.java?rev=1157535&r1=1157534&r2=1157535&view=diff
==============================================================================
--- 
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/BaseDispatch.java
 (original)
+++ 
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/BaseDispatch.java
 Sun Aug 14 14:19:13 2011
@@ -450,6 +450,7 @@ public abstract class BaseDispatch<T> ex
     public void invokeOneWay(Object obj) throws WebServiceException {
 
         // All exceptions are caught and rethrown as a WebServiceException
+        MessageContext requestMsgCtx = null;
         try {
             if (log.isDebugEnabled()) {
                 log.debug("Entered one-way invocation: 
BaseDispatch.invokeOneWay()");
@@ -462,7 +463,7 @@ public abstract class BaseDispatch<T> ex
 
             // Create the MessageContext to hold the actual request message 
and its
             // associated properties
-            MessageContext requestMsgCtx = new MessageContext();
+            requestMsgCtx = new MessageContext();
             
requestMsgCtx.getAxisMessageContext().setProperty(BINDING_PROVIDER, this);
             requestMsgCtx.setEndpointDescription(getEndpointDescription());
             invocationContext.setRequestMessageContext(requestMsgCtx);
@@ -550,6 +551,18 @@ public abstract class BaseDispatch<T> ex
                         " Exception caught: ", e);
             }
             throw ExceptionFactory.makeWebServiceException(e);
+        } finally {
+            // In all other cases we rely on freeInputStream to perform the 
clean up. Since we don't expect
+            // a response in the invokeOneWay case, we need to perform call 
TransportSender#cleanup explicitly
+            try {
+                if (requestMsgCtx != null && 
requestMsgCtx.getAxisMessageContext() != null) {
+                    org.apache.axis2.context.MessageContext axisMsgCtx = 
requestMsgCtx.getAxisMessageContext();
+                    if (axisMsgCtx.getTransportOut() != null && 
axisMsgCtx.getTransportOut().getSender() != null) {
+                        
axisMsgCtx.getTransportOut().getSender().cleanup(axisMsgCtx);
+                    }
+                }
+            } catch (Exception ignore) {
+            }
         }
     }
 


Reply via email to