axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dee...@apache.org
Subject svn commit: r378160 [1/2] - in /webservices/axis2/trunk/java/modules: core/src/org/apache/axis2/client/ core/src/org/apache/axis2/context/ core/src/org/apache/axis2/description/ core/src/org/apache/axis2/engine/ core/src/org/apache/axis2/transport/ cor...
Date Thu, 16 Feb 2006 04:27:55 GMT
Author: deepal
Date: Wed Feb 15 20:27:51 2006
New Revision: 378160

URL: http://svn.apache.org/viewcvs?rev=378160&view=rev
Log:
-transport improvement 
-when there i multiple transport receivers are running service author can specify the transport that he need to expose the service

Added:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/TransportManager.java
Removed:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/ListenerManager.java
Modified:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/InOutMEPClient.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/ServiceClient.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContextFactory.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/MessageContext.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/SessionContext.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/ClientUtils.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutInAxisOperation.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutOnlyAxisOperation.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfiguration.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/DispatchPhase.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/TransportListener.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/AxisServlet.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPWorker.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SimpleHTTPServer.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/jms/SimpleJMSListener.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/jms/SimpleJMSWorker.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/mail/MailWorker.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/mail/SimpleMailListener.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/tcp/TCPServer.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/tcp/TCPWorker.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/CallbackReceiver.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/CharactersetEncodingTest.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/CommonsHTTPEchoRawXMLTest.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/EchoRawXMLLoadTest.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/EchoRawXMLMultipleTest.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/EchoRawXMLOnTwoChannelsSyncTest.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/EchoRawXMLOnTwoChannelsTest.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/ServiceDispatchingTest.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/integration/UtilServer.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/integration/UtilsTCPServer.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/tcp/TCPEchoRawXMLTest.java
    webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPConnectionImpl.java
    webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/integration/IntegrationTest.java
    webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/integration/UtilServer.java

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/InOutMEPClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/InOutMEPClient.java?rev=378160&r1=378159&r2=378160&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/InOutMEPClient.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/InOutMEPClient.java Wed Feb 15 20:27:51 2006
@@ -30,6 +30,7 @@
 import org.apache.axis2.description.TransportInDescription;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.engine.AxisEngine;
+import org.apache.axis2.engine.TransportManager;
 import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.transport.TransportUtils;
 import org.apache.axis2.util.CallbackReceiver;
@@ -47,8 +48,8 @@
  * and non-blocking calls. The basic API is based on MessageContext and
  * provides more convenient APIs.
  *
- * @deprecated 
  * @see ServiceClient
+ * @deprecated
  */
 public class InOutMEPClient extends MEPClient {
 
@@ -120,8 +121,7 @@
      */
     public void close() throws AxisFault {
         if (clientOptions.isUseSeparateListener()) {
-            ListenerManager.stop(serviceContext.getConfigurationContext(),
-                    clientOptions.getTransportIn().getName().getLocalPart());
+            TransportManager.transportManager.stop();
         }
     }
 
@@ -155,9 +155,6 @@
                     new QName(Constants.MODULE_ADDRESSING))) {
                 throw new AxisFault(Messages.getMessage("2channelNeedAddressing"));
             }
-
-            ListenerManager.makeSureStarted(clientOptions.getTransportInProtocol(),
-                    serviceContext.getConfigurationContext());
         }
     }
 
@@ -219,7 +216,7 @@
 
             // process the resule of the invocation
             if (callback.envelope != null) {
-                MessageContext resMsgctx =new MessageContext();
+                MessageContext resMsgctx = new MessageContext();
                 resMsgctx.setConfigurationContext(serviceContext.getConfigurationContext());
 
                 resMsgctx.setEnvelope(callback.envelope);
@@ -321,12 +318,10 @@
 
                 // set the replyto such that the response will arrive at the transport listener started
                 // Note that this will only change the replyTo Address property in the replyTo EPR
-                EndpointReference replyToFromTransport =
-                        ListenerManager
-                                .replyToEPR(serviceContext.getConfigurationContext(),
-                                        serviceContext.getAxisService().getName() + "/"
-                                                + axisop.getName().getLocalPart(), clientOptions
-                                        .getTransportIn().getName().getLocalPart());
+                EndpointReference replyToFromTransport = TransportManager.transportManager.
+                        getERPforService(serviceContext.getAxisService().getName(),axisop.getName().getLocalPart(), clientOptions
+                                .getTransportIn().getName()
+                                .getLocalPart());
 
                 if (msgctx.getReplyTo() == null) {
                     msgctx.setReplyTo(replyToFromTransport);

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/ServiceClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/ServiceClient.java?rev=378160&r1=378159&r2=378160&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/ServiceClient.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/ServiceClient.java Wed Feb 15 20:27:51 2006
@@ -7,6 +7,7 @@
 import org.apache.axis2.context.*;
 import org.apache.axis2.description.*;
 import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.engine.TransportManager;
 import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.util.CallbackReceiver;
 import org.apache.ws.commons.om.OMAbstractFactory;
@@ -77,10 +78,7 @@
     public ServiceClient(ConfigurationContext configContext,
                          AxisService axisService) throws AxisFault {
         // create a config context if needed
-        this.configContext = (configContext != null) ? configContext
-                : ConfigurationContextFactory
-                .createConfigurationContextFromFileSystem(null, null);
-
+        initializeTransports(configContext);
         // save the axisConfig and service
         this.axisConfig = this.configContext.getAxisConfiguration();
         this.axisService = (axisService != null) ? axisService
@@ -116,9 +114,7 @@
     public ServiceClient(ConfigurationContext configContext, URL wsdlURL,
                          QName wsdlServiceName, String portName) throws AxisFault {
         // create a config context if needed
-        this.configContext = (configContext != null) ? configContext
-                : ConfigurationContextFactory
-                .createConfigurationContextFromFileSystem(null, null);
+        initializeTransports(configContext);
         try {
             this.axisConfig = this.configContext.getAxisConfiguration();
             axisService = ClientUtils.creatAxisService(wsdlURL,
@@ -137,6 +133,30 @@
         }
     }
 
+    private void initializeTransports(ConfigurationContext configContext) throws AxisFault {
+        if (configContext != null) {
+            this.configContext = configContext;
+            if (TransportManager.transportManager == null) {
+                TransportManager transportManager = new TransportManager();
+                transportManager.init(this.configContext);
+            }
+        } else {
+            if (TransportManager.transportManager != null) {
+                this.configContext = TransportManager.transportManager.getConfigctx();
+            } else {
+                this.configContext = ConfigurationContextFactory.
+                        createConfigurationContextFromFileSystem(null, null);
+                if (TransportManager.transportManager == null) {
+                    TransportManager transportManager = new TransportManager();
+                    transportManager.init(this.configContext);
+                }
+            }
+        }
+        if (!TransportManager.transportManager.isStoped()) {
+            TransportManager.transportManager.start();
+        }
+    }
+
     /**
      * Create a service client by assuming an anonymous service and any other
      * necessary information.
@@ -356,9 +376,7 @@
             // this method call two channel non blocking method to do the work
             // and wait on the callbck
             sendReceiveNonBlocking(operation, elem, callback);
-
             long timeout = options.getTimeOutInMilliSeconds();
-
             if (timeout < 0) {
                 while (!callback.isComplete()) {
                     try {
@@ -369,9 +387,7 @@
                 }
             } else {
                 long index = timeout / 100;
-
                 while (!callback.isComplete()) {
-
                     // wait till the reponse arrives
                     if (index-- >= 0) {
                         try {
@@ -387,11 +403,9 @@
             }
             // process the resule of the invocation
             if (callback.envelope != null) {
-                MessageContext resMsgctx = callback.getMsgctx();
                 // building soap enevlop
                 callback.envelope.build();
                 // closing tranport
-                finalizeInvoke(resMsgctx);
                 return callback.envelope.getBody().getFirstElement();
             } else {
                 if (callback.error instanceof AxisFault) {
@@ -473,11 +487,8 @@
      *
      * @throws AxisFault
      */
-    private void finalizeInvoke(MessageContext msgCtx) throws AxisFault {
-        if (options.getTransportInProtocol() != null) {
-            ListenerManager.stop(msgCtx.getConfigurationContext(), msgCtx
-                    .getTransportIn().getName().getLocalPart());
-        }
+    public void finalizeInvoke() throws AxisFault {
+        TransportManager.transportManager.stop();
     }
 
     /**

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContextFactory.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContextFactory.java?rev=378160&r1=378159&r2=378160&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContextFactory.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContextFactory.java Wed Feb 15 20:27:51 2006
@@ -4,14 +4,12 @@
 import org.apache.axis2.deployment.DeploymentException;
 import org.apache.axis2.deployment.FileSystemConfigurator;
 import org.apache.axis2.description.AxisModule;
-import org.apache.axis2.description.TransportInDescription;
 import org.apache.axis2.description.TransportOutDescription;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.engine.AxisConfigurator;
 import org.apache.axis2.modules.Module;
 import org.apache.axis2.phaseresolver.PhaseException;
 import org.apache.axis2.phaseresolver.PhaseResolver;
-import org.apache.axis2.transport.TransportListener;
 import org.apache.axis2.transport.TransportSender;
 import org.apache.commons.logging.LogFactory;
 
@@ -62,7 +60,7 @@
 
             phaseResolver.buildTranspotsChains();
             initModules(configContext);
-            initTransports(configContext);
+            initTransportSenders(configContext);
         } catch (PhaseException e) {
             throw new AxisFault(e);
         } catch (DeploymentException e) {
@@ -100,32 +98,13 @@
      *
      * @param configContext
      */
-    public static void initTransports(ConfigurationContext configContext) {
+    public static void initTransportSenders(ConfigurationContext configContext) {
         AxisConfiguration axisConf = configContext.getAxisConfiguration();
 
-        // Initialize Transport Ins
-        HashMap transportIns = axisConf.getTransportsIn();
-        Iterator values = transportIns.values().iterator();
-
-        while (values.hasNext()) {
-            TransportInDescription transportIn = (TransportInDescription) values.next();
-            TransportListener listener = transportIn.getReceiver();
-
-            if (listener != null) {
-                try {
-                    listener.init(configContext, transportIn);
-                } catch (AxisFault axisFault) {
-                    LogFactory.getLog(ConfigurationContextFactory.class)
-                            .info("Transport-IN initialization error : "
-                                    + transportIn.getName().getLocalPart());
-                }
-            }
-        }
-
         // Initialize Transport Outs
         HashMap transportOuts = axisConf.getTransportsOut();
 
-        values = transportOuts.values().iterator();
+        Iterator values = transportOuts.values().iterator();
 
         while (values.hasNext()) {
             TransportOutDescription transportOut = (TransportOutDescription) values.next();

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/MessageContext.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/MessageContext.java?rev=378160&r1=378159&r2=378160&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/MessageContext.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/MessageContext.java Wed Feb 15 20:27:51 2006
@@ -20,15 +20,7 @@
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.addressing.RelatesTo;
 import org.apache.axis2.client.Options;
-import org.apache.axis2.description.AxisModule;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.AxisServiceGroup;
-import org.apache.axis2.description.HandlerDescription;
-import org.apache.axis2.description.ModuleConfiguration;
-import org.apache.axis2.description.Parameter;
-import org.apache.axis2.description.TransportInDescription;
-import org.apache.axis2.description.TransportOutDescription;
+import org.apache.axis2.description.*;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.ws.commons.soap.SOAP11Constants;
 import org.apache.ws.commons.soap.SOAP12Constants;
@@ -189,6 +181,10 @@
     private transient TransportOutDescription transportOut;
     private transient TransportInDescription transportIn;
 
+    //The value will be set by the tarnsport reciver and there will be validaation for the transport
+    //at the dispatch phase (its post condition)
+    private String incomingTransportName;
+
     public MessageContext() {
         super(null);
         options = new Options();
@@ -900,5 +896,13 @@
      */
     public void setOptions(Options options) {
         this.options.setParent(options);
+    }
+
+    public String getIncomingTransportName() {
+        return incomingTransportName;
+    }
+
+    public void setIncomingTransportName(String incomingTransportName) {
+        this.incomingTransportName = incomingTransportName;
     }
 }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/SessionContext.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/SessionContext.java?rev=378160&r1=378159&r2=378160&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/SessionContext.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/SessionContext.java Wed Feb 15 20:27:51 2006
@@ -30,8 +30,8 @@
  */
 public class SessionContext extends AbstractContext {
 
-    private HashMap serviceContextMap = new HashMap();
-    private HashMap serviceGroupContextMap = new HashMap();
+    private transient HashMap serviceContextMap = new HashMap();
+    private transient HashMap serviceGroupContextMap = new HashMap();
     private String cookieID;
 
     // current time out interval is 30 secs. Need to make this configurable

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java?rev=378160&r1=378159&r2=378160&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java Wed Feb 15 20:27:51 2006
@@ -17,11 +17,7 @@
 
 package org.apache.axis2.description;
 
-import com.ibm.wsdl.extensions.soap.SOAPAddressImpl;
-import com.ibm.wsdl.extensions.soap.SOAPBindingImpl;
-import com.ibm.wsdl.extensions.soap.SOAPBodyImpl;
-import com.ibm.wsdl.extensions.soap.SOAPConstants;
-import com.ibm.wsdl.extensions.soap.SOAPOperationImpl;
+import com.ibm.wsdl.extensions.soap.*;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
 import org.apache.axis2.engine.AxisConfiguration;
@@ -38,36 +34,21 @@
 import org.apache.wsdl.WSDLConstants;
 import org.apache.wsdl.WSDLDescription;
 
-import javax.wsdl.Binding;
-import javax.wsdl.BindingInput;
-import javax.wsdl.BindingOperation;
-import javax.wsdl.BindingOutput;
-import javax.wsdl.Definition;
-import javax.wsdl.Port;
-import javax.wsdl.Service;
+import javax.wsdl.*;
 import javax.wsdl.extensions.soap.SOAPAddress;
 import javax.wsdl.factory.WSDLFactory;
 import javax.xml.namespace.QName;
-
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.OutputStream;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
+import java.io.*;
+import java.util.*;
 
 /**
  * Class AxisService
  */
 public class AxisService extends AxisDescription implements Serializable {
 
-	private static final long serialVersionUID = 4528303251915455363L;
+    private static final long serialVersionUID = 4528303251915455363L;
 
-	private Definition definition = null;
+    private Definition definition = null;
     private Log log = LogFactory.getLog(getClass());
     private String fileName = "";
 
@@ -114,6 +95,9 @@
     private String schematargetNamespace = SchemaGenerator.SCHEMA_TARGET_NAMESPACE;
     private String schematargetNamespacePrefix = SchemaGenerator.SCHEMA_NAMESPACE_PRFIX;
 
+    private boolean enableAllTransport = true;
+    private String [] exposeTransports;
+
     /**
      * Constructor AxisService.
      */
@@ -728,12 +712,27 @@
         }
         return null;
     }
-    
-    private void readObject(ObjectInputStream stream)  throws IOException, ClassNotFoundException {
-    	// Do nothing. Service has nothing serializable.
+
+    private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
+        // Do nothing. Service has nothing serializable.
     }
 
     private void writeObject(ObjectOutputStream stream) throws IOException {
-    	// Do nothing. Service has nothing serializable.
+        // Do nothing. Service has nothing serializable.
+    }
+
+    public boolean isEnableAllTransport() {
+        return enableAllTransport;
+    }
+
+    public String[] getExposeTransports() {
+        return exposeTransports;
+    }
+
+    public void setExposeTransports(String[] exposeTransports) {
+        if (exposeTransports.length > 0) {
+            enableAllTransport = false;
+            this.exposeTransports = exposeTransports;
+        }
     }
 }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/ClientUtils.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/ClientUtils.java?rev=378160&r1=378159&r2=378160&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/ClientUtils.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/ClientUtils.java Wed Feb 15 20:27:51 2006
@@ -3,10 +3,10 @@
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
 import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.ListenerManager;
 import org.apache.axis2.client.Options;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.engine.TransportManager;
 import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.util.XMLUtils;
 import org.w3c.dom.Document;
@@ -72,8 +72,6 @@
             if (!ac.isEngaged(new QName(Constants.MODULE_ADDRESSING))) {
                 throw new AxisFault(Messages.getMessage("2channelNeedAddressing"));
             }
-            ListenerManager.makeSureStarted(options.getTransportInProtocol(),
-                    msgCtxt.getServiceContext().getConfigurationContext());
         }
         return transportIn;
 

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutInAxisOperation.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutInAxisOperation.java?rev=378160&r1=378159&r2=378160&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutInAxisOperation.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutInAxisOperation.java Wed Feb 15 20:27:51 2006
@@ -2,7 +2,6 @@
 
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.ListenerManager;
 import org.apache.axis2.client.OperationClient;
 import org.apache.axis2.client.Options;
 import org.apache.axis2.client.async.AsyncResult;
@@ -12,6 +11,7 @@
 import org.apache.axis2.context.OperationContext;
 import org.apache.axis2.context.ServiceContext;
 import org.apache.axis2.engine.AxisEngine;
+import org.apache.axis2.engine.TransportManager;
 import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.transport.TransportUtils;
 import org.apache.axis2.util.CallbackReceiver;
@@ -251,9 +251,8 @@
             CallbackReceiver callbackReceiver = (CallbackReceiver) axisOp
                     .getMessageReceiver();
             callbackReceiver.addCallback(mc.getMessageID(), callback);
-            EndpointReference replyToFromTransport = ListenerManager
-                    .replyToEPR(cc, sc.getAxisService().getName() + "/"
-                            + axisOp.getName().getLocalPart(), mc
+            EndpointReference replyToFromTransport = TransportManager.transportManager.
+                    getERPforService(sc.getAxisService().getName(), axisOp.getName().getLocalPart(), mc
                             .getTransportIn().getName()
                             .getLocalPart());
 
@@ -391,8 +390,7 @@
     }
 
     public void complete(MessageContext msgCtxt) throws AxisFault {
-        ListenerManager.stop(msgCtxt.getConfigurationContext(),
-                msgCtxt.getTransportIn().getName().getLocalPart());
+        TransportManager.transportManager.stop();
     }
 
     /**

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutOnlyAxisOperation.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutOnlyAxisOperation.java?rev=378160&r1=378159&r2=378160&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutOnlyAxisOperation.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutOnlyAxisOperation.java Wed Feb 15 20:27:51 2006
@@ -2,7 +2,6 @@
 
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.ListenerManager;
 import org.apache.axis2.client.OperationClient;
 import org.apache.axis2.client.Options;
 import org.apache.axis2.client.async.Callback;
@@ -11,6 +10,7 @@
 import org.apache.axis2.context.OperationContext;
 import org.apache.axis2.context.ServiceContext;
 import org.apache.axis2.engine.AxisEngine;
+import org.apache.axis2.engine.TransportManager;
 import org.apache.axis2.util.UUIDGenerator;
 import org.apache.ws.commons.om.OMElement;
 import org.apache.wsdl.WSDLConstants;
@@ -268,7 +268,7 @@
         mc.setMessageID(messageId);
     }
 
-     private void addReferenceParameters(MessageContext msgctx) {
+    private void addReferenceParameters(MessageContext msgctx) {
         EndpointReference to = msgctx.getTo();
         if (options.isManageSession()) {
             EndpointReference tepr = sc.getTargetEPR();
@@ -356,7 +356,6 @@
     }
 
     public void complete(MessageContext msgCtxt) throws AxisFault {
-        ListenerManager.stop(msgCtxt.getConfigurationContext(),
-                msgCtxt.getTransportIn().getName().getLocalPart());
+        TransportManager.transportManager.stop();
     }
 }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfiguration.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfiguration.java?rev=378160&r1=378159&r2=378160&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfiguration.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfiguration.java Wed Feb 15 20:27:51 2006
@@ -190,24 +190,17 @@
 
     public synchronized void addServiceGroup(AxisServiceGroup axisServiceGroup) throws AxisFault {
         Iterator services = axisServiceGroup.getServices();
-
         axisServiceGroup.setParent(this);
-
         AxisService description;
-
         while (services.hasNext()) {
             description = (AxisService) services.next();
-
             if (allservices.get(description.getName()) != null) {
                 throw new AxisFault("Two services can not have same name, a service with "
                         + description.getName() + " already exists in the system");
             }
         }
-
         services = axisServiceGroup.getServices();
-
         Iterator enModule = engagedModules.iterator();
-
         while (enModule.hasNext()) {
             QName moduleName = (QName) enModule.next();
             axisServiceGroup.engageModule(getModule(moduleName));
@@ -224,7 +217,6 @@
             allservices.put(description.getName(), description);
             notifyObservers(AxisEvent.SERVICE_DEPLOY, description);
         }
-
 //        serviceGroups.put(axisServiceGroup.getServiceGroupName(), axisServiceGroup);
         addChild(axisServiceGroup);
     }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/DispatchPhase.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/DispatchPhase.java?rev=378160&r1=378159&r2=378160&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/DispatchPhase.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/DispatchPhase.java Wed Feb 15 20:27:51 2006
@@ -3,6 +3,7 @@
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.AxisService;
 import org.apache.axis2.i18n.Messages;
 
 import java.util.ArrayList;
@@ -26,9 +27,9 @@
 
 public class DispatchPhase extends Phase {
 
-	private static final long serialVersionUID = -6596799621473224363L;
+    private static final long serialVersionUID = -6596799621473224363L;
 
-	public DispatchPhase() {
+    public DispatchPhase() {
     }
 
     public DispatchPhase(String phaseName) {
@@ -48,6 +49,7 @@
                     : "") + " and WSA Action = " + msgContext.getWSAAction());
         }
 
+        validateTransport(msgContext);
         if (msgContext.getOperationContext() == null) {
             throw new AxisFault(Messages.getMessage("cannotBeNullOperationContext"));
         }
@@ -68,5 +70,31 @@
         ArrayList operationChain = msgContext.getAxisOperation().getRemainingPhasesInFlow();
 
         msgContext.setExecutionChain(operationChain);
+    }
+
+    /**
+     * To check wether the incoming request has come in valid transport , simpley the transports
+     * that service author wants to expose
+     *
+     * @param msgctx
+     */
+    private void validateTransport(MessageContext msgctx) throws AxisFault {
+        AxisService service = msgctx.getAxisService();
+        if (service.isEnableAllTransport()) {
+            return;
+        } else {
+            String trs [] = service.getExposeTransports();
+            String incommingTrs = msgctx.getIncomingTransportName();
+            for (int i = 0; i < trs.length; i++) {
+                String tr = trs[i];
+                if (incommingTrs.equals(tr)) {
+                    return;
+                }
+            }
+        }
+        EndpointReference toEPR = msgctx.getTo();
+        throw new AxisFault("Service Not found EPR is " + ((toEPR != null)
+                ? toEPR.getAddress()
+                : ""));
     }
 }

Added: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/TransportManager.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/TransportManager.java?rev=378160&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/TransportManager.java (added)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/TransportManager.java Wed Feb 15 20:27:51 2006
@@ -0,0 +1,142 @@
+package org.apache.axis2.engine;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.TransportInDescription;
+import org.apache.axis2.transport.TransportListener;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.xml.namespace.QName;
+import java.util.HashMap;
+import java.util.Iterator;
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+*
+*/
+
+public class TransportManager {
+    private Log log = LogFactory.getLog(getClass());
+
+    public static TransportManager transportManager;
+    private ConfigurationContext configctx;
+    private HashMap startedTranports = new HashMap();
+    private boolean stoped;
+
+    public void init(ConfigurationContext configCtx) {
+        this.configctx = configCtx;
+        transportManager = this;
+    }
+
+    public ConfigurationContext getConfigctx() {
+        return configctx;
+    }
+
+    /**
+     * To get an EPR for a given service
+     *
+     * @param serviceName  : Name of the service
+     * @param tranportName : name of the trasport can be null , if it is null then
+     * @return String
+     */
+    public EndpointReference getERPforService(String serviceName, String opName,
+                                              String tranportName) throws AxisFault {
+        if (tranportName == null || "".equals(tranportName)) {
+            AxisService service = configctx.getAxisConfiguration().getService(serviceName);
+            if (service == null) {
+                throw new AxisFault("Invalid service " +
+                        serviceName + " , not found in the system");
+            }
+            if (service.isEnableAllTransport()) {
+                Iterator itr_st = startedTranports.values().iterator();
+                if (itr_st.hasNext()) {
+                    TransportListener transportListener = (TransportListener) itr_st.next();
+                    return transportListener.getEPRForService(serviceName);
+                } else {
+                    return null;
+                }
+            } else {
+                String exposeTransport [] = service.getExposeTransports();
+                TransportListener listener = (TransportListener)
+                        startedTranports.get(exposeTransport[0]);
+                if (opName == null) {
+                    return listener.getEPRForService(serviceName);
+                } else return listener.getEPRForService(serviceName + "/" + opName);
+            }
+
+        } else {
+            TransportInDescription trsIN = configctx.getAxisConfiguration()
+                    .getTransportIn(new QName(tranportName));
+            TransportListener listener = trsIN.getReceiver();
+            if (opName == null) {
+                return listener.getEPRForService(serviceName);
+            } else return listener.getEPRForService(serviceName + "/" + opName);
+        }
+    }
+
+    /**
+     * To start all the tranports
+     */
+    public void start() throws AxisFault {
+        Iterator tranportNames = configctx.getAxisConfiguration().
+                getTransportsIn().values().iterator();
+        while (tranportNames.hasNext()) {
+            try {
+                TransportInDescription tranportIn = (TransportInDescription) tranportNames.next();
+                TransportListener listener = tranportIn.getReceiver();
+                if (listener != null) {
+                    listener.init(configctx, tranportIn);
+                    listener.start();
+                    if (startedTranports.get(tranportIn.getName().getLocalPart()) == null) {
+                        startedTranports.put(tranportIn.getName().getLocalPart(), listener);
+                    }
+                }
+            } catch (AxisFault axisFault) {
+                log.info(axisFault.getMessage());
+            }
+        }
+        stoped = false;
+    }
+
+    /**
+     * To stop all the tranport
+     */
+    public void stop() throws AxisFault {
+        Iterator itr_st = startedTranports.values().iterator();
+        while (itr_st.hasNext()) {
+            TransportListener transportListener = (TransportListener) itr_st.next();
+            transportListener.stop();
+        }
+        stoped = true;
+    }
+
+    public void addListener(TransportInDescription trsIn, boolean start) throws AxisFault {
+        configctx.getAxisConfiguration().addTransportIn(trsIn);
+        TransportListener transportListener = trsIn.getReceiver();
+        if (transportListener != null) {
+            if (!start) {
+                transportListener.start();
+            }
+            startedTranports.put(trsIn.getName().getLocalPart(), transportListener);
+        }
+    }
+
+    public boolean isStoped() {
+        return stoped;
+    }
+}

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/TransportListener.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/TransportListener.java?rev=378160&r1=378159&r2=378160&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/TransportListener.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/TransportListener.java Wed Feb 15 20:27:51 2006
@@ -25,15 +25,15 @@
 /**
  * Class TransportListener
  */
-public abstract class TransportListener {
+public interface TransportListener {
     public static final String PARAM_PORT = "port";
 
-    public abstract void init(ConfigurationContext axisConf, TransportInDescription transprtIn)
+    void init(ConfigurationContext axisConf, TransportInDescription transprtIn)
             throws AxisFault;
 
-    public abstract void start() throws AxisFault;
+    void start() throws AxisFault;
 
-    public abstract void stop() throws AxisFault;
+    void stop() throws AxisFault;
 
-    public abstract EndpointReference getEPRForService(String serviceName) throws AxisFault;
+    EndpointReference getEPRForService(String serviceName) throws AxisFault;
 }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/AxisServlet.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/AxisServlet.java?rev=378160&r1=378159&r2=378160&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/AxisServlet.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/AxisServlet.java Wed Feb 15 20:27:51 2006
@@ -19,12 +19,16 @@
 
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
+import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.ConfigurationContextFactory;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.context.SessionContext;
+import org.apache.axis2.description.TransportInDescription;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.engine.AxisEngine;
+import org.apache.axis2.engine.TransportManager;
+import org.apache.axis2.transport.TransportListener;
 
 import javax.servlet.ServletConfig;
 import javax.servlet.ServletContext;
@@ -43,7 +47,7 @@
 /**
  * Class AxisServlet
  */
-public class AxisServlet extends HttpServlet {
+public class AxisServlet extends HttpServlet implements TransportListener {
 
     private static final long serialVersionUID = -2085869393709833372L;
     private static final String CONFIGURATION_CONTEXT = "CONFIGURATION_CONTEXT";
@@ -65,11 +69,12 @@
 
         msgContext.setProperty(Constants.OUT_TRANSPORT_INFO,
                 new ServletBasedOutTransportInfo(httpServletResponse));
-        msgContext.setProperty(MessageContext.REMOTE_ADDR, httpServletRequest.getRemoteAddr()); 
+        msgContext.setProperty(MessageContext.REMOTE_ADDR, httpServletRequest.getRemoteAddr());
         msgContext.setProperty(MessageContext.TRANSPORT_HEADERS,
                 getTransportHeaders(httpServletRequest));
         msgContext.setProperty(SESSION_ID, httpServletRequest.getSession().getId());
         msgContext.setProperty(Constants.Configuration.TRANSPORT_IN_URL, httpServletRequest.getRequestURL().toString());
+        msgContext.setIncomingTransportName(Constants.TRANSPORT_HTTP);
 
         return msgContext;
     }
@@ -194,6 +199,12 @@
             lister = new ListingAgent(configContext);
             axisConfiguration = configContext.getAxisConfiguration();
             config.getServletContext().setAttribute(CONFIGURATION_CONTEXT, configContext);
+            TransportManager transportManager = new TransportManager();
+            transportManager.init(configContext);
+            TransportInDescription trsindes = new TransportInDescription(
+                    new QName(Constants.TRANSPORT_HTTP));
+            trsindes.setReceiver(this);
+            transportManager.addListener(trsindes, true);
         } catch (Exception e) {
             throw new ServletException(e);
         }
@@ -258,5 +269,29 @@
         }
 
         return headerMap;
+    }
+
+    /**
+     * To initilze as TransportListener , not as Servlet
+     *
+     * @param axisConf
+     * @param transprtIn
+     * @throws AxisFault
+     */
+    public void init(ConfigurationContext axisConf,
+                     TransportInDescription transprtIn) throws AxisFault {
+        // no need to do anything :)
+    }
+
+    public void start() throws AxisFault {
+        // no need to do anything :) , it is already started
+    }
+
+    public void stop() throws AxisFault {
+        // no one call thie method
+    }
+
+    public EndpointReference getEPRForService(String serviceName) throws AxisFault {
+        throw new UnsupportedOperationException("Not yet complete");
     }
 }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPWorker.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPWorker.java?rev=378160&r1=378159&r2=378160&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPWorker.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPWorker.java Wed Feb 15 20:27:51 2006
@@ -81,7 +81,7 @@
             SessionContext sessionContext = getSessionContext(cookieID);
 
             msgContext = new MessageContext();
-
+            msgContext.setIncomingTransportName(Constants.TRANSPORT_HTTP);
             msgContext.setConfigurationContext(configurationContext);
             msgContext.setSessionContext(sessionContext);
             msgContext.setTransportIn(configurationContext.getAxisConfiguration().getTransportIn(

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SimpleHTTPServer.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SimpleHTTPServer.java?rev=378160&r1=378159&r2=378160&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SimpleHTTPServer.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SimpleHTTPServer.java Wed Feb 15 20:27:51 2006
@@ -44,7 +44,7 @@
  * not use multiple instances of this class in the same JVM/classloader unless
  * you want bad things to happen at shutdown.
  */
-public class SimpleHTTPServer extends TransportListener {
+public class SimpleHTTPServer implements TransportListener {
 
     /**
      * Field log
@@ -76,7 +76,7 @@
      *
      * @param systemContext
      */
-    public SimpleHTTPServer(ConfigurationContext systemContext, int port) {
+    public SimpleHTTPServer(ConfigurationContext systemContext, int port) throws AxisFault {
         this(systemContext, port, null);
     }
 
@@ -96,7 +96,7 @@
      * @param systemContext
      * @param pool
      */
-    public SimpleHTTPServer(ConfigurationContext systemContext, int port, ThreadFactory pool) {
+    public SimpleHTTPServer(ConfigurationContext systemContext, int port, ThreadFactory pool) throws AxisFault {
         // If a threadPool is not passed-in the threadpool
         // from the ConfigurationContext
         // is used. This is a bit tricky, and might cause a
@@ -123,7 +123,6 @@
             this.port = port;
             this.configurationContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(repoPath,
                     axis2xml);
-
             // If a thread pool is not passed the thread pool from the config context
             // is used. If one is passed it is set on the config context.
             if (pool == null) {
@@ -249,7 +248,7 @@
      * @see org.apache.axis2.transport.TransportListener#getEPRForService(String)
      */
     public EndpointReference getEPRForService(String serviceName) throws AxisFault {
-        String hostAddress ;
+        String hostAddress;
         try {
             hostAddress = SimpleHttpServerConnection.getIpAddress();
         } catch (SocketException e) {

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/jms/SimpleJMSListener.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/jms/SimpleJMSListener.java?rev=378160&r1=378159&r2=378160&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/jms/SimpleJMSListener.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/jms/SimpleJMSListener.java Wed Feb 15 20:27:51 2006
@@ -39,6 +39,7 @@
 import java.util.Iterator;
 import java.util.Properties;
 
+
 /**
  * SimpleJMSListener implements the javax.jms.MessageListener interface. Its
  * basic purpose is listen asynchronously for messages and to pass them off
@@ -48,7 +49,7 @@
  * is not otherwise tuned for performance. As such, its intended use is not
  * for production code, but for demos, debugging, and performance profiling.
  */
-public class SimpleJMSListener extends TransportListener implements MessageListener {
+public class SimpleJMSListener implements MessageListener, TransportListener {
     protected static Log log = LogFactory.getLog(SimpleJMSListener.class.getName());
 
     // Do we use (multiple) threads to process incoming messages?
@@ -219,12 +220,11 @@
         try {
             startListener();
             endpoint.registerListener(this, properties);
+            connector.start();
         } catch (Exception e) {
             log.error(Messages.getMessage("exception00"), e);
             e.printStackTrace();
         }
-
-        connector.start();
     }
 
     public void stop() throws AxisFault {

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/jms/SimpleJMSWorker.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/jms/SimpleJMSWorker.java?rev=378160&r1=378159&r2=378160&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/jms/SimpleJMSWorker.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/jms/SimpleJMSWorker.java Wed Feb 15 20:27:51 2006
@@ -239,6 +239,7 @@
                             new QName(Constants.TRANSPORT_JMS));
 
             msgContext = new MessageContext();
+            msgContext.setIncomingTransportName(Constants.TRANSPORT_JMS);
             msgContext.setConfigurationContext(configurationContext);
             msgContext.setTransportIn(transportIn);
             msgContext.setTransportOut(transportOut);

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/mail/MailWorker.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/mail/MailWorker.java?rev=378160&r1=378159&r2=378160&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/mail/MailWorker.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/mail/MailWorker.java Wed Feb 15 20:27:51 2006
@@ -42,12 +42,10 @@
 import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLStreamReader;
 import java.io.ByteArrayInputStream;
-import java.util.Properties;
 
 public class MailWorker implements Runnable {
     protected static Log log = LogFactory.getLog(MailWorker.class.getName());
     private ConfigurationContext configContext = null;
-    private Properties prop = new Properties();
     private MimeMessage mimeMessage;
 
     /**
@@ -91,6 +89,7 @@
 
                 msgContext.setWSAAction(soapAction);
                 msgContext.setSoapAction(soapAction);
+                msgContext.setIncomingTransportName(Constants.TRANSPORT_MAIL);
 
                 // TODO add the transport Headers to the Message Context
                 // Create Mail EPR, EPR is constructed using the format, foo@bar/axis2/services/echo and is constructed
@@ -98,13 +97,6 @@
                 InternetAddress[] recepainets = (InternetAddress[]) mimeMessage.getAllRecipients();
 
                 if ((recepainets != null) && (recepainets.length > 0)) {
-                    String emailAddress = recepainets[0].getAddress();
-                    String emailSubject = mimeMessage.getSubject();
-                    EndpointReference to = new EndpointReference(emailAddress + "/"
-                            + ((emailSubject != null)
-                            ? emailSubject
-                            : ""));
-                    //TODO: FixME: There's nothing happening here ??? 
                 } else {
                     throw new AxisFault(Messages.getMessage("noRecep4Email"));
                 }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/mail/SimpleMailListener.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/mail/SimpleMailListener.java?rev=378160&r1=378159&r2=378160&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/mail/SimpleMailListener.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/mail/SimpleMailListener.java Wed Feb 15 20:27:51 2006
@@ -48,7 +48,7 @@
  * internationalization work is done this can be fixed. CT 15-Feb-2005
  *
  */
-public class SimpleMailListener extends TransportListener implements Runnable {
+public class SimpleMailListener implements Runnable, TransportListener {
     protected static Log log = LogFactory.getLog(SimpleMailListener.class.getName());
 
     // Are we doing threads?
@@ -111,12 +111,9 @@
     public void init(ConfigurationContext configurationContext, TransportInDescription transportIn)
             throws AxisFault {
         this.configurationContext = configurationContext;
-        user =
-                Utils.getParameterValue(transportIn.getParameter(MailSrvConstants.POP3_USER));
-        host =
-                Utils.getParameterValue(transportIn.getParameter(MailSrvConstants.POP3_HOST));
-        password =
-                Utils.getParameterValue(transportIn.getParameter(MailSrvConstants.POP3_PASSWORD));
+        user = Utils.getParameterValue(transportIn.getParameter(MailSrvConstants.POP3_USER));
+        host = Utils.getParameterValue(transportIn.getParameter(MailSrvConstants.POP3_HOST));
+        password = Utils.getParameterValue(transportIn.getParameter(MailSrvConstants.POP3_PASSWORD));
         port = Utils.getParameterValue(transportIn.getParameter(MailSrvConstants.POP3_PORT));
         replyTo = Utils.getParameterValue(transportIn.getParameter(MailSrvConstants.RAPLY_TO));
 

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/tcp/TCPServer.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/tcp/TCPServer.java?rev=378160&r1=378159&r2=378160&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/tcp/TCPServer.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/tcp/TCPServer.java Wed Feb 15 20:27:51 2006
@@ -19,12 +19,12 @@
 
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.ListenerManager;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.ConfigurationContextFactory;
 import org.apache.axis2.deployment.DeploymentException;
 import org.apache.axis2.description.Parameter;
 import org.apache.axis2.description.TransportInDescription;
+import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.transport.TransportListener;
 import org.apache.axis2.transport.http.SimpleHTTPServer;
 import org.apache.commons.logging.Log;
@@ -38,7 +38,7 @@
 /**
  * Class TCPServer
  */
-public class TCPServer extends TransportListener implements Runnable {
+public class TCPServer implements Runnable, TransportListener {
     private int port = 8000;
     private boolean started = false;
     protected Log log = LogFactory.getLog(SimpleHTTPServer.class.getName());
@@ -123,17 +123,33 @@
 
     public synchronized void start() throws AxisFault {
         if (serversocket == null) {
-            serversocket = ListenerManager.openSocket(port);
+            serversocket = openSocket(port);
         }
-
         started = true;
         this.configContext.getThreadPool().execute(this);
     }
 
-    /*
-     *  (non-Javadoc)
-     * @see org.apache.axis2.transport.TransportListener#stop()
+
+    /**
+     * Controls the number of server sockets kept open.
      */
+    public ServerSocket openSocket(int port) throws AxisFault {
+        for (int i = 0; i < 5; i++) {
+            try {
+                return new ServerSocket(port + i);
+            } catch (IOException e) {
+                // What I'm gonna do here. Try again.
+            }
+        }
+
+        throw new AxisFault(Messages.getMessage("failedToOpenSocket"));
+    }
+
+
+    /*
+    *  (non-Javadoc)
+    * @see org.apache.axis2.transport.TransportListener#stop()
+    */
     public void stop() throws AxisFault {
         try {
             this.serversocket.close();

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/tcp/TCPWorker.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/tcp/TCPWorker.java?rev=378160&r1=378159&r2=378160&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/tcp/TCPWorker.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/tcp/TCPWorker.java Wed Feb 15 20:27:51 2006
@@ -69,6 +69,7 @@
 
                 // create the Message Context and fill in the values
                 msgContext = new MessageContext();
+                msgContext.setIncomingTransportName(Constants.TRANSPORT_TCP);
                 msgContext.setConfigurationContext(configurationContext);
                 msgContext.setTransportIn(transportIn);
                 msgContext.setTransportOut(transportOut);

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/CallbackReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/CallbackReceiver.java?rev=378160&r1=378159&r2=378160&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/CallbackReceiver.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/CallbackReceiver.java Wed Feb 15 20:27:51 2006
@@ -2,7 +2,6 @@
 
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.RelatesTo;
-import org.apache.axis2.client.ListenerManager;
 import org.apache.axis2.client.async.AsyncResult;
 import org.apache.axis2.client.async.Callback;
 import org.apache.axis2.context.MessageContext;
@@ -37,8 +36,6 @@
             callback.onComplete(result);
             callback.setComplete(true);
             //closing the tranport
-            ListenerManager.stop(messageCtx.getConfigurationContext(),
-                    messageCtx.getTransportIn().getName().getLocalPart());
         } else {
             throw new AxisFault("The Callback realtes to MessageID " + messageID + " is not found");
         }

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/CharactersetEncodingTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/CharactersetEncodingTest.java?rev=378160&r1=378159&r2=378160&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/CharactersetEncodingTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/CharactersetEncodingTest.java Wed Feb 15 20:27:51 2006
@@ -86,7 +86,7 @@
 //            OMElement resultElem = call.invokeBlocking(operationName.getLocalPart(), payload);
 
             ConfigurationContext configContext =
-                    ConfigurationContextFactory.createConfigurationContextFromFileSystem(Constants.TESTING_PATH + "chunking-enabledRepository",null);
+                    ConfigurationContextFactory.createConfigurationContextFromFileSystem(Constants.TESTING_PATH + "chunking-enabledRepository", null);
             ServiceClient sender = new ServiceClient(configContext, null);
             sender.setOptions(options);
 
@@ -99,9 +99,7 @@
             assertNotNull("Result value is null", result);
 
             assertEquals("Expected result not received.", expected, result);
-
-//            call.close();
-
+            sender.finalizeInvoke();
         } catch (AxisFault e) {
             log.error(e, e);
             assertFalse("Failure in processing", true);

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/CommonsHTTPEchoRawXMLTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/CommonsHTTPEchoRawXMLTest.java?rev=378160&r1=378159&r2=378160&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/CommonsHTTPEchoRawXMLTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/CommonsHTTPEchoRawXMLTest.java Wed Feb 15 20:27:51 2006
@@ -42,6 +42,7 @@
 
     private AxisService service;
 
+
     private boolean finish = false;
 
     public CommonsHTTPEchoRawXMLTest() {
@@ -88,7 +89,7 @@
         };
 
         ConfigurationContext configContext =
-                ConfigurationContextFactory.createConfigurationContextFromFileSystem(Constants.TESTING_PATH + "commons-http-enabledRepository",null);
+                ConfigurationContextFactory.createConfigurationContextFromFileSystem(Constants.TESTING_PATH + "commons-http-enabledRepository", null);
         ServiceClient sender = new ServiceClient(configContext, null);
         sender.setOptions(options);
 
@@ -105,7 +106,7 @@
         }
 //        call.close();
 //
-
+        sender.finalizeInvoke();
         log.info("send the reqest");
     }
 
@@ -115,13 +116,14 @@
         options.setTo(targetEPR);
         options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
         ConfigurationContext configContext =
-                ConfigurationContextFactory.createConfigurationContextFromFileSystem(Constants.TESTING_PATH + "commons-http-enabledRepository",null);
+                ConfigurationContextFactory.createConfigurationContextFromFileSystem(Constants.TESTING_PATH + "commons-http-enabledRepository", null);
         ServiceClient sender = new ServiceClient(configContext, null);
         sender.setOptions(options);
 
         OMElement result = sender.sendReceive(payload);
 
         TestingUtils.campareWithCreatedOMElement(result);
+        sender.finalizeInvoke();
 //        call.close();
     }
 

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/EchoRawXMLLoadTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/EchoRawXMLLoadTest.java?rev=378160&r1=378159&r2=378160&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/EchoRawXMLLoadTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/EchoRawXMLLoadTest.java Wed Feb 15 20:27:51 2006
@@ -48,8 +48,6 @@
                         Echo.class.getName(),
                         operationName);
         UtilServer.deployService(service);
-
-
     }
 
     protected void tearDown() throws Exception {

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/EchoRawXMLMultipleTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/EchoRawXMLMultipleTest.java?rev=378160&r1=378159&r2=378160&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/EchoRawXMLMultipleTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/EchoRawXMLMultipleTest.java Wed Feb 15 20:27:51 2006
@@ -18,6 +18,7 @@
 import junit.framework.TestCase;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
+import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.client.Options;
 import org.apache.axis2.client.ServiceClient;
 import org.apache.axis2.client.async.AsyncResult;
@@ -77,11 +78,14 @@
 
     public void testEchoXMLMultipleASync() throws Exception {
         OMElement payload = TestingUtils.createDummyOMElement();
-
+        Options options = new Options();
+        options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
+        ConfigurationContext configContext =
+                ConfigurationContextFactory.createConfigurationContextFromFileSystem("target/test-resources/integrationRepo", null);
+        ServiceClient sender = new ServiceClient(configContext, null);
+        sender.setOptions(options);
+        options.setTo(targetEPR);
         for (int i = 0; i < 5; i++) {
-            Options options = new Options();
-            options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
-
             Callback callback = new Callback() {
                 public void onComplete(AsyncResult result) {
                     TestingUtils.campareWithCreatedOMElement(
@@ -95,15 +99,7 @@
                     finish = true;
                 }
             };
-            ConfigurationContext configContext =
-                    ConfigurationContextFactory.createConfigurationContextFromFileSystem("target/test-resources/integrationRepo", null);
-            ServiceClient sender = new ServiceClient(configContext, null);
-            sender.setOptions(options);
-            options.setTo(targetEPR);
-
             sender.sendReceiveNonblocking(payload, callback);
-
-
             int index = 0;
             while (!finish) {
                 Thread.sleep(1000);
@@ -113,10 +109,8 @@
                             "Server was shutdown as the async response take too long to complete");
                 }
             }
-
         }
-
-
+        sender.finalizeInvoke();
         log.info("send the request");
 
     }
@@ -127,7 +121,9 @@
         ConfigurationContext configContext =
                 ConfigurationContextFactory.createConfigurationContextFromFileSystem("target/test-resources/integrationRepo", null);
         ServiceClient sender = new ServiceClient(configContext, null);
-
+        EndpointReference targetEPR = new EndpointReference(
+                "http://127.0.0.1:" + (5000)
+                        + "/axis2/services/EchoXMLService/echoOMElement");
         for (int i = 0; i < 5; i++) {
             Options options = new Options();
             options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
@@ -162,47 +158,43 @@
                 }
             }
         }
-
+        sender.finalizeInvoke();
         log.info("send the request");
     }
 
     public void testEchoXMLMultipleSync() throws Exception {
         OMElement payload = TestingUtils.createDummyOMElement();
+        Options options = new Options();
+        options.setTo(targetEPR);
+        options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
+        ConfigurationContext configContext =
+                ConfigurationContextFactory.createConfigurationContextFromFileSystem("target/test-resources/integrationRepo", null);
+        ServiceClient sender = new ServiceClient(configContext, null);
+        sender.setOptions(options);
         for (int i = 0; i < 5; i++) {
-            Options options = new Options();
-            options.setTo(targetEPR);
-            options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
-            ConfigurationContext configContext =
-                    ConfigurationContextFactory.createConfigurationContextFromFileSystem("target/test-resources/integrationRepo", null);
-            ServiceClient sender = new ServiceClient(configContext, null);
-            sender.setOptions(options);
-
             OMElement result = sender.sendReceive(payload);
-
-
             TestingUtils.campareWithCreatedOMElement(result);
         }
+        sender.finalizeInvoke();
     }
 
     public void testEchoXMLMultipleDuelSync() throws Exception {
         OMElement payload = TestingUtils.createDummyOMElement();
-        for (int i = 0; i < 5; i++) {
-
-            Options options = new Options();
-            options.setTo(targetEPR);
-            options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
-            options.setUseSeparateListener(true);
+        Options options = new Options();
+        options.setTo(targetEPR);
+        options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
+        options.setUseSeparateListener(true);
 
-            ConfigurationContext configContext =
-                    ConfigurationContextFactory.createConfigurationContextFromFileSystem("target/test-resources/integrationRepo", null);
-            ServiceClient sender = new ServiceClient(configContext, null);
-
-            sender.setOptions(options);
+        ConfigurationContext configContext =
+                ConfigurationContextFactory.createConfigurationContextFromFileSystem("target/test-resources/integrationRepo", null);
+        ServiceClient sender = new ServiceClient(configContext, null);
 
+        sender.setOptions(options);
+        for (int i = 0; i < 5; i++) {
             OMElement result = sender.sendReceive(payload);
-
             TestingUtils.campareWithCreatedOMElement(result);
         }
+        sender.finalizeInvoke();
     }
 
 

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/EchoRawXMLOnTwoChannelsSyncTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/EchoRawXMLOnTwoChannelsSyncTest.java?rev=378160&r1=378159&r2=378160&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/EchoRawXMLOnTwoChannelsSyncTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/EchoRawXMLOnTwoChannelsSyncTest.java Wed Feb 15 20:27:51 2006
@@ -89,6 +89,7 @@
         OMElement result = sender.sendReceive(operationName, method);
 
         TestingUtils.campareWithCreatedOMElement(result);
+        sender.finalizeInvoke();
 
     }
 

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/EchoRawXMLOnTwoChannelsTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/EchoRawXMLOnTwoChannelsTest.java?rev=378160&r1=378159&r2=378160&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/EchoRawXMLOnTwoChannelsTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/EchoRawXMLOnTwoChannelsTest.java Wed Feb 15 20:27:51 2006
@@ -87,7 +87,7 @@
         OMElement value = fac.createOMElement("myValue", omNs);
         value.setText("Isaac Asimov, The Foundation Trilogy");
         method.addChild(value);
-        ServiceClient sender = null;
+        ServiceClient sender =null;
 
         try {
             Options options = new Options();
@@ -127,6 +127,7 @@
             }
             log.info("send the reqest");
         } finally {
+            sender.finalizeInvoke();
         }
 
     }

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/ServiceDispatchingTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/ServiceDispatchingTest.java?rev=378160&r1=378159&r2=378160&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/ServiceDispatchingTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/ServiceDispatchingTest.java Wed Feb 15 20:27:51 2006
@@ -35,6 +35,9 @@
 
 public class ServiceDispatchingTest extends TestCase implements TestConstants {
 
+
+    private int testCount = 3;
+
     public ServiceDispatchingTest() {
         super(ServiceDispatchingTest.class.getName());
     }
@@ -54,7 +57,9 @@
 
     protected void tearDown() throws Exception {
         UtilServer.unDeployService(serviceName);
-        UtilServer.stop();
+        if (testCount == 0) {
+            UtilServer.stop();
+        }
         UtilServer.unDeployClientService();
     }
 
@@ -64,7 +69,7 @@
         Options options = new Options();
         options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
         ConfigurationContext configContext =
-                ConfigurationContextFactory.createConfigurationContextFromFileSystem("target/test-resources/integrationRepo",null);
+                ConfigurationContextFactory.createConfigurationContextFromFileSystem("target/test-resources/integrationRepo", null);
         ServiceClient sender = new ServiceClient(configContext, null);
         sender.setOptions(options);
         options.setTo(targetEPR);
@@ -72,6 +77,7 @@
         OMElement result = sender.sendReceive(payload);
 
         TestingUtils.campareWithCreatedOMElement(result);
+        testCount --;
     }
 
     public void testDispatchWithURLAndSOAPAction() throws Exception {
@@ -88,12 +94,13 @@
         options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
         options.setSoapAction("echoOMElement");
         ConfigurationContext configContext =
-                ConfigurationContextFactory.createConfigurationContextFromFileSystem("target/test-resources/integrationRepo",null);
+                ConfigurationContextFactory.createConfigurationContextFromFileSystem("target/test-resources/integrationRepo", null);
         ServiceClient sender = new ServiceClient(configContext, null);
         sender.setOptions(options);
 
         OMElement result = sender.sendReceive(payload);
         TestingUtils.campareWithCreatedOMElement(result);
+        testCount --;
     }
 
     public void testDispatchWithSOAPBody() throws Exception {
@@ -109,7 +116,7 @@
         Options options = new Options();
         options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
         ConfigurationContext configContext =
-                ConfigurationContextFactory.createConfigurationContextFromFileSystem("target/test-resources/integrationRepo",null);
+                ConfigurationContextFactory.createConfigurationContextFromFileSystem("target/test-resources/integrationRepo", null);
         ServiceClient sender = new ServiceClient(configContext, null);
         sender.setOptions(options);
         options.setTo(targetEPR);
@@ -117,5 +124,6 @@
         OMElement result = sender.sendReceive(payload);
 
         TestingUtils.campareWithCreatedOMElement(result);
+        testCount --;
     }
 }

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/integration/UtilServer.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/integration/UtilServer.java?rev=378160&r1=378159&r2=378160&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/integration/UtilServer.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/integration/UtilServer.java Wed Feb 15 20:27:51 2006
@@ -26,6 +26,7 @@
 import org.apache.axis2.description.AxisModule;
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.description.AxisServiceGroup;
+import org.apache.axis2.engine.TransportManager;
 import org.apache.axis2.transport.http.SimpleHTTPServer;
 
 import javax.xml.namespace.QName;
@@ -99,7 +100,7 @@
         return ConfigurationContextFactory.createConfigurationContextFromFileSystem(file.getAbsolutePath(), null);
     }
 
-    public static synchronized void stop() {
+    public static synchronized void stop() throws AxisFault {
         if (count == 1) {
             receiver.stop();
             while (receiver.isRunning()) {
@@ -113,6 +114,10 @@
             System.out.print("Server stopped .....");
         } else {
             count--;
+        }
+        if (TransportManager.transportManager != null) {
+            TransportManager.transportManager.stop();
+            TransportManager.transportManager = null;
         }
     }
 

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/integration/UtilsTCPServer.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/integration/UtilsTCPServer.java?rev=378160&r1=378159&r2=378160&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/integration/UtilsTCPServer.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/integration/UtilsTCPServer.java Wed Feb 15 20:27:51 2006
@@ -22,6 +22,7 @@
 import org.apache.axis2.context.ServiceGroupContext;
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.description.AxisServiceGroup;
+import org.apache.axis2.engine.TransportManager;
 import org.apache.axis2.transport.tcp.TCPServer;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -66,7 +67,7 @@
             }
 
             ConfigurationContext er = ConfigurationContextFactory.createConfigurationContextFromFileSystem(file
-                    .getAbsolutePath(),null);
+                    .getAbsolutePath(), null);
             try {
                 Thread.sleep(2000);
             } catch (InterruptedException e1) {
@@ -80,7 +81,7 @@
         count++;
     }
 
-    public static synchronized void stop() {
+    public static synchronized void stop() throws AxisFault{
         try {
             if (count == 1) {
                 receiver.stop();
@@ -91,6 +92,10 @@
             }
         } catch (AxisFault e) {
             log.error(e.getMessage(), e);
+        }
+        if (TransportManager.transportManager != null) {
+            TransportManager.transportManager.stop();
+            TransportManager.transportManager = null;
         }
     }
 

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/tcp/TCPEchoRawXMLTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/tcp/TCPEchoRawXMLTest.java?rev=378160&r1=378159&r2=378160&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/tcp/TCPEchoRawXMLTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/tcp/TCPEchoRawXMLTest.java Wed Feb 15 20:27:51 2006
@@ -142,6 +142,7 @@
                         "Server was shutdown as the async response take too long to complete");
             }
         }
+        sender.finalizeInvoke();
     }
 
     public void testEchoXMLSync() throws Exception {
@@ -157,6 +158,7 @@
 
         result.serialize(XMLOutputFactory.newInstance().createXMLStreamWriter(
                 System.out));
+        sender.finalizeInvoke();
     }
 
     public void testEchoXMLCompleteSync() throws Exception {
@@ -180,6 +182,7 @@
 
         result.serialize(XMLOutputFactory.newInstance().createXMLStreamWriter(
                 System.out));
+        sender.finalizeInvoke();
 
     }
 
@@ -223,6 +226,7 @@
         assertNotNull(env);
         env.getBody().serialize(XMLOutputFactory.newInstance().createXMLStreamWriter(
                 System.out));
+        sender.finalizeInvoke();
     }
 
 

Modified: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPConnectionImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPConnectionImpl.java?rev=378160&r1=378159&r2=378160&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPConnectionImpl.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPConnectionImpl.java Wed Feb 15 20:27:51 2006
@@ -35,16 +35,7 @@
 
 import javax.activation.DataHandler;
 import javax.xml.namespace.QName;
-import javax.xml.soap.AttachmentPart;
-import javax.xml.soap.MessageFactory;
-import javax.xml.soap.SOAPBody;
-import javax.xml.soap.SOAPConnection;
-import javax.xml.soap.SOAPElement;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPHeader;
-import javax.xml.soap.SOAPHeaderElement;
-import javax.xml.soap.SOAPMessage;
-import javax.xml.soap.SOAPPart;
+import javax.xml.soap.*;
 import javax.xml.stream.XMLStreamException;
 import java.io.ByteArrayOutputStream;
 import java.net.MalformedURLException;
@@ -63,6 +54,8 @@
      */
     private boolean closed = false;
 
+    private ServiceClient serviceClient;
+
     private Log log = LogFactory.getLog(getClass());
 
     /**
@@ -103,7 +96,8 @@
         // initialize the Sender
         OperationClient opClient;
         try {
-            opClient = new ServiceClient().createClient(ServiceClient.ANON_OUT_IN_OP);
+            serviceClient = new ServiceClient();
+            opClient = serviceClient.createClient(ServiceClient.ANON_OUT_IN_OP);
         } catch (AxisFault e) {
             throw new SOAPException(e);
         }
@@ -124,6 +118,13 @@
      *                                      or this SOAPConnection is already closed
      */
     public void close() throws SOAPException {
+        if(serviceClient!=null){
+            try {
+                serviceClient.finalizeInvoke();
+            } catch (AxisFault axisFault) {
+                throw new SOAPException(axisFault.getMessage());
+            }
+        }
         if (closed) {
             throw new SOAPException("SOAPConnection Closed");
         }
@@ -173,15 +174,15 @@
             final QName hbQName = hb.getQName();
             final SOAPHeaderElement headerEle =
                     header.addHeaderElement(env.createName(hbQName.getLocalPart(),
-                                                           hbQName.getPrefix(),
-                                                           hbQName.getNamespaceURI()));
+                            hbQName.getPrefix(),
+                            hbQName.getNamespaceURI()));
             for (Iterator attribIter = hb.getAllAttributes(); attribIter.hasNext();) {
                 OMAttribute attr = (OMAttribute) attribIter.next();
                 final QName attrQName = attr.getQName();
                 headerEle.addAttribute(env.createName(attrQName.getLocalPart(),
-                                                      attrQName.getPrefix(),
-                                                      attrQName.getNamespaceURI()),
-                                       attr.getAttributeValue());
+                        attrQName.getPrefix(),
+                        attrQName.getNamespaceURI()),
+                        attr.getAttributeValue());
             }
             final String role = hb.getRole();
             if (role != null) {
@@ -233,7 +234,7 @@
                         saajSOAPMsg.addAttachmentPart(attachment);
 
                         saajEle.addAttribute(saajSOAPMsg.getSOAPPart().getEnvelope().createName("href"),
-                                             "cid:" + sessionID);
+                                "cid:" + sessionID);
                     } else {
                         saajChildEle = saajEle.addTextNode(omText.getText());
                     }
@@ -242,17 +243,17 @@
                     final QName omChildQName = omChildEle.getQName();
                     saajChildEle =
                             saajEle.addChildElement(omChildQName.getLocalPart(),
-                                                    omChildQName.getPrefix(),
-                                                    omChildQName.getNamespaceURI());
+                                    omChildQName.getPrefix(),
+                                    omChildQName.getNamespaceURI());
                     for (Iterator attribIter = omChildEle.getAllAttributes();
                          attribIter.hasNext();) {
                         OMAttribute attr = (OMAttribute) attribIter.next();
                         final QName attrQName = attr.getQName();
                         saajChildEle.addAttribute(saajSOAPMsg.getSOAPPart().getEnvelope().
                                 createName(attrQName.getLocalPart(),
-                                           attrQName.getPrefix(),
-                                           attrQName.getNamespaceURI()),
-                                                  attr.getAttributeValue());
+                                attrQName.getPrefix(),
+                                attrQName.getNamespaceURI()),
+                                attr.getAttributeValue());
                     }
                 }
 
@@ -264,7 +265,7 @@
 
     /**
      * Converts a SAAJ SOAPMessage to an OM SOAPEnvelope
-     * 
+     *
      * @param saajSOAPMsg
      * @return
      * @throws SOAPException
@@ -279,8 +280,7 @@
         final Iterator attachments = saajSOAPMsg.getAttachments();
         while (attachments.hasNext()) {
             final AttachmentPart attachment = (AttachmentPart) attachments.next();
-            if (attachment.getContentId() == null || attachment.getContentId().trim().length() == 0)
-            {
+            if (attachment.getContentId() == null || attachment.getContentId().trim().length() == 0) {
                 throw new SOAPException("Attachment with NULL or Empty contend ID");
             }
             if (attachment.getDataHandler() == null) {
@@ -316,7 +316,7 @@
                 child.build();
                 OMText text =
                         new OMTextImpl(((AttachmentPart) attachments.get(contentID.trim())).getDataHandler(),
-                                       true);
+                                true);
                 child.removeAttribute(hrefAttr);
                 child.addChild(text);
             } else {

Modified: webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/integration/IntegrationTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/integration/IntegrationTest.java?rev=378160&r1=378159&r2=378160&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/integration/IntegrationTest.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/integration/IntegrationTest.java Wed Feb 15 20:27:51 2006
@@ -75,6 +75,7 @@
 
             String responseStr = printResponse(response);
             assertTrue(responseStr.indexOf("echo") != -1);
+            sCon.close();
         } catch (SOAPException e) {
             e.printStackTrace();
             fail("Unexpected Exception while running test: " + e);
@@ -149,6 +150,8 @@
                            || attachment.getContentType().equals("text/plain"));
             }
         }
+
+        sCon.close();
 
         /*final SOAPBody respBody = response.getSOAPPart().getEnvelope().getBody();
         System.out.println("------------------------------------");



Mime
View raw message