You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by pr...@apache.org on 2007/06/17 14:11:57 UTC

svn commit: r548033 [9/11] - in /webservices/axis2/branches/java/jaxws21: ./ etc/ modules/adb-codegen/ modules/adb-codegen/src/org/apache/axis2/schema/ modules/adb-codegen/src/org/apache/axis2/schema/template/ modules/adb-codegen/src/org/apache/axis2/s...

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/DependencyManager.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/DependencyManager.java?view=diff&rev=548033&r1=548032&r2=548033
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/DependencyManager.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/DependencyManager.java Sun Jun 17 05:11:16 2007
@@ -44,26 +44,29 @@
 
     public static void initServiceClass(Object obj,
                                         ServiceContext serviceContext) {
+        Class classToLoad = obj.getClass();
+        // We can not call classToLoad.getDeclaredMethed() , since there
+        //  can be insatnce where mutiple services extends using one class
+        // just for init and other reflection methods
+        Method method =
+                null;
         try {
-            Class classToLoad = obj.getClass();
-            // We can not call classToLoad.getDeclaredMethed() , since there
-            //  can be insatnce where mutiple services extends using one class
-            // just for init and other reflection methods
-            Method method =
-                    classToLoad.getMethod(SERVICE_INIT_METHOD, new Class[]{ServiceContext.class});
-            if (method != null) {
+            method = classToLoad.getMethod(SERVICE_INIT_METHOD, new Class[]{ServiceContext.class});
+        } catch (Exception e) {
+            //We do not need to inform this to user , since this something
+            // Axis2 is checking to support Session. So if the method is
+            // not there we should ignore that
+        }
+        if (method != null) {
+            try {
                 method.invoke(obj, new Object[]{serviceContext});
+            } catch (IllegalAccessException e) {
+                log.info("Exception trying to call " + SERVICE_INIT_METHOD, e);
+            } catch (IllegalArgumentException e) {
+                log.info("Exception trying to call " + SERVICE_INIT_METHOD, e);
+            } catch (InvocationTargetException e) {
+                log.info("Exception trying to call " + SERVICE_INIT_METHOD, e);
             }
-        } catch (SecurityException e) {
-            log.info("Exception trying to call " + SERVICE_INIT_METHOD, e);
-        } catch (IllegalArgumentException e) {
-            log.info("Exception trying to call " + SERVICE_INIT_METHOD, e);
-        } catch (IllegalAccessException e) {
-            log.info("Exception trying to call " + SERVICE_INIT_METHOD, e);
-        } catch (InvocationTargetException e) {
-            log.info("Exception trying to call " + SERVICE_INIT_METHOD, e);
-        } catch (NoSuchMethodException e) {
-            log.debug("Exception trying to call " + SERVICE_INIT_METHOD, e);
         }
     }
 
@@ -103,33 +106,29 @@
 
 
     public static void destroyServiceObject(ServiceContext serviceContext) {
-        try {
-            Object obj = serviceContext.getProperty(ServiceContext.SERVICE_OBJECT);
-            if (obj != null) {
-                Class classToLoad = obj.getClass();
-
-                // We can not call classToLoad.getDeclaredMethed() , since there
-                //  can be insatnce where mutiple services extends using one class
-                // just for init and other reflection methods
-                Method[] methods = classToLoad.getMethods();
-
-                for (int i = 0; i < methods.length; i++) {
-                    if (SERVICE_DESTROY_METHOD.equals(methods[i].getName())
-                            && (methods[i].getParameterTypes().length == 1)
-                            && (methods[i].getParameterTypes()[0] == ServiceContext.class)) {
-                        methods[i].invoke(obj, new Object[]{serviceContext});
-                        break;
-                    }
+        Object obj = serviceContext.getProperty(ServiceContext.SERVICE_OBJECT);
+        if (obj != null) {
+            Class classToLoad = obj.getClass();
+            Method method =
+                    null;
+            try {
+                method = classToLoad.getMethod(SERVICE_DESTROY_METHOD, new Class[]{ServiceContext.class});
+            } catch (NoSuchMethodException e) {
+                //We do not need to inform this to user , since this something
+                // Axis2 is checking to support Session. So if the method is
+                // not there we should ignore that
+            }
+
+            if(method!=null){
+                try {
+                    method.invoke(obj, new Object[]{serviceContext});
+                } catch (IllegalAccessException e) {
+                    log.info("Exception trying to call " + SERVICE_DESTROY_METHOD, e);
+                } catch (InvocationTargetException e) {
+                    log.info("Exception trying to call " + SERVICE_DESTROY_METHOD, e);
                 }
             }
-        } catch (SecurityException e) {
-            log.info("Exception trying to call " + SERVICE_DESTROY_METHOD, e);
-        } catch (IllegalArgumentException e) {
-            log.info("Exception trying to call " + SERVICE_DESTROY_METHOD, e);
-        } catch (IllegalAccessException e) {
-            log.info("Exception trying to call " + SERVICE_DESTROY_METHOD, e);
-        } catch (InvocationTargetException e) {
-            log.info("Exception trying to call " + SERVICE_DESTROY_METHOD, e);
+
         }
     }
 }

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/DispatchPhase.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/DispatchPhase.java?view=diff&rev=548033&r1=548032&r2=548033
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/DispatchPhase.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/DispatchPhase.java Sun Jun 17 05:11:16 2007
@@ -13,6 +13,7 @@
 import org.apache.axis2.description.AxisOperation;
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.description.AxisServiceGroup;
+import org.apache.axis2.description.WSDL2Constants;
 import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.transport.RequestResponseTransport;
 import org.apache.axis2.transport.TransportListener;
@@ -105,17 +106,22 @@
             msgContext.setAxisService(msgContext.getServiceContext().getAxisService());
         }
 
-        //TODO: The same thing should probably happen for a IN-OUT if addressing is enabled and the replyTo/faultTo are not anonymous 
+        
+        //We do not send the status even though it is In-Only to allow Sandesha to send a ack
+        //https://issues.apache.org/jira/browse/AXIS2-2191. At F2F 2007 summer june, we decided may be 
+        //providing a option might not give us that much. I will keep the code commented so we might want to do this later. 
+//        if (msgContext.getAxisOperation().getMessageExchangePattern()
+//                .equals(WSDL20_2004_Constants.MEP_URI_IN_ONLY)) {
+//            Object requestResponseTransport =
+//                    msgContext.getProperty(RequestResponseTransport.TRANSPORT_CONTROL);
+//            if (requestResponseTransport != null) {
+//                ((RequestResponseTransport) requestResponseTransport)
+//                        .acknowledgeMessage(msgContext);
+//            }
+//        }
+        
         if (msgContext.getAxisOperation().getMessageExchangePattern()
-                .equals(WSDL20_2004_Constants.MEP_URI_IN_ONLY)) {
-            Object requestResponseTransport =
-                    msgContext.getProperty(RequestResponseTransport.TRANSPORT_CONTROL);
-            if (requestResponseTransport != null) {
-                ((RequestResponseTransport) requestResponseTransport)
-                        .acknowledgeMessage(msgContext);
-            }
-        } else if (msgContext.getAxisOperation().getMessageExchangePattern()
-                .equals(WSDL20_2004_Constants.MEP_URI_IN_OUT))
+                .equals(WSDL2Constants.MEP_URI_IN_OUT))
         {   // OR, if 2 way operation but the response is intended to not use the response channel of a 2-way transport
             // then we don't need to keep the transport waiting.
             Object requestResponseTransport =

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/ListenerManager.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/ListenerManager.java?view=diff&rev=548033&r1=548032&r2=548033
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/ListenerManager.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/ListenerManager.java Sun Jun 17 05:11:16 2007
@@ -40,6 +40,10 @@
     private static final Log log = LogFactory.getLog(ListenerManager.class);
 
     public static ConfigurationContext defaultConfigurationContext;
+    public static ListenerManager getDefaultListenerManager() {
+        if (defaultConfigurationContext == null) return null;
+        return defaultConfigurationContext.getListenerManager();
+    }
 
     private ConfigurationContext configctx;
     private HashMap startedTransports = new HashMap();

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/handlers/AbstractHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/handlers/AbstractHandler.java?view=diff&rev=548033&r1=548032&r2=548033
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/handlers/AbstractHandler.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/handlers/AbstractHandler.java Sun Jun 17 05:11:16 2007
@@ -17,7 +17,6 @@
 
 package org.apache.axis2.handlers;
 
-import org.apache.axis2.AxisFault;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.description.HandlerDescription;
 import org.apache.axis2.description.Parameter;
@@ -51,7 +50,6 @@
     /**
      * Method init.
      *
-     * @param handlerdesc
      */
     public void init(HandlerDescription handlerdesc) {
         this.handlerDesc = handlerdesc;
@@ -90,7 +88,7 @@
     /**
      * Method getParameter.
      *
-     * @param name
+     * @param name name of the parameter
      * @return Returns Parameter.
      */
     public Parameter getParameter(String name) {

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/phaseresolver/PhaseHolder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/phaseresolver/PhaseHolder.java?view=diff&rev=548033&r1=548032&r2=548033
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/phaseresolver/PhaseHolder.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/phaseresolver/PhaseHolder.java Sun Jun 17 05:11:16 2007
@@ -24,17 +24,18 @@
 import org.apache.axis2.i18n.Messages;
 
 import java.util.ArrayList;
+import java.util.List;
 
 /**
  * This class hold all the phases found in the services.xml and server.xml
  */
 public class PhaseHolder {
-    private ArrayList phaseList;
+    private List phaseList;
 
     public PhaseHolder() {
     }
 
-    public PhaseHolder(ArrayList phases) {
+    public PhaseHolder(List phases) {
         this.phaseList = phases;
     }
 

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/phaseresolver/PhaseResolver.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/phaseresolver/PhaseResolver.java?view=diff&rev=548033&r1=548032&r2=548033
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/phaseresolver/PhaseResolver.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/phaseresolver/PhaseResolver.java Sun Jun 17 05:11:16 2007
@@ -17,15 +17,14 @@
 
 package org.apache.axis2.phaseresolver;
 
-import org.apache.axis2.description.AxisModule;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.Flow;
-import org.apache.axis2.description.HandlerDescription;
+import org.apache.axis2.description.*;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.engine.Phase;
+import org.apache.axis2.wsdl.WSDLConstants;
 
 import java.util.ArrayList;
 import java.util.Iterator;
+import java.util.List;
 
 /**
  * Class PhaseResolver
@@ -54,144 +53,54 @@
         this.axisConfig = axisconfig;
     }
 
-    public void engageModuleToOperation(AxisOperation axisOperation, AxisModule module)
-            throws PhaseException {
-        Flow flow = null;
-
-        for (int type = IN_FLOW; type < OUT_FAULT_FLOW; type++) {
-            switch (type) {
-                case PhaseMetadata.IN_FLOW : {
-                    ArrayList phases = new ArrayList();
-
-                    if (axisConfig != null) {
-                        Iterator itr_axis_config =
-                                axisConfig.getInFlowPhases().iterator();
-
-                        while (itr_axis_config.hasNext()) {
-                            Object o = itr_axis_config.next();
-
-                            phases.add(o);
-                        }
-                    }
-
-                    Iterator itr_ops = axisOperation.getRemainingPhasesInFlow().iterator();
-
-                    while (itr_ops.hasNext()) {
-                        Object o = itr_ops.next();
-
-                        phases.add(o);
-                    }
-
-                    phaseHolder = new PhaseHolder(phases);
-
-                    break;
-                }
-
-                case PhaseMetadata.OUT_FLOW : {
-                    ArrayList phases = new ArrayList();
-                    Iterator itr_ops = axisOperation.getPhasesOutFlow().iterator();
-
-                    while (itr_ops.hasNext()) {
-                        Object o = itr_ops.next();
-
-                        phases.add(o);
-                    }
-
-                    if (axisConfig != null) {
-                        Iterator itr_axis_config = axisConfig.getOutFlowPhases().iterator();
-
-                        while (itr_axis_config.hasNext()) {
-                            Object o = itr_axis_config.next();
-
-                            phases.add(o);
-                        }
-                    }
-
-                    phaseHolder = new PhaseHolder(phases);
-
-                    break;
-                }
-
-                case PhaseMetadata.FAULT_IN_FLOW : {
-                    ArrayList phases = new ArrayList();
-
-                    if (axisConfig != null) {
-                        Iterator itr_axis_config = axisConfig.getInFaultFlowPhases().iterator();
-
-                        while (itr_axis_config.hasNext()) {
-                            Object o = itr_axis_config.next();
-
-                            phases.add(o);
-                        }
-                    }
-
-                    Iterator itr_ops = axisOperation.getPhasesInFaultFlow().iterator();
-
-                    while (itr_ops.hasNext()) {
-                        Object o = itr_ops.next();
-
-                        phases.add(o);
-                    }
-
-                    phaseHolder = new PhaseHolder(phases);
-
-                    break;
-                }
-
-                case PhaseMetadata.FAULT_OUT_FLOW : {
-                    ArrayList phases = new ArrayList();
-                    Iterator itr_ops = axisOperation.getPhasesOutFaultFlow().iterator();
-                    while (itr_ops.hasNext()) {
-                        Object o = itr_ops.next();
-
-                        phases.add(o);
-                    }
-                    if (axisConfig != null) {
-                        Iterator itr_axis_config = axisConfig.getOutFaultFlowPhases().iterator();
-                        while (itr_axis_config.hasNext()) {
-                            Object o = itr_axis_config.next();
-                            phases.add(o);
-                        }
-                    }
-                    phaseHolder = new PhaseHolder(phases);
-                    break;
-                }
+    private void engageModuleToFlow(Flow flow, List handlerChain) throws PhaseException {
+        phaseHolder = new PhaseHolder(handlerChain);
+        if (flow != null) {
+            for (int j = 0; j < flow.getHandlerCount(); j++) {
+                HandlerDescription metadata = flow.getHandler(j);
+                phaseHolder.addHandler(metadata);
             }
+        }
+    }
 
-            switch (type) {
-                case PhaseMetadata.IN_FLOW : {
-                    flow = module.getInFlow();
-
-                    break;
-                }
-
-                case PhaseMetadata.OUT_FLOW : {
-                    flow = module.getOutFlow();
-
-                    break;
-                }
-
-                case PhaseMetadata.FAULT_IN_FLOW : {
-                    flow = module.getFaultInFlow();
-
-                    break;
-                }
-
-                case PhaseMetadata.FAULT_OUT_FLOW : {
-                    flow = module.getFaultOutFlow();
-
-                    break;
-                }
+    private void engageModuleToOperation(AxisOperation axisOperation,
+                                         AxisModule axisModule,
+                                         int flowType) throws PhaseException {
+        List phases = new ArrayList();
+        Flow flow = null;
+        switch(flowType){
+            case PhaseMetadata.IN_FLOW : {
+                phases.addAll(axisConfig.getInFlowPhases());
+                phases.addAll(axisOperation.getRemainingPhasesInFlow());
+                flow = axisModule.getInFlow();
+                break;
             }
-
-            if (flow != null) {
-                for (int j = 0; j < flow.getHandlerCount(); j++) {
-                    HandlerDescription metadata = flow.getHandler(j);
-
-                    phaseHolder.addHandler(metadata);
-                }
+            case PhaseMetadata.OUT_FLOW : {
+                phases.addAll(axisOperation.getPhasesOutFlow());
+                phases.addAll(axisConfig.getOutFlowPhases());
+                flow = axisModule.getOutFlow();
+                break;
+            }
+            case PhaseMetadata.FAULT_OUT_FLOW : {
+                phases.addAll(axisOperation.getPhasesOutFaultFlow());
+                phases.addAll(axisConfig.getOutFaultFlowPhases());
+                flow = axisModule.getFaultOutFlow();
+                break;
+            }
+            case PhaseMetadata.FAULT_IN_FLOW : {
+                phases.addAll(axisOperation.getPhasesInFaultFlow());
+                phases.addAll(axisConfig.getInFaultFlowPhases());
+                flow = axisModule.getFaultInFlow();
+                break;
             }
         }
+        engageModuleToFlow(flow,phases);
+    }
+    public void engageModuleToOperation(AxisOperation axisOperation, AxisModule module)
+            throws PhaseException {
+        for (int type = IN_FLOW; type < OUT_FAULT_FLOW; type++) {
+            engageModuleToOperation(axisOperation, module, type);
+        }
     }
 
     /**
@@ -295,6 +204,19 @@
                 phase.removeHandler(handler);
                 break;
             }
+        }
+    }
+
+    public void engageModuleToMessage(AxisMessage axisMessage, AxisModule axisModule)
+            throws PhaseException {
+        String direction = axisMessage.getDirection();
+        AxisOperation axisOperation = axisMessage.getAxisOperation();
+        if (WSDLConstants.MESSAGE_LABEL_OUT_VALUE.equalsIgnoreCase(direction)) {
+            engageModuleToOperation(axisOperation, axisModule, PhaseMetadata.OUT_FLOW);
+        } else if (WSDLConstants.MESSAGE_LABEL_IN_VALUE.equalsIgnoreCase(direction)) {
+            engageModuleToOperation(axisOperation, axisModule, PhaseMetadata.IN_FLOW);
+        } else if (WSDLConstants.MESSAGE_LABEL_FAULT_VALUE.equals(direction)) {
+            //TODO : Need to handle fault correctly
         }
     }
 }

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/receivers/AbstractInMessageReceiver.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/receivers/AbstractInMessageReceiver.java?view=diff&rev=548033&r1=548032&r2=548033
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/receivers/AbstractInMessageReceiver.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/receivers/AbstractInMessageReceiver.java Sun Jun 17 05:11:16 2007
@@ -21,18 +21,9 @@
 import org.apache.axis2.context.MessageContext;
 
 /**
- * This is takes care of the IN-OUT sync MEP in the server side
+ * This is takes care of the IN-ONLY MEP on the server side
+ *
+ * TODO: Deprecate this and use AMR directly?
  */
 public abstract class AbstractInMessageReceiver extends AbstractMessageReceiver {
-
-    public abstract void invokeBusinessLogic(MessageContext inMessage) throws AxisFault;
-
-    public final void receive(final MessageContext messageCtx) throws AxisFault {
-        ThreadContextDescriptor tc = setThreadContext(messageCtx);
-        try {
-            invokeBusinessLogic(messageCtx);
-        } finally {
-            restoreThreadContext(tc);
-        }
-    }
 }

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/receivers/AbstractInOutAsyncMessageReceiver.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/receivers/AbstractInOutAsyncMessageReceiver.java?view=diff&rev=548033&r1=548032&r2=548033
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/receivers/AbstractInOutAsyncMessageReceiver.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/receivers/AbstractInOutAsyncMessageReceiver.java Sun Jun 17 05:11:16 2007
@@ -18,6 +18,9 @@
 package org.apache.axis2.receivers;
 
 import org.apache.axis2.AxisFault;
+
+import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.engine.AxisEngine;
 import org.apache.axis2.util.MessageContextBuilder;
@@ -26,58 +29,12 @@
 
 /**
  * This is takes care of the IN-OUT sync MEP in the server side
+ *
+ * @deprecated no longer needed, going away after 1.3
  */
-public abstract class AbstractInOutAsyncMessageReceiver extends AbstractMessageReceiver {
-    private static final Log log = LogFactory.getLog(AbstractInOutAsyncMessageReceiver.class);
-
-    public abstract void invokeBusinessLogic(MessageContext inMessage,
-                                             MessageContext outMessage) throws AxisFault;
-
-    public final void receive(final MessageContext messageCtx) {
-        final ServerCallback callback = new ServerCallback() {
-            public void handleResult(MessageContext result) throws AxisFault {
-                AxisEngine engine =
-                        new AxisEngine(messageCtx.getOperationContext().getServiceContext()
-                                .getConfigurationContext());
-                engine.send(result);
-                result.getTransportOut().getSender().cleanup(result);
-            }
-
-            public void handleFault(AxisFault fault) throws AxisFault {
-                AxisEngine engine =
-                        new AxisEngine(messageCtx.getOperationContext().getServiceContext()
-                                .getConfigurationContext());
-                MessageContext faultContext =
-                        MessageContextBuilder.createFaultMessageContext(messageCtx, fault);
-
-                engine.sendFault(faultContext);
-            }
-        };
-        Runnable theadedTask = new Runnable() {
-            public void run() {
-                try {
-                    MessageContext newmsgCtx =
-                            MessageContextBuilder.createOutMessageContext(messageCtx);
-                    newmsgCtx.getOperationContext().addMessageContext(newmsgCtx);
-                    ThreadContextDescriptor tc = setThreadContext(messageCtx);
-                    try {
-                        invokeBusinessLogic(messageCtx, newmsgCtx);
-                    } finally {
-                        restoreThreadContext(tc);
-                    }
-                    callback.handleResult(newmsgCtx);
-                } catch (AxisFault e) {
-                    try {
-                        callback.handleFault(e);
-                    } catch (AxisFault axisFault) {
-                        log.error(e);
-                    }
-                    log.error(e);
-                }
-            }
-        };
-
-        messageCtx.getEnvelope().build();
-        messageCtx.getConfigurationContext().getThreadPool().execute(theadedTask);
+public abstract class AbstractInOutAsyncMessageReceiver extends AbstractInOutMessageReceiver {
+    public void receive(final MessageContext messageCtx) throws AxisFault {
+        messageCtx.setProperty(DO_ASYNC, Boolean.TRUE);
+        super.receive(messageCtx);
     }
 }

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/receivers/AbstractInOutSyncMessageReceiver.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/receivers/AbstractInOutSyncMessageReceiver.java?view=diff&rev=548033&r1=548032&r2=548033
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/receivers/AbstractInOutSyncMessageReceiver.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/receivers/AbstractInOutSyncMessageReceiver.java Sun Jun 17 05:11:16 2007
@@ -25,26 +25,20 @@
 /**
  * This is the Absract IN-OUT MEP MessageReceiver. The
  * protected abstract methods are only for the sake of breaking down the logic
+ *
+ * @deprecated use AbstractInOutMessageReceiver
  */
 public abstract class AbstractInOutSyncMessageReceiver extends AbstractMessageReceiver {
     public abstract void invokeBusinessLogic(MessageContext inMessage, MessageContext outMessage)
             throws AxisFault;
 
-    public final void receive(MessageContext msgContext) throws AxisFault {
+    public final void invokeBusinessLogic(MessageContext msgContext) throws AxisFault {
         MessageContext outMsgContext = MessageContextBuilder.createOutMessageContext(msgContext);
         outMsgContext.getOperationContext().addMessageContext(outMsgContext);
 
-        ThreadContextDescriptor tc = setThreadContext(msgContext);
-        try {
-            invokeBusinessLogic(msgContext, outMsgContext);
-        } finally {
-            restoreThreadContext(tc);
-        }
+        invokeBusinessLogic(msgContext, outMsgContext);
+        replicateState(msgContext);
 
-        AxisEngine engine =
-                new AxisEngine(
-                        msgContext.getConfigurationContext());
-
-        engine.send(outMsgContext);
+        AxisEngine.send(outMsgContext);
     }
 }

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/receivers/AbstractMessageReceiver.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/receivers/AbstractMessageReceiver.java?view=diff&rev=548033&r1=548032&r2=548033
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/receivers/AbstractMessageReceiver.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/receivers/AbstractMessageReceiver.java Sun Jun 17 05:11:16 2007
@@ -23,25 +23,35 @@
 import org.apache.axiom.soap.SOAPFactory;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.clustering.context.Replicator;
+import org.apache.axis2.clustering.ClusteringFault;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.context.ServiceContext;
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.description.Parameter;
+import org.apache.axis2.description.InOnlyAxisOperation;
 import org.apache.axis2.engine.DependencyManager;
 import org.apache.axis2.engine.MessageReceiver;
+import org.apache.axis2.engine.AxisEngine;
 import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.util.Loader;
+import org.apache.axis2.util.MessageContextBuilder;
 import org.apache.axis2.classloader.MultiParentClassLoader;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 import java.lang.reflect.Method;
 import java.net.URL;
 
 public abstract class AbstractMessageReceiver implements MessageReceiver {
+    protected static final Log log = LogFactory.getLog(AbstractMessageReceiver.class);
+
     public static final String SCOPE = "scope";
     protected String serviceTCCL = null;
     public static final String SAVED_TCCL = "_SAVED_TCCL_";
     public static final String SAVED_MC = "_SAVED_MC_";
-
+    public static final String DO_ASYNC = "messageReceiver.invokeOnSeparateThread";
 
     // Place to store previous values
     public class ThreadContextDescriptor {
@@ -49,6 +59,49 @@
         public MessageContext oldMessageContext;
     }
 
+    protected void replicateState(MessageContext messageContext) throws ClusteringFault {
+        Replicator.replicate(messageContext);
+    }
+
+    /**
+     * Do the actual work of the MessageReceiver.  Must be overridden by concrete subclasses.
+     *
+     * @param messageCtx active MessageContext
+     * @throws AxisFault if a problem occurred
+     */
+    protected abstract void invokeBusinessLogic(MessageContext messageCtx) throws AxisFault;
+
+    /**
+     *
+     * @param messageCtx active MessageContext
+     * @throws AxisFault if a problem occurred
+     */
+    public void receive(final MessageContext messageCtx) throws AxisFault {
+        if (messageCtx.isPropertyTrue(DO_ASYNC)) {
+            EndpointReference replyTo = messageCtx.getReplyTo();
+            if (replyTo != null && !replyTo.hasAnonymousAddress()) {
+                AsyncMessageReceiverWorker worker = new AsyncMessageReceiverWorker(messageCtx);
+                messageCtx.getEnvelope().build();
+                messageCtx.getConfigurationContext().getThreadPool().execute(worker);
+                return;
+            }
+        }
+
+        ThreadContextDescriptor tc = setThreadContext(messageCtx);
+        try {
+            invokeBusinessLogic(messageCtx);
+        } catch (AxisFault fault) {
+            // If we're in-only, eat this.  Otherwise, toss it upwards!
+            if (messageCtx.getAxisOperation() instanceof InOnlyAxisOperation) {
+                log.error(fault);
+            } else {
+                throw fault;
+            }
+        } finally {
+            restoreThreadContext(tc);
+        }
+    }
+
     /**
      * Several pieces of information need to be available to the service
      * implementation class.  For one, the ThreadContextClassLoader needs
@@ -56,26 +109,23 @@
      * access to the MessageContext (getCurrentContext()).  So we toss these
      * things in TLS.
      *
-     * @param msgContext
+     * @param msgContext the current MessageContext
+     * @return a ThreadContextDescriptor containing the old values
      */
-    protected ThreadContextDescriptor
-            setThreadContext(MessageContext msgContext) {
+    protected ThreadContextDescriptor setThreadContext(MessageContext msgContext) {
         ThreadContextDescriptor tc = new ThreadContextDescriptor();
         tc.oldMessageContext = (MessageContext) MessageContext.currentMessageContext.get();
         ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
         tc.oldClassLoader = contextClassLoader;
 
-        AxisService service =
-                msgContext.getAxisService();
-        String serviceTCCL = (String) service.getParameterValue(
-                Constants.SERVICE_TCCL);
+        AxisService service = msgContext.getAxisService();
+        String serviceTCCL = (String) service.getParameterValue(Constants.SERVICE_TCCL);
         if (serviceTCCL != null) {
             serviceTCCL = serviceTCCL.trim().toLowerCase();
 
-
             if (serviceTCCL.equals(Constants.TCCL_COMPOSITE)) {
                 Thread.currentThread().setContextClassLoader(
-                        new MultiParentClassLoader(new URL[]{}, new ClassLoader[]{
+                        new MultiParentClassLoader(new URL[] {}, new ClassLoader[] {
                                 msgContext.getAxisService().getClassLoader(),
                                 contextClassLoader,
                         }));
@@ -95,7 +145,8 @@
     }
 
     /**
-     * Method makeNewServiceObject.
+     * Create a new service object.  Override if you want to customize how
+     * this happens in your own MessageReceiver.
      *
      * @param msgContext
      * @return Returns Object.
@@ -103,8 +154,7 @@
      */
     protected Object makeNewServiceObject(MessageContext msgContext) throws AxisFault {
         try {
-            AxisService service =
-                    msgContext.getAxisService();
+            AxisService service = msgContext.getAxisService();
             ClassLoader classLoader = service.getClassLoader();
 
             // allow alternative definition of makeNewServiceObject
@@ -114,10 +164,9 @@
                 Class serviceObjectMaker = Loader.loadClass(classLoader, ((String)
                         serviceObjectParam.getValue()).trim());
 
-                // Find static getServiceObject() method, call it if there   
-                Method method = serviceObjectMaker.
-                        getMethod("getServiceObject",
-                                  new Class[]{AxisService.class});
+                // Find static getServiceObject() method, call it if there
+                Method method = serviceObjectMaker.getMethod("getServiceObject",
+                                                             new Class[]{AxisService.class});
                 if (method != null) {
                     return method.invoke(serviceObjectMaker.newInstance(), new Object[]{service});
                 }
@@ -151,11 +200,13 @@
     }
 
     /**
-     * Method getTheImplementationObject.
+     * Retrieve the implementation object.  This will either return a cached
+     * object if present in the ServiceContext, or create a new one via
+     * makeNewServiceObject() (and then cache that).
      *
-     * @param msgContext
-     * @return Returns Object.
-     * @throws AxisFault
+     * @param msgContext the active MessageContext
+     * @return the appropriate back-end service object.
+     * @throws AxisFault if there's a problem
      */
     protected Object getTheImplementationObject(MessageContext msgContext) throws AxisFault {
         ServiceContext serviceContext = msgContext.getServiceContext();
@@ -171,6 +222,40 @@
                                                msgContext.getServiceContext());
             serviceContext.setProperty(ServiceContext.SERVICE_OBJECT, serviceimpl);
             return serviceimpl;
+        }
+    }
+
+    public class AsyncMessageReceiverWorker implements Runnable {
+    	private MessageContext messageCtx;
+
+    	public AsyncMessageReceiverWorker(MessageContext messageCtx){
+    		this.messageCtx = messageCtx;
+    	}
+
+        public void run() {
+            try {
+                ThreadContextDescriptor tc = setThreadContext(messageCtx);
+                try {
+                    invokeBusinessLogic(messageCtx);
+                } finally {
+                    restoreThreadContext(tc);
+                }
+            } catch (AxisFault e) {
+                // If we're IN-ONLY, swallow this.  Otherwise, send it.
+                if (messageCtx.getAxisOperation() instanceof InOnlyAxisOperation) {
+                    log.debug(e);
+                } else {
+                    try {
+                        MessageContext faultContext =
+                                MessageContextBuilder.createFaultMessageContext(messageCtx, e);
+
+                        AxisEngine.sendFault(faultContext);
+                    } catch (AxisFault axisFault) {
+                        log.error(e);
+                    }
+                    log.error(e);
+                }
+            }
         }
     }
 }

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/receivers/AbstractRobustInMessageReceiver.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/receivers/AbstractRobustInMessageReceiver.java?view=diff&rev=548033&r1=548032&r2=548033
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/receivers/AbstractRobustInMessageReceiver.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/receivers/AbstractRobustInMessageReceiver.java Sun Jun 17 05:11:16 2007
@@ -22,17 +22,8 @@
 
 /**
  * This is takes care of the IN-OUT sync MEP in the server side
+ *
+ * @deprecated not needed, since in-only MessageReceivers can throw faults
  */
 public abstract class AbstractRobustInMessageReceiver extends AbstractMessageReceiver {
-
-    public abstract void invokeBusinessLogic(MessageContext inMessage) throws AxisFault;
-
-    public final void receive(final MessageContext messageCtx) throws AxisFault {
-        ThreadContextDescriptor tc = setThreadContext(messageCtx);
-        try {
-            invokeBusinessLogic(messageCtx);
-        } finally {
-            restoreThreadContext(tc);
-        }
-    }
 }

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/receivers/RawXMLINOnlyMessageReceiver.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/receivers/RawXMLINOnlyMessageReceiver.java?view=diff&rev=548033&r1=548032&r2=548033
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/receivers/RawXMLINOnlyMessageReceiver.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/receivers/RawXMLINOnlyMessageReceiver.java Sun Jun 17 05:11:16 2007
@@ -41,31 +41,36 @@
         implements MessageReceiver {
 
     private Method findOperation(AxisOperation op, Class implClass) {
-        String methodName = op.getName().getLocalPart();
-        Method[] methods = implClass.getMethods();
+        Method method = (Method)(op.getParameterValue("myMethod"));
+        if (method != null) return method;
 
-        for (int i = 0; i < methods.length; i++) {
-            if (methods[i].getName().equals(methodName) &&
-                    methods[i].getParameterTypes().length == 1 &&
-                    OMElement.class.getName().equals(
-                            methods[i].getParameterTypes()[0].getName()) &&
-                    "void".equals(methods[i].getReturnType().getName())) {
-                return methods[i];
+        String methodName = op.getName().getLocalPart();
+        try {
+            // Looking for a method of the form "void method(OMElement)"
+            method = implClass.getMethod(methodName, new Class [] { OMElement.class });
+            if (method.getReturnType().equals(void.class)) {
+                try {
+                    op.addParameter("myMethod", method);
+                } catch (AxisFault axisFault) {
+                    // Do nothing here
+                }
+                return method;
             }
+        } catch (NoSuchMethodException e) {
+            // Fall through
         }
 
         return null;
     }
 
     /**
-     * Invokes the bussiness logic invocation on the service implementation class
+     * Invokes the business logic invocation on the service implementation class
      *
      * @param msgContext the incoming message context
      * @throws AxisFault on invalid method (wrong signature)
      */
     public void invokeBusinessLogic(MessageContext msgContext) throws AxisFault {
         try {
-
             // get the implementation class for the Web Service
             Object obj = getTheImplementationObject(msgContext);
 
@@ -75,12 +80,12 @@
             AxisOperation op = msgContext.getAxisOperation();
             Method method = findOperation(op, implClass);
 
-            if (method != null) {
-                method.invoke(
-                        obj, new Object[]{msgContext.getEnvelope().getBody().getFirstElement()});
-            } else {
+            if (method == null) {
                 throw new AxisFault(Messages.getMessage("methodDoesNotExistInOnly"));
             }
+
+            method.invoke(obj,
+                          new Object [] { msgContext.getEnvelope().getBody().getFirstElement() });
 
         } catch (Exception e) {
             throw AxisFault.makeFault(e);

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/receivers/RawXMLINOutAsyncMessageReceiver.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/receivers/RawXMLINOutAsyncMessageReceiver.java?view=diff&rev=548033&r1=548032&r2=548033
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/receivers/RawXMLINOutAsyncMessageReceiver.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/receivers/RawXMLINOutAsyncMessageReceiver.java Sun Jun 17 05:11:16 2007
@@ -37,63 +37,11 @@
  *
  * @see RawXMLINOnlyMessageReceiver
  * @see RawXMLINOutMessageReceiver
+ * @deprecated use RawXMLINOutMessageReceiver and the DO_ASYNC property instead....
  */
-public class RawXMLINOutAsyncMessageReceiver extends AbstractInOutAsyncMessageReceiver {
-
-    private Method findOperation(AxisOperation op, Class implClass) {
-        String methodName = op.getName().getLocalPart();
-        Method[] methods = implClass.getMethods();
-
-        for (int i = 0; i < methods.length; i++) {
-            if (methods[i].getName().equals(methodName) &&
-                    methods[i].getParameterTypes().length == 1 &&
-                    OMElement.class.getName().equals(
-                            methods[i].getParameterTypes()[0].getName()) &&
-                    OMElement.class.getName().equals(methods[i].getReturnType().getName())) {
-                return methods[i];
-            }
-        }
-
-        return null;
-    }
-
-    /**
-     * Invokes the bussiness logic invocation on the service implementation class
-     *
-     * @param msgContext    the incoming message context
-     * @param newmsgContext the response message context
-     * @throws AxisFault on invalid method (wrong signature) or behaviour (return null)
-     */
-    public void invokeBusinessLogic(MessageContext msgContext, MessageContext newmsgContext)
-            throws AxisFault {
-        try {
-
-            // get the implementation class for the Web Service
-            Object obj = getTheImplementationObject(msgContext);
-
-            // find the WebService method
-            Class implClass = obj.getClass();
-
-            AxisOperation opDesc = msgContext.getAxisOperation();
-            Method method = findOperation(opDesc, implClass);
-
-            if (method != null) {
-                OMElement result = (OMElement) method.invoke(
-                        obj, new Object[]{msgContext.getEnvelope().getBody().getFirstElement()});
-                SOAPFactory fac = getSOAPFactory(msgContext);
-                SOAPEnvelope envelope = fac.getDefaultEnvelope();
-
-                if (result != null) {
-                    envelope.getBody().addChild(result);
-                }
-
-                newmsgContext.setEnvelope(envelope);
-
-            } else {
-                throw new AxisFault(Messages.getMessage("methodDoesNotExistInOut"));
-            }
-        } catch (Exception e) {
-            throw AxisFault.makeFault(e);
-        }
+public class RawXMLINOutAsyncMessageReceiver extends RawXMLINOutMessageReceiver {
+    public void receive(final MessageContext messageCtx) throws AxisFault {
+        messageCtx.setProperty(DO_ASYNC, Boolean.TRUE);
+        super.receive(messageCtx);
     }
 }

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/receivers/RawXMLINOutMessageReceiver.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/receivers/RawXMLINOutMessageReceiver.java?view=diff&rev=548033&r1=548032&r2=548033
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/receivers/RawXMLINOutMessageReceiver.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/receivers/RawXMLINOutMessageReceiver.java Sun Jun 17 05:11:16 2007
@@ -43,17 +43,24 @@
         implements MessageReceiver {
 
     private Method findOperation(AxisOperation op, Class implClass) {
+        Method method = (Method)(op.getParameterValue("myMethod"));
+        if (method != null) return method;
+
         String methodName = op.getName().getLocalPart();
-        Method[] methods = implClass.getMethods();
 
-        for (int i = 0; i < methods.length; i++) {
-            if (methods[i].getName().equals(methodName) &&
-                    methods[i].getParameterTypes().length == 1 &&
-                    OMElement.class.getName().equals(
-                            methods[i].getParameterTypes()[0].getName()) &&
-                    OMElement.class.getName().equals(methods[i].getReturnType().getName())) {
-                return methods[i];
+        try {
+            // Looking for a method of the form "OMElement method(OMElement)"
+            method = implClass.getMethod(methodName, new Class [] { OMElement.class });
+            if (method.getReturnType().equals(OMElement.class)) {
+                try {
+                    op.addParameter("myMethod", method);
+                } catch (AxisFault axisFault) {
+                    // Do nothing here
+                }
+                return method;
             }
+        } catch (NoSuchMethodException e) {
+            // Fault through
         }
 
         return null;
@@ -79,21 +86,21 @@
             AxisOperation opDesc = msgContext.getAxisOperation();
             Method method = findOperation(opDesc, implClass);
 
-            if (method != null) {
-                OMElement result = (OMElement) method.invoke(
-                        obj, new Object[]{msgContext.getEnvelope().getBody().getFirstElement()});
-                SOAPFactory fac = getSOAPFactory(msgContext);
-                SOAPEnvelope envelope = fac.getDefaultEnvelope();
-
-                if (result != null) {
-                    envelope.getBody().addChild(result);
-                }
+            if (method == null) {
+                throw new AxisFault(Messages.getMessage("methodDoesNotExistInOut",
+                                                        opDesc.getName().toString()));
+            }
 
-                newmsgContext.setEnvelope(envelope);
+            OMElement result = (OMElement) method.invoke(
+                    obj, new Object[]{msgContext.getEnvelope().getBody().getFirstElement()});
+            SOAPFactory fac = getSOAPFactory(msgContext);
+            SOAPEnvelope envelope = fac.getDefaultEnvelope();
 
-            } else {
-                throw new AxisFault(Messages.getMessage("methodDoesNotExistInOut"));
+            if (result != null) {
+                envelope.getBody().addChild(result);
             }
+
+            newmsgContext.setEnvelope(envelope);
         } catch (Exception e) {
             throw AxisFault.makeFault(e);
         }

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/SimpleAxis2Server.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/SimpleAxis2Server.java?view=diff&rev=548033&r1=548032&r2=548033
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/SimpleAxis2Server.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/SimpleAxis2Server.java Sun Jun 17 05:11:16 2007
@@ -19,6 +19,7 @@
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.ConfigurationContextFactory;
 import org.apache.axis2.engine.ListenerManager;
+import org.apache.axis2.engine.AxisServer;
 import org.apache.axis2.transport.http.SimpleHTTPServer;
 import org.apache.axis2.util.CommandLineOption;
 import org.apache.axis2.util.CommandLineOptionParser;
@@ -30,7 +31,7 @@
 import java.util.List;
 import java.util.Map;
 
-public class SimpleAxis2Server {
+public class SimpleAxis2Server extends AxisServer {
 
     private static final Log log = LogFactory.getLog(SimpleHTTPServer.class);
 
@@ -39,6 +40,16 @@
     public static int DEFAULT_PORT = 8080;
 
 
+    public SimpleAxis2Server (
+            String repoLocation,
+            String confLocation) throws Exception {
+        super(false);
+        configContext = ConfigurationContextFactory
+                .createConfigurationContextFromFileSystem(repoLocation,
+                        confLocation);
+    }
+
+
     /**
      * @param args
      * @throws Exception
@@ -82,12 +93,8 @@
         }
 
         try {
-            ConfigurationContext configctx = ConfigurationContextFactory
-                    .createConfigurationContextFromFileSystem(repoLocation,
-                                                              confLocation);
-            ListenerManager listenerManager = new ListenerManager();
-            listenerManager.init(configctx);
-            listenerManager.start();
+            SimpleAxis2Server server = new SimpleAxis2Server(repoLocation, confLocation);
+            server.start();
             log.info("[SimpleAxisServer] Started");
         } catch (Throwable t) {
             log.fatal("[SimpleAxisServer] Shutting down. Error starting SimpleAxisServer", t);

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/AbstractAgent.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/AbstractAgent.java?view=diff&rev=548033&r1=548032&r2=548033
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/AbstractAgent.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/AbstractAgent.java Sun Jun 17 05:11:16 2007
@@ -115,6 +115,7 @@
                               HttpServletRequest httpServletRequest,
                               HttpServletResponse httpServletResponse)
             throws IOException, ServletException {
+        httpServletResponse.setContentType("text/html"); 
         httpServletRequest.getRequestDispatcher(Constants.AXIS_WEB_CONTENT_ROOT + jspName)
                 .include(httpServletRequest, httpServletResponse);
 

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/AbstractHTTPSender.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/AbstractHTTPSender.java?view=diff&rev=548033&r1=548032&r2=548033
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/AbstractHTTPSender.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/AbstractHTTPSender.java Sun Jun 17 05:11:16 2007
@@ -21,15 +21,13 @@
 import org.apache.axiom.om.OMOutputFormat;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
-import org.apache.axis2.transport.MessageFormatter;
-import org.apache.axis2.transport.TransportUtils;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.context.OperationContext;
-import org.apache.axis2.description.Parameter;
 import org.apache.axis2.description.TransportOutDescription;
 import org.apache.axis2.i18n.Messages;
+import org.apache.axis2.transport.MessageFormatter;
+import org.apache.axis2.transport.TransportUtils;
 import org.apache.axis2.util.JavaUtils;
-import org.apache.axis2.util.Utils;
 import org.apache.axis2.wsdl.WSDLConstants;
 import org.apache.commons.httpclient.*;
 import org.apache.commons.httpclient.auth.AuthPolicy;
@@ -44,7 +42,6 @@
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.zip.GZIPInputStream;
@@ -93,108 +90,6 @@
     }
 
     /**
-     * Helper method for Proxy and NTLM authentication
-     *
-     * @param client HttpClient in which to place proxy config
-     * @param proxySetting TransportOutDescription
-     * @param config HostConfiguraiton in which to place proxy config
-     * @param msgCtx the active MessageContext
-     * @throws AxisFault in case of problems
-     */
-    protected void configProxyAuthentication(HttpClient client,
-                                             TransportOutDescription proxySetting,
-                                             HostConfiguration config,
-                                             MessageContext msgCtx)
-            throws AxisFault {
-        Parameter proxyParam = proxySetting.getParameter(HTTPConstants.PROXY);
-        String usrName;
-        String domain;
-        String passwd;
-        Credentials proxyCred = null;
-        String proxyHostName = null;
-        int proxyPort = -1;
-
-        if (proxyParam != null) {
-            String value = (String) proxyParam.getValue();
-            String split[] = value.split(":");
-
-            // values being hard coded due best practise
-            usrName = split[0];
-            domain = split[1];
-            passwd = split[2];
-
-            OMElement proxyParamElement = proxyParam.getParameterElement();
-            Iterator ite = proxyParamElement.getAllAttributes();
-
-            while (ite.hasNext()) {
-                OMAttribute att = (OMAttribute) ite.next();
-
-                if (att.getLocalName().equalsIgnoreCase(PROXY_HOST_NAME)) {
-                    proxyHostName = att.getAttributeValue();
-                }
-
-                if (att.getLocalName().equalsIgnoreCase(PROXY_PORT)) {
-                    proxyPort = Integer.parseInt(att.getAttributeValue());
-                }
-            }
-
-            if (domain.length() == 0 || domain.equals(ANONYMOUS)) {
-                if (usrName.equals(ANONYMOUS) && passwd.equals(ANONYMOUS)) {
-                    proxyCred = new UsernamePasswordCredentials("", "");
-                } else {
-                    proxyCred = new UsernamePasswordCredentials(usrName,
-                            passwd);    // proxy
-                }
-            } else {
-                proxyCred = new NTCredentials(usrName, passwd, proxyHostName,
-                        domain);    // NTLM authentication with additionals prams
-            }
-        }
-
-        HttpTransportProperties.ProxyProperties proxyProperties =
-                (HttpTransportProperties.ProxyProperties) msgCtx
-                        .getProperty(HTTPConstants.PROXY);
-
-        if (proxyProperties != null) {
-            if (proxyProperties.getProxyPort() != -1) {
-                proxyPort = proxyProperties.getProxyPort();
-            }
-
-            proxyHostName = proxyProperties.getProxyHostName();
-            if (proxyHostName == null
-                    || proxyHostName.length() == 0) {
-                throw new AxisFault("Proxy Name is not valid");
-            }
-
-            if (proxyProperties.getUserName().equals(ANONYMOUS)
-                    || proxyProperties.getPassWord().equals(ANONYMOUS)) {
-                proxyCred = new UsernamePasswordCredentials("", "");
-            }
-            if (!proxyProperties.getUserName().equals(ANONYMOUS) &&
-                    !proxyProperties.getPassWord().equals(ANONYMOUS)) {
-                proxyCred = new UsernamePasswordCredentials(
-                        proxyProperties.getUserName().trim(),
-                        proxyProperties
-                                .getPassWord().trim()); // Basic Authentication
-            }
-            if (!proxyProperties.getDomain().equals(ANONYMOUS)) {
-                if (!proxyProperties.getUserName().equals(ANONYMOUS) &&
-                        !proxyProperties.getPassWord().equals(ANONYMOUS) &&
-                        !proxyProperties.getDomain().equals(ANONYMOUS)) {
-                    proxyCred = new NTCredentials(
-                            proxyProperties.getUserName().trim(),
-                            proxyProperties.getPassWord().trim(), proxyHostName,
-                            proxyProperties
-                                    .getDomain().trim()); // NTLM Authentication
-                }
-            }
-        }
-
-        client.getState().setProxyCredentials(AuthScope.ANY, proxyCred);
-        config.setProxy(proxyHostName, proxyPort);
-    }
-
-    /**
      * Collect the HTTP header information and set them in the message context
      *
      * @param method HttpMethodBase from which to get information
@@ -314,10 +209,7 @@
      */
     protected HostConfiguration getHostConfiguration(HttpClient client,
                                                      MessageContext msgCtx,
-                                                     URL targetURL)
-            throws AxisFault {
-        boolean isProxyListed = isProxyListed(msgCtx);    // list the proxy
-
+                                                     URL targetURL)throws AxisFault {
 
         boolean isAuthenticationEnabled = isAuthenticationEnabled(msgCtx);
         int port = targetURL.getPort();
@@ -340,7 +232,7 @@
                 (Protocol)msgCtx.getOptions().getProperty(HTTPConstants.CUSTOM_PROTOCOL_HANDLER);
 
         // setting the real host configuration
-        // I assume the 90% case, or even 99% case will be no protocol handler case. 
+        // I assume the 90% case, or even 99% case will be no protocol handler case.
         if (protocolHandler == null) {
             config.setHost(targetURL.getHost(), port, targetURL.getProtocol());
         } else {
@@ -348,12 +240,15 @@
         }
 
         if (isAuthenticationEnabled) {
-            // Basic, Digest, NTLM and custom authentications. 
+            // Basic, Digest, NTLM and custom authentications.
             this.setAuthenticationInfo(client, msgCtx, config);
         }
         // proxy configuration
-        if (isProxyListed) {
-            this.configProxyAuthentication(client, proxyOutSetting, config, msgCtx);
+
+        if (ProxyConfiguration.isProxyEnabled(msgCtx,targetURL)) {
+            log.debug("ProxyConfiguration");
+            ProxyConfiguration proxyConfiguration = new ProxyConfiguration();
+            proxyConfiguration.configure(msgCtx,client,config);
         }
 
         return config;
@@ -536,48 +431,6 @@
                 httpClient.getParams().setSoTimeout((int) timeout);
             }
         }
-    }
-
-    private boolean isProxyListed(MessageContext msgCtx) throws AxisFault {
-        boolean returnValue = false;
-        Parameter par = null;
-
-        proxyOutSetting = msgCtx.getConfigurationContext()
-                .getAxisConfiguration().getTransportOut(Constants.TRANSPORT_HTTP);
-
-        if (proxyOutSetting != null) {
-            par = proxyOutSetting.getParameter(HTTPConstants.PROXY);
-        }
-
-        OMElement hostElement = null;
-
-        if (par != null) {
-            hostElement = par.getParameterElement();
-        }
-
-        if (hostElement != null) {
-            Iterator ite = hostElement.getAllAttributes();
-
-            while (ite.hasNext()) {
-                OMAttribute attribute = (OMAttribute) ite.next();
-
-                if (attribute.getLocalName().equalsIgnoreCase(PROXY_HOST_NAME)) {
-                    returnValue = true;
-                }
-            }
-        }
-
-        HttpTransportProperties.ProxyProperties proxyProperties;
-
-        if ((proxyProperties =
-                (HttpTransportProperties.ProxyProperties) msgCtx.getProperty(
-                        HTTPConstants.PROXY)) != null) {
-            if (proxyProperties.getProxyHostName() != null) {
-                returnValue = true;
-            }
-        }
-
-        return returnValue;
     }
 
     public void setFormat(OMOutputFormat format) {

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java?view=diff&rev=548033&r1=548032&r2=548033
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java Sun Jun 17 05:11:16 2007
@@ -20,16 +20,24 @@
 import edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.impl.builder.StAXBuilder;
-import org.apache.axiom.om.util.UUIDGenerator;
 import org.apache.axiom.soap.SOAP12Constants;
 import org.apache.axiom.soap.SOAPFaultCode;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
 import org.apache.axis2.addressing.AddressingHelper;
 import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.context.*;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.OperationContext;
+import org.apache.axis2.context.SessionContext;
 import org.apache.axis2.deployment.WarBasedAxisConfigurator;
-import org.apache.axis2.description.*;
+import org.apache.axis2.description.AxisBindingMessage;
+import org.apache.axis2.description.AxisBindingOperation;
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.description.TransportInDescription;
+import org.apache.axis2.description.TransportOutDescription;
+import org.apache.axis2.description.WSDL2Constants;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.engine.AxisEngine;
 import org.apache.axis2.engine.Handler.InvocationResponse;
@@ -49,7 +57,11 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.xml.namespace.QName;
-import java.io.*;
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintWriter;
 import java.net.SocketException;
 import java.util.Map;
 
@@ -101,17 +113,17 @@
                 // adding ServletContext into msgContext;
                 InvocationResponse pi = HTTPTransportUtils.
                         processHTTPPostRequest(msgContext,
-                                               new BufferedInputStream(request.getInputStream()),
-                                               new BufferedOutputStream(out),
-                                               contentType,
-                                               request.getHeader(HTTPConstants.HEADER_SOAP_ACTION),
-                                               request.getRequestURL().toString());
+                                new BufferedInputStream(request.getInputStream()),
+                                new BufferedOutputStream(out),
+                                contentType,
+                                request.getHeader(HTTPConstants.HEADER_SOAP_ACTION),
+                                request.getRequestURL().toString());
 
                 Boolean holdResponse =
                         (Boolean) msgContext.getProperty(RequestResponseTransport.HOLD_RESPONSE);
 
                 if (pi.equals(InvocationResponse.SUSPEND) ||
-                    (holdResponse != null && Boolean.TRUE.equals(holdResponse))) {
+                        (holdResponse != null && Boolean.TRUE.equals(holdResponse))) {
                     ((RequestResponseTransport) msgContext
                             .getProperty(RequestResponseTransport.TRANSPORT_CONTROL))
                             .awaitResponse();
@@ -125,7 +137,7 @@
                 }
 
                 response.setContentType("text/xml; charset="
-                                        + msgContext
+                        + msgContext
                         .getProperty(Constants.Configuration.CHARACTER_SET_ENCODING));
 
                 if ((contextWritten == null) || !Constants.VALUE_TRUE.equals(contextWritten)) {
@@ -202,15 +214,15 @@
         // 2. list services requests
         // 3. REST requests.
         if ((query != null) && (query.indexOf("wsdl2") >= 0 ||
-                                query.indexOf("wsdl") >= 0 || query.indexOf("xsd") >= 0 ||
-                                query.indexOf("policy") >= 0)) {
+                query.indexOf("wsdl") >= 0 || query.indexOf("xsd") >= 0 ||
+                query.indexOf("policy") >= 0)) {
             // handling meta data exchange stuff
             agent.processListService(request, response);
         } else if (requestURI.endsWith(".xsd") ||
-                   requestURI.endsWith(".wsdl")) {
+                requestURI.endsWith(".wsdl")) {
             agent.processExplicitSchemaAndWSDL(request, response);
         } else if (requestURI.endsWith(LIST_SERVICES_SUFIX) ||
-                   requestURI.endsWith(LIST_FAUKT_SERVICES_SUFIX)) {
+                requestURI.endsWith(LIST_FAUKT_SERVICES_SUFIX)) {
             // handling list services request
             try {
                 agent.handle(request, response);
@@ -277,7 +289,7 @@
     protected void showRestDisabledErrorMessage(HttpServletResponse response) throws IOException {
         PrintWriter writer = new PrintWriter(response.getOutputStream());
         writer.println("<html><body><h2>Please enable REST support in WEB-INF/conf/axis2.xml " +
-                       "and WEB-INF/web.xml</h2></body></html>");
+                "and WEB-INF/web.xml</h2></body></html>");
         writer.flush();
         response.setStatus(HttpServletResponse.SC_ACCEPTED);
     }
@@ -351,7 +363,6 @@
             throws AxisFault {
         msgContext.setProperty(MessageContext.TRANSPORT_OUT, out);
 
-        AxisEngine engine = new AxisEngine(configContext);
         MessageContext faultContext =
                 MessageContextBuilder.createFaultMessageContext(msgContext, e);
         msgContext.setEnvelope(faultContext.getEnvelope());
@@ -363,6 +374,7 @@
 
             //TODO : Check for SOAP 1.2!
             SOAPFaultCode code = faultContext.getEnvelope().getBody().getFault().getCode();
+
             OMElement valueElement = null;
             if (code != null) {
                 valueElement = code.getFirstChildWithName(new QName(
@@ -371,15 +383,15 @@
             }
 
             if (valueElement != null) {
-                if (valueElement.getText().trim().indexOf(SOAP12Constants.FAULT_CODE_SENDER) >
-                    -1 && !msgContext.isDoingREST()) {
+                if (SOAP12Constants.FAULT_CODE_SENDER.equals(valueElement.getTextAsQName().getLocalPart())
+                        && !msgContext.isDoingREST()) {
                     response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
                 }
             }
         }
 
 
-        engine.sendFault(faultContext);
+        AxisEngine.sendFault(faultContext);
     }
 
     /**
@@ -524,7 +536,7 @@
         }
         if (ip == null) {
             try {
-                ip = HttpUtils.getIpAddress();
+                ip = HttpUtils.getIpAddress(axisConfiguration);
                 if (ip == null) {
                     ip = "localhost";
                 }
@@ -533,12 +545,15 @@
             }
         }
 
-
-        EndpointReference endpoint = new EndpointReference("http://" + ip + ":" + port + '/' +
-                                                           configContext
-                                                                   .getServiceContextPath() +
-                                                                                            "/" +
-                                                                                            serviceName);
+        String endpointRefernce = "http://" + ip + ":" + port;
+        if (configContext.getServiceContextPath().startsWith("/")) {
+            endpointRefernce = endpointRefernce +
+                    configContext.getServiceContextPath() + "/" + serviceName;
+        } else {
+            endpointRefernce = endpointRefernce + '/' +
+                    configContext.getServiceContextPath() + "/" + serviceName;
+        }
+        EndpointReference endpoint = new EndpointReference(endpointRefernce);
 
         return new EndpointReference[]{endpoint};
     }
@@ -603,7 +618,7 @@
         msgContext.setFrom(new EndpointReference(request.getRemoteAddr()));
         msgContext.setProperty(MessageContext.REMOTE_ADDR, request.getRemoteAddr());
         msgContext.setProperty(Constants.OUT_TRANSPORT_INFO,
-                               new ServletBasedOutTransportInfo(response));
+                new ServletBasedOutTransportInfo(response));
         // set the transport Headers
         msgContext.setProperty(MessageContext.TRANSPORT_HEADERS, getTransportHeaders(request));
         msgContext.setProperty(HTTPConstants.MC_HTTP_SERVLETREQUEST, request);
@@ -611,7 +626,7 @@
 
         //setting the RequestResponseTransport object
         msgContext.setProperty(RequestResponseTransport.TRANSPORT_CONTROL,
-                               new ServletRequestResponseTransport(response));
+                new ServletRequestResponseTransport(response));
 
         return msgContext;
     }
@@ -647,7 +662,7 @@
             sessionContext = new SessionContext(null);
             sessionContext.setCookieID(sessionId);
             req.getSession().setAttribute(Constants.SESSION_CONTEXT_PROPERTY,
-                                          sessionContext);
+                    sessionContext);
         }
         messageContext.setSessionContext(sessionContext);
         messageContext.setProperty(SESSION_ID, sessionId);
@@ -667,7 +682,7 @@
         public void acknowledgeMessage(MessageContext msgContext) throws AxisFault {
             log.debug("Acking one-way request");
             response.setContentType("text/xml; charset="
-                                    + msgContext
+                    + msgContext
                     .getProperty(Constants.Configuration.CHARACTER_SET_ENCODING));
 
             response.setStatus(HttpServletResponse.SC_ACCEPTED);
@@ -715,7 +730,7 @@
             if (stateInt == HttpServletResponse.SC_UNAUTHORIZED) { // Unauthorized
                 String realm = (String) messageContext.getProperty(Constants.HTTP_BASIC_AUTH_REALM);
                 response.addHeader("WWW-Authenticate",
-                                   "basic realm=\"" + realm + "\"");
+                        "basic realm=\"" + realm + "\"");
             }
         }
     }
@@ -736,13 +751,13 @@
             this.response = response;
             messageContext = createMessageContext(this.request, this.response, false);
             messageContext.setProperty(org.apache.axis2.transport.http.HTTPConstants.HTTP_METHOD,
-                                       httpMethodString);
+                    httpMethodString);
         }
 
         public void processXMLRequest() throws IOException, ServletException {
             try {
                 RESTUtil.processXMLRequest(messageContext, request.getInputStream(),
-                                           response.getOutputStream(), request.getContentType());
+                        response.getOutputStream(), request.getContentType());
                 this.checkResponseWritten();
             } catch (AxisFault axisFault) {
                 processFault(axisFault);
@@ -753,7 +768,7 @@
         public void processURLRequest() throws IOException, ServletException {
             try {
                 RESTUtil.processURLRequest(messageContext, response.getOutputStream(),
-                                           request.getContentType());
+                        request.getContentType());
                 this.checkResponseWritten();
             } catch (AxisFault e) {
                 setResponseState(messageContext, response);

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java?view=diff&rev=548033&r1=548032&r2=548033
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java Sun Jun 17 05:11:16 2007
@@ -209,7 +209,12 @@
                 }
             }
 
-            if (msgContext.getOperationContext() != null) {
+            /**
+             * We should only set the property Constants.RESPONSE_WRITTEN=true only if we are in the
+             * server side. If it is in the client side we may not know whether we have received the response
+             * in an async request/response case.
+             **/
+             if (msgContext.isServerSide()&& msgContext.getOperationContext() != null) {
                 msgContext.getOperationContext().setProperty(Constants.RESPONSE_WRITTEN,
                                                              Constants.VALUE_TRUE);
             }
@@ -226,9 +231,22 @@
         return InvocationResponse.CONTINUE;
     }
 
+    /**
+     * Send a message (which must be a response) via the OutputStream sitting in the
+     * MessageContext TRANSPORT_OUT property.  Since this class is used for both requests and
+     * responses, we split the logic - this method always gets called when we're
+     * writing to the HTTP response stream, and sendUsingCommons() is used for requests.
+     *
+     * @param msgContext the active MessageContext
+     * @param format output formatter for our message
+     * @throws AxisFault if a general problem arises
+     * @throws XMLStreamException if there's a problem writing
+     */
     private void sendUsingOutputStream(MessageContext msgContext,
                                        OMOutputFormat format) throws AxisFault, XMLStreamException {
 
+        
+
         OutputStream out = (OutputStream) msgContext
                 .getProperty(MessageContext.TRANSPORT_OUT);
 
@@ -244,9 +262,9 @@
         if (transportInfo instanceof ServletBasedOutTransportInfo) {
             servletBasedOutTransportInfo =
                     (ServletBasedOutTransportInfo) transportInfo;
-            List customHheaders = (List) msgContext.getProperty(HTTPConstants.HTTP_HEADERS);
-            if (customHheaders != null) {
-                Iterator iter = customHheaders.iterator();
+            List customHeaders = (List) msgContext.getProperty(HTTPConstants.HTTP_HEADERS);
+            if (customHeaders != null) {
+                Iterator iter = customHeaders.iterator();
                 while (iter.hasNext()) {
                     Header header = (Header) iter.next();
                     if (header != null) {

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/HTTPSender.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/HTTPSender.java?view=diff&rev=548033&r1=548032&r2=548033
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/HTTPSender.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/HTTPSender.java Sun Jun 17 05:11:16 2007
@@ -281,6 +281,14 @@
 
                 processResponse(method, msgContext);
             }
+            Object isTransportNonBlocking = msgContext.getProperty(
+                    MessageContext.TRANSPORT_NON_BLOCKING);
+            if (isTransportNonBlocking != null &&
+                    ((Boolean) isTransportNonBlocking).booleanValue()) {
+                throw new AxisFault(Messages.getMessage("transportError",
+                        String.valueOf(method.getStatusCode()),
+                        method.getStatusText()));
+            }
         } else {
             throw new AxisFault(Messages.getMessage("transportError",
                                                     String.valueOf(method.getStatusCode()),

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/HTTPTransportUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/HTTPTransportUtils.java?view=diff&rev=548033&r1=548032&r2=548033
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/HTTPTransportUtils.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/HTTPTransportUtils.java Sun Jun 17 05:11:16 2007
@@ -224,9 +224,7 @@
                             msgContext,
                             handleGZip(msgContext, in), 
                             contentType));
-
-            AxisEngine engine = new AxisEngine(msgContext.getConfigurationContext());
-            return engine.receive(msgContext);
+            return AxisEngine.receive(msgContext);
         } catch (SOAPProcessingException e) {
             throw AxisFault.makeFault(e);
         } catch (AxisFault e) {
@@ -252,7 +250,9 @@
                                                 String contentType) {
         int soapVersion = VERSION_UNKNOWN;
         // remove the starting and trailing " from the SOAP Action
-        if ((soapActionHeader != null) && soapActionHeader.charAt(0) == '\"'
+        if ((soapActionHeader != null) 
+                && soapActionHeader.length() > 0 
+                && soapActionHeader.charAt(0) == '\"'
                 && soapActionHeader.endsWith("\"")) {
             soapActionHeader = soapActionHeader.substring(1, soapActionHeader.length() - 1);
         }

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java?view=diff&rev=548033&r1=548032&r2=548033
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java Sun Jun 17 05:11:16 2007
@@ -287,7 +287,6 @@
             isTwoChannel = operationContext.getProperty(Constants.DIFFERENT_EPR);
         }
 
-
         if ((contextWritten != null) && Constants.VALUE_TRUE.equals(contextWritten)) {
             if ((isTwoChannel != null) && Constants.VALUE_TRUE.equals(isTwoChannel)) {
                 response.setStatus(HttpStatus.SC_ACCEPTED);

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/HttpTransportProperties.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/HttpTransportProperties.java?view=diff&rev=548033&r1=548032&r2=548033
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/HttpTransportProperties.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/HttpTransportProperties.java Sun Jun 17 05:11:16 2007
@@ -60,28 +60,20 @@
 
     public static class ProxyProperties {
         protected int proxyPort = -1;
-        protected String domain;
-        protected String passWord;
-        protected String proxyHostName;
-        protected String userName;
+        protected String domain = null;
+        protected String passWord = null;
+        protected String proxyHostName = null;
+        protected String userName = null;
 
         public ProxyProperties() {
         }
 
         public String getDomain() {
-            if (domain == null || domain.length() == 0) {
-                return "anonymous";
-            } else {
-                return domain;
-            }
+            return domain;
         }
 
         public String getPassWord() {
-            if (passWord == null || passWord.length() == 0) {
-                return "anonymous";
-            } else {
-                return passWord;
-            }
+            return passWord;
         }
 
         public String getProxyHostName() {
@@ -93,11 +85,7 @@
         }
 
         public String getUserName() {
-            if (userName == null || userName.length() == 0) {
-                return "anonymous";
-            } else {
-                return userName;
-            }
+            return userName;
         }
 
         public void setDomain(String domain) {

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/SimpleHTTPServer.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/SimpleHTTPServer.java?view=diff&rev=548033&r1=548032&r2=548033
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/SimpleHTTPServer.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/SimpleHTTPServer.java Sun Jun 17 05:11:16 2007
@@ -251,8 +251,15 @@
         //if host address is present
         if (hostAddress != null) {
             if (embedded != null) {
-                return new EndpointReference[]{new EndpointReference(hostAddress + "/" +
-                                                                     configurationContext.getServiceContextPath() + "/" + serviceName)};
+                String endpointRefernce = hostAddress ;
+                if(configurationContext.getServiceContextPath().startsWith("/")){
+                    endpointRefernce =  endpointRefernce +
+                            configurationContext.getServiceContextPath() + "/" + serviceName;
+                } else {
+                    endpointRefernce = endpointRefernce + '/' +
+                            configurationContext.getServiceContextPath() + "/" + serviceName;
+                }
+                return new EndpointReference[]{new EndpointReference(endpointRefernce)};
             } else {
                 throw new AxisFault("Unable to generate EPR for the transport : http");
             }
@@ -264,7 +271,7 @@
         } else {
             try {
                 if(localAddress==null){
-                    localAddress = HttpUtils.getIpAddress();
+                    localAddress = HttpUtils.getIpAddress(configurationContext.getAxisConfiguration());
                 }
                 if (localAddress == null) {
                    ipAddress = "127.0.0.1";
@@ -276,9 +283,17 @@
             }
         }
         if (embedded != null) {
-            return new EndpointReference[]{new EndpointReference("http://" + ipAddress + ":" +
-                                                                 (embedded.getPort())
-                                                                 + "/" + configurationContext.getServiceContextPath() + "/" + serviceName)};
+            String endpointRefernce = "http://" + ipAddress + ":" + embedded.getPort() ;
+            if(configurationContext.getServiceContextPath().startsWith("/")){
+                endpointRefernce =  endpointRefernce +
+                        configurationContext.getServiceContextPath() + "/" + serviceName;
+            } else {
+                endpointRefernce = endpointRefernce + '/' +
+                        configurationContext.getServiceContextPath() + "/" + serviceName;
+            }
+
+
+            return new EndpointReference[]{new EndpointReference(endpointRefernce)};
         } else {
             throw new AxisFault("Unable to generate EPR for the transport : http");
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org