axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hemap...@apache.org
Subject svn commit: r219929 - in /webservices/axis/trunk/java/modules/core: src/org/apache/axis2/ src/org/apache/axis2/description/ src/org/apache/axis2/engine/ src/org/apache/axis2/receivers/ src/org/apache/axis2/transport/http/ src/org/apache/axis2/transport...
Date Wed, 20 Jul 2005 15:51:51 GMT
Author: hemapani
Date: Wed Jul 20 08:51:50 2005
New Revision: 219929

URL: http://svn.apache.org/viewcvs?rev=219929&view=rev
Log:
updates to the fault handling, add some comments and improve http request prcessing code

Added:
    webservices/axis/trunk/java/modules/core/src/org/apache/axis2/engine/DispatchingChecker.java
      - copied, changed from r219833, webservices/axis/trunk/java/modules/core/src/org/apache/axis2/engine/DispatchPostConditionsEvaluator.java
Removed:
    webservices/axis/trunk/java/modules/core/src/org/apache/axis2/engine/DispatchPostConditionsEvaluator.java
Modified:
    webservices/axis/trunk/java/modules/core/src/org/apache/axis2/Constants.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis2/description/OperationDescription.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfigurationImpl.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractInOutAsyncMessageReceiver.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractRobustInMessageReceiver.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/AxisServlet.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportUtils.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPWorker.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/local/LocalTransportReceiver.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/MailWorker.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/server/MailSorter.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/tcp/TCPWorker.java
    webservices/axis/trunk/java/modules/core/test/org/apache/axis2/engine/EnginePausingTest.java

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/Constants.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/Constants.java?rev=219929&r1=219928&r2=219929&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/Constants.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/Constants.java Wed Jul 20 08:51:50 2005
@@ -180,7 +180,7 @@
 
 
     public static final String TESTING_PATH = "target/test-resources/";
-    //public static final String TESTING_PATH = "modules/samples/target/test-resources/";
+   // public static final String TESTING_PATH = "modules/samples/target/test-resources/";
 
     public static final String TESTING_REPOSITORY = TESTING_PATH + "samples";
 

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/description/OperationDescription.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/description/OperationDescription.java?rev=219929&r1=219928&r2=219929&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/description/OperationDescription.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/description/OperationDescription.java Wed Jul 20 08:51:50 2005
@@ -8,6 +8,7 @@
 import org.apache.axis2.engine.AxisError;
 import org.apache.axis2.engine.AxisFault;
 import org.apache.axis2.engine.MessageReceiver;
+import org.apache.axis2.engine.MustUnderstandChecker;
 import org.apache.axis2.engine.Phase;
 import org.apache.axis2.phaseresolver.PhaseMetadata;
 import org.apache.axis2.phaseresolver.PhaseResolver;
@@ -46,6 +47,9 @@
         remainingPhasesInFlow = new ArrayList();
         remainingPhasesInFlow.add(
                 new Phase(PhaseMetadata.PHASE_POLICY_DETERMINATION));
+        Phase messageProcessing = new Phase(PhaseMetadata.PHASE_MESSAGE_PROCESSING);
+        messageProcessing.addHandler(new MustUnderstandChecker());  
+        remainingPhasesInFlow.add(messageProcessing);              
 
         phasesOutFlow = new ArrayList();
         phasesOutFlow.add(new Phase(PhaseMetadata.PHASE_POLICY_DETERMINATION));

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfigurationImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfigurationImpl.java?rev=219929&r1=219928&r2=219929&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfigurationImpl.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfigurationImpl.java Wed Jul 20 08:51:50 2005
@@ -122,7 +122,7 @@
         inPhasesUptoAndIncludingPostDispatch.add(dispatch);
 
         Phase postDispatch = new Phase(PhaseMetadata.PHASE_POST_DISPATCH);
-        postDispatch.addHandler(new DispatchPostConditionsEvaluator());
+        postDispatch.addHandler(new DispatchingChecker());
         inPhasesUptoAndIncludingPostDispatch.add(postDispatch);
     }
 

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java?rev=219929&r1=219928&r2=219929&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java Wed Jul 20 08:51:50 2005
@@ -15,6 +15,8 @@
  */
 package org.apache.axis2.engine;
 
+import java.util.ArrayList;
+
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.context.OperationContext;
@@ -27,14 +29,11 @@
 import org.apache.axis2.soap.SOAPFaultCode;
 import org.apache.axis2.soap.SOAPFaultDetail;
 import org.apache.axis2.soap.SOAPFaultReason;
-import org.apache.axis2.soap.impl.llom.SOAPProcessingException;
 import org.apache.axis2.soap.impl.llom.soap12.SOAP12Constants;
 import org.apache.axis2.transport.TransportSender;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import java.util.ArrayList;
-
 /**
  * There is one engine for the Server and the Client. the send() and receive()
  * Methods are the basic operations the Sync, Async messageing are build on top.
@@ -67,24 +66,22 @@
      * @see Handler
      */
     public void send(MessageContext msgContext) throws AxisFault {
-        try {
-            verifyContextBuilt(msgContext);
-            OperationContext operationContext = msgContext.getOperationContext();
-
-            ArrayList phases = operationContext.getAxisOperation()
-                    .getPhasesOutFlow();
-            if (msgContext.isPaused()) {
-                resumeInvocationPhases(phases, msgContext);
-            } else {
-                invokePhases(phases, msgContext);
-            }
-
+        verifyContextBuilt(msgContext);
+        
+        //find and invoke the Phases        
+        OperationContext operationContext = msgContext.getOperationContext();
+        ArrayList phases = operationContext.getAxisOperation().getPhasesOutFlow();
+        if (msgContext.isPaused()) {
+            resumeInvocationPhases(phases, msgContext);
+        } else {
+            invokePhases(phases, msgContext);
+        }
+        
+        if (!msgContext.isPaused()) {
+            //write the Message to the Wire
             TransportOutDescription transportOut = msgContext.getTransportOut();
-
             TransportSender sender = transportOut.getSender();
             sender.invoke(msgContext);
-        } catch (Throwable e) {
-            handleFault(msgContext, e);
         }
     }
 
@@ -101,37 +98,96 @@
      * @see Handler
      */
     public void receive(MessageContext msgContext) throws AxisFault {
-        boolean paused = msgContext.isPaused();
-        try {
-            ConfigurationContext sysCtx = msgContext.getSystemContext();
-            ArrayList phases =
-                    sysCtx.getAxisConfiguration()
-                    .getInPhasesUptoAndIncludingPostDispatch();
+        ConfigurationContext sysCtx = msgContext.getSystemContext();
+        OperationDescription operationDescription = null;
+        ArrayList preCalculatedPhases = sysCtx.getAxisConfiguration().getInPhasesUptoAndIncludingPostDispatch();
+        ArrayList operationSpecificPhases = null;
+        
+        if (msgContext.isPaused()) {
+            resumeInvocationPhases(preCalculatedPhases, msgContext);
+
+            verifyContextBuilt(msgContext);
+            OperationContext operationContext = msgContext.getOperationContext();
+            operationDescription = operationContext.getAxisOperation();
+            operationSpecificPhases = operationDescription.getRemainingPhasesInFlow();
+            
+            resumeInvocationPhases(operationSpecificPhases, msgContext);
+            
+        } else {
+            invokePhases(preCalculatedPhases, msgContext);
+            verifyContextBuilt(msgContext);
+            OperationContext operationContext = msgContext.getOperationContext();
+            operationDescription = operationContext.getAxisOperation();
+            operationSpecificPhases = operationDescription.getRemainingPhasesInFlow();
+            invokePhases(operationSpecificPhases, msgContext);
+        }
+
+        if (msgContext.isServerSide() && !msgContext.isPaused()) {
+            // invoke the Message Receivers
+            MessageReceiver receiver = operationDescription.getMessageReciever();
+            receiver.recieve(msgContext);
+        }
+    }
 
-            if (paused) {
+    /**
+     * This Method Send the SOAP Fault to a Other SOAP Node
+     * @param msgContext
+     * @throws AxisFault
+     */
+    public void sendFault(MessageContext msgContext) throws AxisFault {
+        OperationContext opContext = msgContext.getOperationContext();
+        //find and execute the Fault Out Flow Handlers
+        if (opContext != null) {
+            OperationDescription axisOperation = opContext.getAxisOperation();
+            ArrayList phases = axisOperation.getPhasesOutFaultFlow();
+            if (msgContext.isPaused()) {
                 resumeInvocationPhases(phases, msgContext);
             } else {
                 invokePhases(phases, msgContext);
             }
-            verifyContextBuilt(msgContext);
+        }
+        //it is possible that Operation Context is Null as the error occered before the 
+        //Dispatcher. We do not run Handlers in that case 
 
-            OperationContext operationContext = msgContext.getOperationContext();
-            OperationDescription operationDescription = operationContext.getAxisOperation();
-            phases = operationDescription.getRemainingPhasesInFlow();
+        if (!msgContext.isPaused()) {
+            //Actually send the SOAP Fault
+            TransportSender sender = msgContext.getTransportOut().getSender();
+            sender.invoke(msgContext);
+        }
+    }
 
-            if (paused) {
+    /**
+     * This is invoked when a SOAP Fault is received from a Other SOAP Node
+     * @param msgContext
+     * @throws AxisFault
+     */
+    public void receiveFault(MessageContext msgContext) throws AxisFault {
+
+        OperationContext opContext = msgContext.getOperationContext();
+        if (opContext == null) {
+            //If we do not have a OperationContext that means this may be a incoming 
+            //Dual Channel response. So try to dispatch the Service 
+            ConfigurationContext sysCtx = msgContext.getSystemContext();
+            ArrayList phases =
+                sysCtx.getAxisConfiguration().getInPhasesUptoAndIncludingPostDispatch();
+
+            if (msgContext.isPaused()) {
                 resumeInvocationPhases(phases, msgContext);
             } else {
                 invokePhases(phases, msgContext);
             }
-            paused = msgContext.isPaused();
-            if (msgContext.isServerSide() && !paused) {
-                // add invoke Phase
-                MessageReceiver receiver = operationDescription.getMessageReciever();
-                receiver.recieve(msgContext);
+            verifyContextBuilt(msgContext);
+        }
+        opContext = msgContext.getOperationContext();
+        //find and execute the Fault In Flow Handlers
+        if (opContext != null) {
+            OperationDescription axisOperation = opContext.getAxisOperation();
+            ArrayList phases = axisOperation.getPhasesInFaultFlow();
+            if (msgContext.isPaused()) {
+                resumeInvocationPhases(phases, msgContext);
+            } else {
+                invokePhases(phases, msgContext);
             }
-        } catch (Throwable e) {
-            handleFault(msgContext, e);
         }
     }
 
@@ -144,112 +200,84 @@
      * @param e
      * @throws AxisFault
      */
-    public void handleFault(MessageContext context, Throwable e) throws AxisFault {
-        boolean serverSide = context.isServerSide();
-        log.error("Error Ocurred", e);
-        if (serverSide && !context.isProcessingFault()) {
-            context.setProcessingFault(true);
-
-            // create a SOAP envelope with the Fault
-            MessageContext faultContext =
-                    new MessageContext(engineContext,
-                                       context.getSessionContext(),
-                                       context.getTransportIn(),
-                                       context.getTransportOut());
-
-            if (context.getFaultTo() != null) {
-                faultContext.setFaultTo(context.getFaultTo());
+    public MessageContext createFaultMessageContext(MessageContext processingContext, Throwable e)
+        throws AxisFault {
+        if (processingContext.isProcessingFault()) {
+            //We get the error file processing the fault. nothing we can do
+            throw new AxisFault(
+                "Error occured while processing Fault, Previous error is given in the stack trace",
+                e);
+        }
+
+        MessageContext faultContext =
+            new MessageContext(
+                engineContext,
+                processingContext.getSessionContext(),
+                processingContext.getTransportIn(),
+                processingContext.getTransportOut());
+
+        faultContext.setProcessingFault(true);
+        if (processingContext.getFaultTo() != null) {
+            faultContext.setFaultTo(processingContext.getFaultTo());
+        } else {
+            Object writer = processingContext.getProperty(MessageContext.TRANSPORT_OUT);
+            if (writer != null) {
+                faultContext.setProperty(MessageContext.TRANSPORT_OUT, writer);
             } else {
-                Object writer = context.getProperty(
-                        MessageContext.TRANSPORT_OUT);
-                if (writer != null) {
-                    faultContext.setProperty(MessageContext.TRANSPORT_OUT,
-                                             writer);
-                } else {
-                    //TODO Opps there are no place to send this, we will log and should we throw the exception? 
-                    log.error("Error in fault flow", e);
-                    e.printStackTrace();
-                }
-            }
-
-            faultContext.setOperationContext(context.getOperationContext());
-            faultContext.setProcessingFault(true);
-            faultContext.setServerSide(true);
-            SOAPEnvelope envelope = null;
-
-            try {
-
-                if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(
-                        context.getEnvelope().getNamespace().getName())) {
-                    envelope =
-                            OMAbstractFactory.getSOAP12Factory()
-                            .getDefaultFaultEnvelope();
-                } else {
-                    envelope =
-                            OMAbstractFactory.getSOAP11Factory()
-                            .getDefaultFaultEnvelope();
-                }
-            } catch (SOAPProcessingException e1) {
-                throw new AxisFault(e1);
+                //TODO Opps there are no place to send this, we will log and should we throw the exception? 
+                throw new AxisFault("No where to send the Error, the return response path is missing and FaultTo not specified");
             }
+        }
 
-            // TODO do we need to set old Headers back?
-            SOAPBody body = envelope.getBody();
-            
-//            body.addFault(new AxisFault(e.getMessage(), e));
-            body.getFault().setException(new AxisFault(e.getMessage(), e));
-            extractFaultInformationFromMessageContext(context,
-                                                      envelope.getBody()
-                                                      .getFault());
-
-            faultContext.setEnvelope(envelope);
-
-            OperationContext opContext = context.getOperationContext();
-            if (opContext != null) {
-                OperationDescription axisOperation = opContext.getAxisOperation();
-                ArrayList phases = axisOperation.getPhasesOutFaultFlow();
-                invokePhases(phases, context);
-            }
-            // Write the the error
-            TransportSender sender = context.getTransportOut().getSender();
-            sender.invoke(faultContext);
-        } else if (!serverSide) {
-            // if at the client side throw the exception
-            throw new AxisFault("", e);
+        faultContext.setOperationContext(processingContext.getOperationContext());
+        faultContext.setProcessingFault(true);
+        faultContext.setServerSide(true);
+        SOAPEnvelope envelope = null;
+
+        if (SOAP12Constants
+            .SOAP_ENVELOPE_NAMESPACE_URI
+            .equals(processingContext.getEnvelope().getNamespace().getName())) {
+            envelope = OMAbstractFactory.getSOAP12Factory().getDefaultFaultEnvelope();
         } else {
-            // TODO log and exit
-            log.error("Error in fault flow", e);
+            envelope = OMAbstractFactory.getSOAP11Factory().getDefaultFaultEnvelope();
         }
+
+        // TODO do we need to set old Headers back?
+        SOAPBody body = envelope.getBody();
+
+        //            body.addFault(new AxisFault(e.getMessage(), e));
+        body.getFault().setException(new AxisFault(e));
+        extractFaultInformationFromMessageContext(processingContext, envelope.getBody().getFault());
+
+        faultContext.setEnvelope(envelope);
+        sendFault(faultContext);
+        return faultContext;
     }
 
     private void extractFaultInformationFromMessageContext(
-            MessageContext context, SOAPFault fault) {
-        Object faultCode = context.getProperty(
-                SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME);
+        MessageContext context,
+        SOAPFault fault) {
+        Object faultCode = context.getProperty(SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME);
         if (faultCode != null) {
             fault.setCode((SOAPFaultCode) faultCode);
         }
 
-        Object faultReason = context.getProperty(
-                SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME);
+        Object faultReason = context.getProperty(SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME);
         if (faultReason != null) {
             fault.setReason((SOAPFaultReason) faultReason);
         }
 
-        Object faultRole = context.getProperty(
-                SOAP12Constants.SOAP_FAULT_ROLE_LOCAL_NAME);
+        Object faultRole = context.getProperty(SOAP12Constants.SOAP_FAULT_ROLE_LOCAL_NAME);
         if (faultRole != null) {
             fault.getRole().setText((String) faultRole);
         }
 
-        Object faultNode = context.getProperty(
-                SOAP12Constants.SOAP_FAULT_NODE_LOCAL_NAME);
+        Object faultNode = context.getProperty(SOAP12Constants.SOAP_FAULT_NODE_LOCAL_NAME);
         if (faultNode != null) {
             fault.getNode().setText((String) faultNode);
         }
 
-        Object faultDetail = context.getProperty(
-                SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME);
+        Object faultDetail = context.getProperty(SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME);
         if (faultDetail != null) {
             fault.setDetail((SOAPFaultDetail) faultDetail);
         }
@@ -269,14 +297,13 @@
 
     private void invokePhases(ArrayList phases, MessageContext msgctx) throws AxisFault {
         int count = phases.size();
-        for (int i = 0; (i < count && !msgctx.isPaused()); i++) {
+        for (int i = 0;(i < count && !msgctx.isPaused()); i++) {
             Phase phase = (Phase) phases.get(i);
             phase.invoke(msgctx);
         }
     }
 
-    public void resumeInvocationPhases(ArrayList phases,
-                                       MessageContext msgctx) throws AxisFault {
+    public void resumeInvocationPhases(ArrayList phases, MessageContext msgctx) throws AxisFault {
         msgctx.setPausedFalse();
         int count = phases.size();
         boolean foundMatch = false;
@@ -285,8 +312,7 @@
             Phase phase = (Phase) phases.get(i);
             if (phase.getPhaseName().equals(msgctx.getPausedPhaseName())) {
                 foundMatch = true;
-                phase.invokeStartFromHandler(msgctx.getPausedHandlerName(),
-                                             msgctx);
+                phase.invokeStartFromHandler(msgctx.getPausedHandlerName(), msgctx);
             } else {
                 if (foundMatch) {
                     phase.invoke(msgctx);

Copied: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/engine/DispatchingChecker.java (from r219833, webservices/axis/trunk/java/modules/core/src/org/apache/axis2/engine/DispatchPostConditionsEvaluator.java)
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/engine/DispatchingChecker.java?p2=webservices/axis/trunk/java/modules/core/src/org/apache/axis2/engine/DispatchingChecker.java&p1=webservices/axis/trunk/java/modules/core/src/org/apache/axis2/engine/DispatchPostConditionsEvaluator.java&r1=219833&r2=219929&rev=219929&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/engine/DispatchPostConditionsEvaluator.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/engine/DispatchingChecker.java Wed Jul 20 08:51:50 2005
@@ -26,7 +26,7 @@
 /**
  * Class Dispatcher
  */
-public class DispatchPostConditionsEvaluator extends AbstractHandler implements Handler {
+public class DispatchingChecker extends AbstractHandler implements Handler {
     /**
      * Field NAME
      */
@@ -39,7 +39,7 @@
      */
     private ConfigurationContext engineContext;
 
-    public DispatchPostConditionsEvaluator() {
+    public DispatchingChecker() {
         init(new HandlerDescription(NAME));
     }
 

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractInOutAsyncMessageReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractInOutAsyncMessageReceiver.java?rev=219929&r1=219928&r2=219929&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractInOutAsyncMessageReceiver.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractInOutAsyncMessageReceiver.java Wed Jul 20 08:51:50 2005
@@ -24,30 +24,26 @@
 /**
  * This is takes care of the IN-OUT sync MEP in the server side
  */
-public abstract class AbstractInOutAsyncMessageReceiver
-        extends AbstractMessageReceiver {
+public abstract class AbstractInOutAsyncMessageReceiver extends AbstractMessageReceiver {
     protected Log log = LogFactory.getLog(getClass());
 
-    public abstract void invokeBusinessLogic(MessageContext inMessage,
-                                             ServerCallback callback)
-            throws AxisFault;
+    public abstract void invokeBusinessLogic(MessageContext inMessage, ServerCallback callback)
+        throws AxisFault;
 
     public final void recieve(final MessageContext messgeCtx) throws AxisFault {
         final ServerCallback callback = new ServerCallback() {
             public void handleResult(MessageContext result) throws AxisFault {
                 AxisEngine engine =
-                        new AxisEngine(
-                                messgeCtx.getOperationContext()
-                        .getServiceContext()
-                        .getEngineContext());
+                    new AxisEngine(
+                        messgeCtx.getOperationContext().getServiceContext().getEngineContext());
                 engine.send(messgeCtx);
             }
-
             public void handleFault(AxisFault fault) throws AxisFault {
-                AxisEngine engine = new AxisEngine(
-                        messgeCtx.getOperationContext().getServiceContext()
-                        .getEngineContext());
-                engine.handleFault(messgeCtx, fault);
+                AxisEngine engine =
+                    new AxisEngine(
+                        messgeCtx.getOperationContext().getServiceContext().getEngineContext());
+                MessageContext faultContext = engine.createFaultMessageContext(messgeCtx, fault);
+                engine.sendFault(faultContext);
             }
         };
         Runnable theadedTask = new Runnable() {

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractRobustInMessageReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractRobustInMessageReceiver.java?rev=219929&r1=219928&r2=219929&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractRobustInMessageReceiver.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractRobustInMessageReceiver.java Wed Jul 20 08:51:50 2005
@@ -24,8 +24,7 @@
 /**
  * This is takes care of the IN-OUT sync MEP in the server side
  */
-public abstract class AbstractRobustInMessageReceiver
-        extends AbstractMessageReceiver {
+public abstract class AbstractRobustInMessageReceiver extends AbstractMessageReceiver {
     protected Log log = LogFactory.getLog(getClass());
 
     public abstract void invokeBusinessLogic(MessageContext inMessage) throws AxisFault;
@@ -34,10 +33,11 @@
         try {
             invokeBusinessLogic(messgeCtx);
         } catch (AxisFault e) {
-            AxisEngine engine = new AxisEngine(
-                    messgeCtx.getOperationContext().getServiceContext()
-                    .getEngineContext());
-            engine.handleFault(messgeCtx, e);
+            AxisEngine engine =
+                new AxisEngine(
+                    messgeCtx.getOperationContext().getServiceContext().getEngineContext());
+            MessageContext faultContext = engine.createFaultMessageContext(messgeCtx, e);
+            engine.sendFault(faultContext);
         }
     }
 

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/AxisServlet.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/AxisServlet.java?rev=219929&r1=219928&r2=219929&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/AxisServlet.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/AxisServlet.java Wed Jul 20 08:51:50 2005
@@ -40,13 +40,8 @@
  * Class AxisServlet
  */
 public class AxisServlet extends HttpServlet {
-    /**
-     * Field engineRegistry
-     */
-
-    private ConfigurationContext configContext;
-
     private ListingAgent lister;
+    private static final String CONFIGURATION_CONTEXT = "CONFIGURATION_CONTEXT";
 
     /**
      * Method init
@@ -59,11 +54,11 @@
             ServletContext context = config.getServletContext();
             String repoDir = context.getRealPath("/WEB-INF");
             ConfigurationContextFactory erfac = new ConfigurationContextFactory();
-            configContext = erfac.buildConfigurationContext(repoDir);
-            configContext.setProperty(Constants.CONTAINER_MANAGED,
-                    Constants.VALUE_TRUE);
+            ConfigurationContext configContext = erfac.buildConfigurationContext(repoDir);
+            configContext.setProperty(Constants.CONTAINER_MANAGED, Constants.VALUE_TRUE);
             configContext.setRootDir(new File(context.getRealPath("/WEB-INF")));
             lister = new ListingAgent(configContext);
+            context.setAttribute(CONFIGURATION_CONTEXT, configContext);
         } catch (Exception e) {
             throw new ServletException(e);
         }
@@ -77,21 +72,25 @@
      * @throws ServletException
      * @throws IOException
      */
-    protected void doGet(HttpServletRequest httpServletRequest,
-                         HttpServletResponse httpServletResponse)
-            throws ServletException, IOException {
+    protected void doGet(
+        HttpServletRequest httpServletRequest,
+        HttpServletResponse httpServletResponse)
+        throws ServletException, IOException {
+
+        ConfigurationContext configContext =
+            (ConfigurationContext) getServletContext().getAttribute(CONFIGURATION_CONTEXT);
+
         httpServletResponse.setContentType("text/xml; charset=utf-8");
         MessageContext msgContext = null;
         OutputStream out = null;
         try {
             Object sessionContext =
-                    httpServletRequest.getSession().getAttribute(
-                            Constants.SESSION_CONTEXT_PROPERTY);
+                httpServletRequest.getSession().getAttribute(Constants.SESSION_CONTEXT_PROPERTY);
             if (sessionContext == null) {
                 sessionContext = new SessionContext(null);
                 httpServletRequest.getSession().setAttribute(
-                        Constants.SESSION_CONTEXT_PROPERTY,
-                        sessionContext);
+                    Constants.SESSION_CONTEXT_PROPERTY,
+                    sessionContext);
             }
 
             Enumeration enu = httpServletRequest.getParameterNames();
@@ -103,35 +102,40 @@
             }
 
             msgContext =
-                    new MessageContext(configContext,
-                            (SessionContext) sessionContext,
-                            configContext.getAxisConfiguration()
-                    .getTransportIn(new QName(Constants.TRANSPORT_HTTP)),
-                            configContext.getAxisConfiguration()
-                    .getTransportOut(new QName(Constants.TRANSPORT_HTTP)));
+                new MessageContext(
+                    configContext,
+                    (SessionContext) sessionContext,
+                    configContext.getAxisConfiguration().getTransportIn(
+                        new QName(Constants.TRANSPORT_HTTP)),
+                    configContext.getAxisConfiguration().getTransportOut(
+                        new QName(Constants.TRANSPORT_HTTP)));
             msgContext.setDoingREST(true);
             msgContext.setServerSide(true);
-            msgContext.setProperty(HTTPConstants.HTTPOutTransportInfo,
-                    new ServletBasedOutTransportInfo(httpServletResponse));
+            msgContext.setProperty(
+                HTTPConstants.HTTPOutTransportInfo,
+                new ServletBasedOutTransportInfo(httpServletResponse));
             out = httpServletResponse.getOutputStream();
             boolean processed =
-                    HTTPTransportUtils.processHTTPGetRequest(msgContext,
-                            httpServletRequest.getInputStream(),
-                            out,
-                            httpServletRequest.getContentType(),
-                            httpServletRequest.getHeader(
-                                    HTTPConstants.HEADER_SOAP_ACTION),
-                            httpServletRequest.getRequestURL().toString(),
-                            configContext,
-                            map);
+                HTTPTransportUtils.processHTTPGetRequest(
+                    msgContext,
+                    httpServletRequest.getInputStream(),
+                    out,
+                    httpServletRequest.getContentType(),
+                    httpServletRequest.getHeader(HTTPConstants.HEADER_SOAP_ACTION),
+                    httpServletRequest.getRequestURL().toString(),
+                    configContext,
+                    map);
             if (!processed) {
                 lister.handle(httpServletRequest, httpServletResponse, out);
             }
         } catch (Exception e) {
-            AxisEngine engine = new AxisEngine(configContext);
             if (msgContext != null) {
                 msgContext.setProperty(MessageContext.TRANSPORT_OUT, out);
-                engine.handleFault(msgContext, e);
+                AxisEngine engine = new AxisEngine(configContext);
+                MessageContext faultContext = engine.createFaultMessageContext(msgContext, e);
+                engine.sendFault(faultContext);
+            } else {
+                throw new ServletException(e);
             }
         }
 
@@ -151,46 +155,50 @@
      * @throws IOException
      */
     protected void doPost(HttpServletRequest req, HttpServletResponse res)
-            throws ServletException, IOException {
+        throws ServletException, IOException {
         MessageContext msgContext = null;
+        ConfigurationContext configContext =
+            (ConfigurationContext) getServletContext().getAttribute(CONFIGURATION_CONTEXT);
         try {
             Object sessionContext =
-                    req.getSession().getAttribute(
-                            Constants.SESSION_CONTEXT_PROPERTY);
+                req.getSession().getAttribute(Constants.SESSION_CONTEXT_PROPERTY);
             if (sessionContext == null) {
                 sessionContext = new SessionContext(null);
-                req.getSession().setAttribute(
-                        Constants.SESSION_CONTEXT_PROPERTY, sessionContext);
+                req.getSession().setAttribute(Constants.SESSION_CONTEXT_PROPERTY, sessionContext);
             }
             msgContext =
-                    new MessageContext(configContext,
-                            (SessionContext) sessionContext,
-                            configContext.getAxisConfiguration()
-                    .getTransportIn(new QName(Constants.TRANSPORT_HTTP)),
-                            configContext.getAxisConfiguration()
-                    .getTransportOut(new QName(Constants.TRANSPORT_HTTP)));
-            msgContext.setProperty(HTTPConstants.HTTPOutTransportInfo,
-                    new ServletBasedOutTransportInfo(res));
+                new MessageContext(
+                    configContext,
+                    (SessionContext) sessionContext,
+                    configContext.getAxisConfiguration().getTransportIn(
+                        new QName(Constants.TRANSPORT_HTTP)),
+                    configContext.getAxisConfiguration().getTransportOut(
+                        new QName(Constants.TRANSPORT_HTTP)));
+            msgContext.setProperty(
+                HTTPConstants.HTTPOutTransportInfo,
+                new ServletBasedOutTransportInfo(res));
             res.setContentType("text/xml; charset=utf-8");
-            HTTPTransportUtils.processHTTPPostRequest(msgContext,
-                    req.getInputStream(),
-                    res.getOutputStream(),
-                    req.getContentType(),
-                    req.getHeader(HTTPConstants.HEADER_SOAP_ACTION),
-                    req.getRequestURL().toString(),
-                    configContext);
-            Object contextWritten = msgContext.getOperationContext()
-                    .getProperty(Constants.RESPONSE_WRITTEN);
-            if (contextWritten == null ||
-                    !Constants.VALUE_TRUE.equals(contextWritten)) {
+            HTTPTransportUtils.processHTTPPostRequest(
+                msgContext,
+                req.getInputStream(),
+                res.getOutputStream(),
+                req.getContentType(),
+                req.getHeader(HTTPConstants.HEADER_SOAP_ACTION),
+                req.getRequestURL().toString(),
+                configContext);
+            Object contextWritten =
+                msgContext.getOperationContext().getProperty(Constants.RESPONSE_WRITTEN);
+            if (contextWritten == null || !Constants.VALUE_TRUE.equals(contextWritten)) {
                 res.setStatus(HttpServletResponse.SC_ACCEPTED);
             }
         } catch (AxisFault e) {
-            AxisEngine engine = new AxisEngine(configContext);
             if (msgContext != null) {
-                msgContext.setProperty(MessageContext.TRANSPORT_OUT,
-                        res.getOutputStream());
-                engine.handleFault(msgContext, e);
+                msgContext.setProperty(MessageContext.TRANSPORT_OUT, res.getOutputStream());
+                AxisEngine engine = new AxisEngine(configContext);
+                MessageContext faultContext = engine.createFaultMessageContext(msgContext, e);
+                engine.sendFault(faultContext);
+            } else {
+                throw new ServletException(e);
             }
         }
     }

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportUtils.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportUtils.java?rev=219929&r1=219928&r2=219929&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportUtils.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportUtils.java Wed Jul 20 08:51:50 2005
@@ -40,6 +40,7 @@
 import org.apache.axis2.soap.impl.llom.builder.StAXSOAPModelBuilder;
 import org.apache.axis2.soap.impl.llom.soap11.SOAP11Constants;
 import org.apache.axis2.soap.impl.llom.soap11.SOAP11Factory;
+import org.apache.axis2.soap.impl.llom.soap12.SOAP12Constants;
 import org.apache.axis2.util.Utils;
 
 import javax.xml.parsers.FactoryConfigurationError;
@@ -57,67 +58,73 @@
 
 public class HTTPTransportUtils {
 
-    public static void processHTTPPostRequest(MessageContext msgContext,
-                                              InputStream in,
-                                              OutputStream out,
-                                              String contentType,
-                                              String soapAction,
-                                              String requestURI,
-                                              ConfigurationContext configurationContext) throws AxisFault {
+    public static void processHTTPPostRequest(
+        MessageContext msgContext,
+        InputStream in,
+        OutputStream out,
+        String contentType,
+        String soapAction,
+        String requestURI,
+        ConfigurationContext configurationContext)
+        throws AxisFault {
         try {
-            if (soapAction != null && soapAction.startsWith("\"") &&
-                    soapAction.endsWith("\"")) {
+            //remove the starting and trailing " from the SOAP Action
+            if (soapAction != null && soapAction.startsWith("\"") && soapAction.endsWith("\"")) {
                 soapAction = soapAction.substring(1, soapAction.length() - 1);
             }
+            //fill up the Message Contexts
             msgContext.setWSAAction(soapAction);
             msgContext.setSoapAction(soapAction);
-            msgContext.setTo(new EndpointReference(AddressingConstants.WSA_TO,
-                    requestURI));
+            msgContext.setTo(new EndpointReference(AddressingConstants.WSA_TO, requestURI));
             msgContext.setProperty(MessageContext.TRANSPORT_OUT, out);
             msgContext.setServerSide(true);
 
             SOAPEnvelope envelope = null;
             StAXBuilder builder = null;
-
-
-            if (contentType.indexOf(
-                    HTTPConstants.HEADER_ACCEPT_MULTIPART_RELATED) >=
-                    0) {
-                builder = selectBuilderForMIME(msgContext, in, contentType);
-                envelope = (SOAPEnvelope) builder.getDocumentElement();
-            } else if (contentType != null
-                    &&
-                    contentType.indexOf(SOAP11Constants.SOAP_11_CONTENT_TYPE) >
-                    -1) {
-//If the content Type is text/xml (BTW which is the SOAP 1.1 Content type ) and
-//the SOAP Action is absent it is rest !!
-                Object enable = msgContext.getProperty(
-                        Constants.Configuration.ENABLE_REST);
-                if ((soapAction == null || soapAction.length() == 0)
-                        && Constants.VALUE_TRUE.equals(enable)) {
-                    msgContext.setDoingREST(true);
-                    SOAPFactory soapFactory = new SOAP11Factory();
+            if (contentType != null) {
+                if (contentType.indexOf(HTTPConstants.HEADER_ACCEPT_MULTIPART_RELATED) > -1) {
+                    //It is MTOM
+                    builder = selectBuilderForMIME(msgContext, in, contentType);
+                    envelope = (SOAPEnvelope) builder.getDocumentElement();
+                } else {
                     Reader reader = new InputStreamReader(in);
-                    XMLStreamReader xmlreader = XMLInputFactory.newInstance()
-                            .createXMLStreamReader(reader);
-                    builder = new StAXOMBuilder(xmlreader);
-                    builder.setOmbuilderFactory(soapFactory);
-                    envelope = soapFactory.getDefaultEnvelope();
-                    envelope.getBody().addChild(builder.getDocumentElement());
+                    XMLStreamReader xmlreader =
+                        XMLInputFactory.newInstance().createXMLStreamReader(reader);
+                    if (contentType.indexOf(SOAP12Constants.SOAP_12_CONTENT_TYPE) > -1) {
+                        //it is SOAP 1.2
+                        builder = new StAXSOAPModelBuilder(xmlreader);
+                        envelope = (SOAPEnvelope) builder.getDocumentElement();
+                    } else if (contentType.indexOf(SOAP11Constants.SOAP_11_CONTENT_TYPE) > -1) {
+                        //it is SOAP 1.1
+                        Object enable = msgContext.getProperty(Constants.Configuration.ENABLE_REST);
+                        if ((soapAction == null || soapAction.length() == 0)
+                            && Constants.VALUE_TRUE.equals(enable)) {
+                            //If the content Type is text/xml (BTW which is the SOAP 1.1 Content type ) and
+                            //the SOAP Action is absent it is rest !!
+                            msgContext.setDoingREST(true);
+                            SOAPFactory soapFactory = new SOAP11Factory();
+                            builder = new StAXOMBuilder(xmlreader);
+                            builder.setOmbuilderFactory(soapFactory);
+                            envelope = soapFactory.getDefaultEnvelope();
+                            envelope.getBody().addChild(builder.getDocumentElement());
+                        }else{
+                            builder = new StAXSOAPModelBuilder(xmlreader);
+                            envelope = (SOAPEnvelope) builder.getDocumentElement();
+                        }
+                    }
+
                 }
-            }
 
-            if (envelope == null) {
-                Reader reader = new InputStreamReader(in);
-                XMLStreamReader xmlreader = XMLInputFactory.newInstance()
-                        .createXMLStreamReader(reader);
-                builder = new StAXSOAPModelBuilder(xmlreader);
-                envelope = (SOAPEnvelope) builder.getDocumentElement();
             }
 
             msgContext.setEnvelope(envelope);
             AxisEngine engine = new AxisEngine(configurationContext);
-            engine.receive(msgContext);
+            if (envelope.getBody().hasFault()) {
+                engine.receiveFault(msgContext);
+            } else {
+                engine.receive(msgContext);
+            }
+
         } catch (SOAPProcessingException e) {
             throw new AxisFault(e);
         } catch (OMException e) {
@@ -127,29 +134,27 @@
         }
     }
 
-    public static boolean processHTTPGetRequest(MessageContext msgContext,
-                                                InputStream in,
-                                                OutputStream out,
-                                                String contentType,
-                                                String soapAction,
-                                                String requestURI,
-                                                ConfigurationContext configurationContext,
-                                                Map requestParameters)
-            throws AxisFault {
-        if (soapAction != null && soapAction.startsWith("\"") &&
-                soapAction.endsWith("\"")) {
+    public static boolean processHTTPGetRequest(
+        MessageContext msgContext,
+        InputStream in,
+        OutputStream out,
+        String contentType,
+        String soapAction,
+        String requestURI,
+        ConfigurationContext configurationContext,
+        Map requestParameters)
+        throws AxisFault {
+        if (soapAction != null && soapAction.startsWith("\"") && soapAction.endsWith("\"")) {
             soapAction = soapAction.substring(1, soapAction.length() - 1);
         }
         msgContext.setWSAAction(soapAction);
         msgContext.setSoapAction(soapAction);
-        msgContext.setTo(new EndpointReference(AddressingConstants.WSA_TO,
-                requestURI));
+        msgContext.setTo(new EndpointReference(AddressingConstants.WSA_TO, requestURI));
         msgContext.setProperty(MessageContext.TRANSPORT_OUT, out);
         msgContext.setServerSide(true);
         try {
-            SOAPEnvelope envelope = HTTPTransportUtils
-                    .createEnvelopeFromGetRequest(requestURI,
-                            requestParameters);
+            SOAPEnvelope envelope =
+                HTTPTransportUtils.createEnvelopeFromGetRequest(requestURI, requestParameters);
             if (envelope == null) {
                 return false;
             } else {
@@ -164,18 +169,15 @@
         }
     }
 
-    public static final SOAPEnvelope createEnvelopeFromGetRequest(
-            String requestUrl, Map map) {
-        String[] values = Utils
-                .parseRequestURLForServiceAndOperation(requestUrl);
+    public static final SOAPEnvelope createEnvelopeFromGetRequest(String requestUrl, Map map) {
+        String[] values = Utils.parseRequestURLForServiceAndOperation(requestUrl);
 
         if (values[1] != null && values[0] != null) {
             String operation = values[1];
             SOAPFactory soapFactory = new SOAP11Factory();
             SOAPEnvelope envelope = soapFactory.getDefaultEnvelope();
 
-            OMNamespace omNs = soapFactory.createOMNamespace(values[0],
-                    "services");
+            OMNamespace omNs = soapFactory.createOMNamespace(values[0], "services");
             OMNamespace defualtNs = new OMNamespaceImpl("", null);
 
             OMElement opElement = soapFactory.createOMElement(operation, omNs);
@@ -196,32 +198,28 @@
         }
     }
 
-    public static StAXBuilder selectBuilderForMIME(MessageContext msgContext,
-                                                   InputStream inStream,
-                                                   String contentTypeString) throws OMException,
-            XMLStreamException, FactoryConfigurationError {
+    public static StAXBuilder selectBuilderForMIME(
+        MessageContext msgContext,
+        InputStream inStream,
+        String contentTypeString)
+        throws OMException, XMLStreamException, FactoryConfigurationError {
         StAXBuilder builder = null;
 
-        boolean fileCacheForAttachments = (Constants.VALUE_TRUE.equals(
-                msgContext.getProperty(
-                        Constants.Configuration.CACHE_ATTACHMENTS)));
+        boolean fileCacheForAttachments =
+            (Constants
+                .VALUE_TRUE
+                .equals(msgContext.getProperty(Constants.Configuration.CACHE_ATTACHMENTS)));
         String attachmentRepoDir = null;
         if (fileCacheForAttachments) {
             attachmentRepoDir =
-                    (String) msgContext.getProperty(
-                            Constants.Configuration.ATTACHMENT_TEMP_DIR);
+                (String) msgContext.getProperty(Constants.Configuration.ATTACHMENT_TEMP_DIR);
         }
 
-        MIMEHelper mimeHelper = new MIMEHelper(inStream,
-                contentTypeString,
-                fileCacheForAttachments,
-                attachmentRepoDir);
-        XMLStreamReader reader = XMLInputFactory.newInstance()
-                .createXMLStreamReader(
-                        new BufferedReader(
-                                new InputStreamReader(
-                                        mimeHelper
-                .getSOAPPartInputStream())));
+        MIMEHelper mimeHelper =
+            new MIMEHelper(inStream, contentTypeString, fileCacheForAttachments, attachmentRepoDir);
+        XMLStreamReader reader =
+            XMLInputFactory.newInstance().createXMLStreamReader(
+                new BufferedReader(new InputStreamReader(mimeHelper.getSOAPPartInputStream())));
         /*
          * put a reference to Attachments in to the message context
          */
@@ -231,8 +229,7 @@
              * Creates the MTOM specific MTOMStAXSOAPModelBuilder
              */
             builder = new MTOMStAXSOAPModelBuilder(reader, mimeHelper);
-        } else if (mimeHelper.getAttachmentSpecType().equals(
-                MIMEHelper.SWA_TYPE)) {
+        } else if (mimeHelper.getAttachmentSpecType().equals(MIMEHelper.SWA_TYPE)) {
             builder = new StAXSOAPModelBuilder(reader);
         }
         return builder;
@@ -247,8 +244,7 @@
         boolean isOptimized = false;
         while (childrenIter.hasNext() && !isOptimized) {
             OMNode node = (OMNode) childrenIter.next();
-            if (OMNode.TEXT_NODE == node.getType()
-                    && ((OMText) node).isOptimized()) {
+            if (OMNode.TEXT_NODE == node.getType() && ((OMText) node).isOptimized()) {
                 isOptimized = true;
             } else if (OMNode.ELEMENT_NODE == node.getType()) {
                 isOptimized = isOptimised((OMElement) node);
@@ -259,15 +255,13 @@
 
     public static boolean doWriteMTOM(MessageContext msgContext) {
         boolean enableMTOM = false;
-        if (msgContext.getProperty(Constants.Configuration.ENABLE_MTOM) !=
-                null) {
+        if (msgContext.getProperty(Constants.Configuration.ENABLE_MTOM) != null) {
             enableMTOM =
-                    Constants.VALUE_TRUE.equals(
-                            msgContext
-                    .getProperty(Constants.Configuration.ENABLE_MTOM));
+                Constants.VALUE_TRUE.equals(
+                    msgContext.getProperty(Constants.Configuration.ENABLE_MTOM));
         }
-        boolean envelopeContainsOptimise = HTTPTransportUtils
-                .checkEnvelopeForOptimise(msgContext.getEnvelope());
+        boolean envelopeContainsOptimise =
+            HTTPTransportUtils.checkEnvelopeForOptimise(msgContext.getEnvelope());
         boolean doMTOM = enableMTOM && envelopeContainsOptimise;
         msgContext.setDoingMTOM(doMTOM);
         return doMTOM;

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPWorker.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPWorker.java?rev=219929&r1=219928&r2=219929&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPWorker.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPWorker.java Wed Jul 20 08:51:50 2005
@@ -38,8 +38,7 @@
     private ConfigurationContext configurationContext;
     private Socket socket;
 
-    public HTTPWorker(ConfigurationContext configurationContext,
-                      Socket socket) {
+    public HTTPWorker(ConfigurationContext configurationContext, Socket socket) {
         this.configurationContext = configurationContext;
         this.socket = socket;
     }
@@ -56,13 +55,14 @@
                 InputStream inStream = socket.getInputStream();
 
                 TransportOutDescription transportOut =
-                        configurationContext.getAxisConfiguration()
-                        .getTransportOut(new QName(Constants.TRANSPORT_HTTP));
+                    configurationContext.getAxisConfiguration().getTransportOut(
+                        new QName(Constants.TRANSPORT_HTTP));
                 msgContext =
-                        new MessageContext(configurationContext,
-                                configurationContext.getAxisConfiguration()
-                        .getTransportIn(new QName(Constants.TRANSPORT_HTTP)),
-                                transportOut);
+                    new MessageContext(
+                        configurationContext,
+                        configurationContext.getAxisConfiguration().getTransportIn(
+                            new QName(Constants.TRANSPORT_HTTP)),
+                        transportOut);
                 msgContext.setServerSide(true);
 
                 //parse the Transport Headers
@@ -71,61 +71,50 @@
 
                 //build a way to write the respone if the Axis choose to do so
 
-                String transferEncoding = (String) map.get(
-                        HTTPConstants.HEADER_TRANSFER_ENCODING);
+                String transferEncoding = (String) map.get(HTTPConstants.HEADER_TRANSFER_ENCODING);
                 if (transferEncoding != null
-                        &&
-                        HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED.equals(
-                                transferEncoding)) {
+                    && HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED.equals(transferEncoding)) {
                     inStream = new ChunkedInputStream(inStream);
-                    out =
-                            new SimpleHTTPOutputStream(
-                                    socket.getOutputStream(), true);
+                    out = new SimpleHTTPOutputStream(socket.getOutputStream(), true);
                 } else {
-                    out =
-                            new SimpleHTTPOutputStream(
-                                    socket.getOutputStream(), false);
+                    out = new SimpleHTTPOutputStream(socket.getOutputStream(), false);
                 }
                 msgContext.setProperty(MessageContext.TRANSPORT_OUT, out);
 
                 //This is way to provide Accsess to the transport information to the transport Sender
-                msgContext.setProperty(HTTPConstants.HTTPOutTransportInfo,
-                        new SimpleHTTPOutTransportInfo(out));
+                msgContext.setProperty(
+                    HTTPConstants.HTTPOutTransportInfo,
+                    new SimpleHTTPOutTransportInfo(out));
 
-                if (HTTPConstants.HEADER_GET.equals(
-                        map.get(HTTPConstants.HTTP_REQ_TYPE))) {
+                if (HTTPConstants.HEADER_GET.equals(map.get(HTTPConstants.HTTP_REQ_TYPE))) {
                     //It is GET handle the Get request 
                     boolean processed =
-                            HTTPTransportUtils.processHTTPGetRequest(
-                                    msgContext,
-                                    inStream,
-                                    out,
-                                    (String) map.get(
-                                            HTTPConstants.HEADER_CONTENT_TYPE),
-                                    (String) map.get(
-                                            HTTPConstants.HEADER_SOAP_ACTION),
-                                    (String) map.get(HTTPConstants.REQUEST_URI),
-                                    configurationContext,
-                                    HTTPTransportReceiver.getGetRequestParameters(
-                                            (String) map.get(
-                                                    HTTPConstants.REQUEST_URI)));
+                        HTTPTransportUtils.processHTTPGetRequest(
+                            msgContext,
+                            inStream,
+                            out,
+                            (String) map.get(HTTPConstants.HEADER_CONTENT_TYPE),
+                            (String) map.get(HTTPConstants.HEADER_SOAP_ACTION),
+                            (String) map.get(HTTPConstants.REQUEST_URI),
+                            configurationContext,
+                            HTTPTransportReceiver.getGetRequestParameters(
+                                (String) map.get(HTTPConstants.REQUEST_URI)));
 
                     if (!processed) {
                         out.write(
-                                HTTPTransportReceiver.getServicesHTML(
-                                        configurationContext)
-                                .getBytes());
+                            HTTPTransportReceiver.getServicesHTML(configurationContext).getBytes());
                         out.flush();
                     }
                 } else {
                     //It is POST, handle it
-                    HTTPTransportUtils.processHTTPPostRequest(msgContext,
-                            inStream,
-                            out,
-                            (String) map.get(HTTPConstants.HEADER_CONTENT_TYPE),
-                            (String) map.get(HTTPConstants.HEADER_SOAP_ACTION),
-                            (String) map.get(HTTPConstants.REQUEST_URI),
-                            configurationContext);
+                    HTTPTransportUtils.processHTTPPostRequest(
+                        msgContext,
+                        inStream,
+                        out,
+                        (String) map.get(HTTPConstants.HEADER_CONTENT_TYPE),
+                        (String) map.get(HTTPConstants.HEADER_SOAP_ACTION),
+                        (String) map.get(HTTPConstants.REQUEST_URI),
+                        configurationContext);
                 }
 
                 out.finalize();
@@ -134,13 +123,12 @@
             try {
                 AxisEngine engine = new AxisEngine(configurationContext);
                 if (msgContext != null) {
-                    if (out == null) {
-                        out =
-                                new SimpleHTTPOutputStream(
-                                        socket.getOutputStream(), false);
-                    }
                     msgContext.setProperty(MessageContext.TRANSPORT_OUT, out);
-                    engine.handleFault(msgContext, e);
+                    MessageContext faultContext = engine.createFaultMessageContext(msgContext, e);
+                    engine.sendFault(faultContext);
+                } else {
+                    log.error(e);
+                    e.printStackTrace();
                 }
             } catch (Exception e1) {
                 log.error(e1);

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/local/LocalTransportReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/local/LocalTransportReceiver.java?rev=219929&r1=219928&r2=219929&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/local/LocalTransportReceiver.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/local/LocalTransportReceiver.java Wed Jul 20 08:51:50 2005
@@ -54,23 +54,29 @@
     public void processMessage(InputStream in, EndpointReference to) throws AxisFault {
         try {
             TransportInDescription tIn =
-                    confContext.getAxisConfiguration().getTransportIn(
-                            new QName(Constants.TRANSPORT_LOCAL));
+                confContext.getAxisConfiguration().getTransportIn(
+                    new QName(Constants.TRANSPORT_LOCAL));
             TransportOutDescription tOut =
-                    confContext.getAxisConfiguration().getTransportOut(
-                            new QName(Constants.TRANSPORT_LOCAL));
+                confContext.getAxisConfiguration().getTransportOut(
+                    new QName(Constants.TRANSPORT_LOCAL));
             MessageContext msgCtx = new MessageContext(confContext, tIn, tOut);
             msgCtx.setTo(to);
             msgCtx.setServerSide(true);
 
             XMLStreamReader reader =
-                    XMLInputFactory.newInstance().createXMLStreamReader(
-                            new BufferedReader(new InputStreamReader(in)));
+                XMLInputFactory.newInstance().createXMLStreamReader(
+                    new BufferedReader(new InputStreamReader(in)));
 
             StAXBuilder builder = new StAXSOAPModelBuilder(reader);
-            msgCtx.setEnvelope((SOAPEnvelope) builder.getDocumentElement());
+            SOAPEnvelope envelope = (SOAPEnvelope) builder.getDocumentElement();
+            msgCtx.setEnvelope(envelope);
             AxisEngine engine = new AxisEngine(confContext);
-            engine.receive(msgCtx);
+
+            if (envelope.getBody().hasFault()) {
+                engine.receiveFault(msgCtx);
+            } else {
+                engine.receive(msgCtx);
+            }
         } catch (XMLStreamException e) {
             throw new AxisFault(e);
         } catch (FactoryConfigurationError e) {

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/MailWorker.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/MailWorker.java?rev=219929&r1=219928&r2=219929&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/MailWorker.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/MailWorker.java Wed Jul 20 08:51:50 2005
@@ -49,7 +49,6 @@
 
     private ConfigurationContext reg = null;
 
-    // Current message
     private MimeMessage mimeMessage;
 
     private Properties prop = new Properties();
@@ -71,60 +70,77 @@
      * The main workhorse method.
      */
     public void doWork() {
-        // create an Axis server
         AxisEngine engine = new AxisEngine(reg);
         MessageContext msgContext = null;
         // create and initialize a message context
         try {
-            TransportInDescription transportIn = reg.getAxisConfiguration()
-                    .getTransportIn(new QName(Constants.TRANSPORT_MAIL));
-            TransportOutDescription transportOut = reg.getAxisConfiguration()
-                    .getTransportOut(new QName(Constants.TRANSPORT_MAIL));
-
-            msgContext = new MessageContext(reg, transportIn, transportOut);
-            msgContext.setServerSide(true);
-            msgContext.setProperty(MailConstants.CONTENT_TYPE,
-                    mimeMessage.getContentType());
-            String soapAction = getMailHeader(MailConstants.HEADER_SOAP_ACTION);
-            msgContext.setWSAAction(soapAction);
-            msgContext.setSoapAction(soapAction);
-
-            String serviceURL = mimeMessage.getSubject();
-            if (serviceURL == null) {
-                serviceURL = "";
-            }
-
-            String replyTo = ((InternetAddress) mimeMessage.getReplyTo()[0]).getAddress();
-            if (replyTo != null) {
-                msgContext.setReplyTo(
-                        new EndpointReference(AddressingConstants.WSA_REPLY_TO,
-                                replyTo));
-            }
-
-            String recepainets = ((InternetAddress) mimeMessage.getAllRecipients()[0]).getAddress();
-            if (recepainets != null) {
-                msgContext.setTo(
-                        new EndpointReference(AddressingConstants.WSA_FROM,
-                                recepainets + "/" + serviceURL));
+            TransportInDescription transportIn =
+                reg.getAxisConfiguration().getTransportIn(new QName(Constants.TRANSPORT_MAIL));
+            TransportOutDescription transportOut =
+                reg.getAxisConfiguration().getTransportOut(new QName(Constants.TRANSPORT_MAIL));
+            if (transportIn != null && transportOut != null) {
+                //create Message Context
+                msgContext = new MessageContext(reg, transportIn, transportOut);
+                msgContext.setServerSide(true);
+                msgContext.setProperty(MailConstants.CONTENT_TYPE, mimeMessage.getContentType());
+                String soapAction = getMailHeader(MailConstants.HEADER_SOAP_ACTION);
+                msgContext.setWSAAction(soapAction);
+                msgContext.setSoapAction(soapAction);
+
+                //Create Mail EPR, EPR is constructed using the format, foo@bar/axis2/services/echo and is constructed 
+                //using the <to-email-address>/<email-subject>
+                InternetAddress[] recepainets = (InternetAddress[]) mimeMessage.getAllRecipients();
+                if (recepainets != null && recepainets.length > 0) {
+                    String emailAddress = recepainets[0].getAddress();
+                    String emailSubject = mimeMessage.getSubject();
+                    EndpointReference to =
+                        new EndpointReference(
+                            AddressingConstants.WSA_TO,
+                            emailAddress + "/" + (emailSubject != null ? emailSubject : ""));
+                } else {
+                    throw new AxisFault("No receptineist found in the Email");
+                }
+                //try to assume the reply to value
+                InternetAddress[] replyToAs = (InternetAddress[]) mimeMessage.getAllRecipients();
+                if (replyToAs != null && replyToAs.length > 0) {
+                    String replyTo = replyToAs[0].getAddress();
+                    if (replyTo != null) {
+                        msgContext.setReplyTo(
+                            new EndpointReference(AddressingConstants.WSA_REPLY_TO, replyTo));
+                    }
+                }
+
+                //Create the SOAP Message
+                //TODO This can we written better way, to use the streams better
+                String message = mimeMessage.getContent().toString();
+                ByteArrayInputStream bais = new ByteArrayInputStream(message.getBytes());
+                XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(bais);
+                StAXBuilder builder = new StAXSOAPModelBuilder(reader);
+                SOAPEnvelope envelope = (SOAPEnvelope) builder.getDocumentElement();
+                msgContext.setEnvelope(envelope);
+                if (envelope.getBody().hasFault()) {
+                    engine.receiveFault(msgContext);
+                } else {
+                    engine.receive(msgContext);
+                }
             } else {
-                throw new AxisFault("No receptineist found in the Email");
+                throw new AxisFault("Unknown transport " + Constants.TRANSPORT_MAIL);
             }
 
-            // add the SOAPEnvelope
-            String message = mimeMessage.getContent().toString();
-            System.out.println("message[" + message + "]");
-            ByteArrayInputStream bais =
-                    new ByteArrayInputStream(message.getBytes());
-            XMLStreamReader reader = XMLInputFactory.newInstance()
-                    .createXMLStreamReader(bais);
-            StAXBuilder builder = new StAXSOAPModelBuilder(reader);
-            msgContext.setEnvelope((SOAPEnvelope) builder.getDocumentElement());
-
-            // invoke the Axis engine
-            engine.receive(msgContext);
         } catch (Exception e) {
-            e.printStackTrace();
-            log.error(e);
+            try {
+
+                if (msgContext != null) {
+                    MessageContext faultContext = engine.createFaultMessageContext(msgContext, e);
+                    engine.sendFault(faultContext);
+                } else {
+                    log.error(e);
+                    e.printStackTrace();
+                }
+            } catch (AxisFault e1) {
+                log.error(e);
+                e1.printStackTrace();
+            }
         }
 
         /*

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/server/MailSorter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/server/MailSorter.java?rev=219929&r1=219928&r2=219929&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/server/MailSorter.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/server/MailSorter.java Wed Jul 20 08:51:50 2005
@@ -33,7 +33,8 @@
  */
 public class MailSorter {
     Storage st = null;
-    private ArrayList sUsers = new ArrayList(); // Special users. They are hard coded for the time being to axis2-server@localhost and axis2-server@127.0.0.1
+    private ArrayList sUsers = new ArrayList();
+    // Special users. They are hard coded for the time being to axis2-server@localhost and axis2-server@127.0.0.1
     private ConfigurationContext configurationContext = null;
     protected static Log log = LogFactory.getLog(MailSorter.class.getName());
     private boolean actAsMailet = false;
@@ -41,7 +42,7 @@
         this.st = st;
         sUsers.add("axis2-server@localhost");
         sUsers.add("axis2-server@127.0.0.1");
-        if (configurationContext == null){
+        if (configurationContext == null) {
             actAsMailet = false;
         } else {
             this.configurationContext = configurationContext;
@@ -55,33 +56,30 @@
                 processMail(configurationContext, msg);
             } else {
                 st.addMail(user, msg);
-            }            
+            }
         } else {
             st.addMail(user, msg);
         }
 
     }
 
-    public void processMail(ConfigurationContext confContext,
-                            MimeMessage mimeMessage) {
+    public void processMail(ConfigurationContext confContext, MimeMessage mimeMessage) {
         // create an Axis server
         AxisEngine engine = new AxisEngine(confContext);
         MessageContext msgContext = null;
         // create and initialize a message context
         try {
             msgContext =
-                    new MessageContext(confContext,
-                            confContext.getAxisConfiguration().getTransportIn(
-                                    new QName(Constants.TRANSPORT_MAIL)),
-                            confContext.getAxisConfiguration().getTransportOut(
-                                    new QName(Constants.TRANSPORT_MAIL)));
+                new MessageContext(
+                    confContext,
+                    confContext.getAxisConfiguration().getTransportIn(
+                        new QName(Constants.TRANSPORT_MAIL)),
+                    confContext.getAxisConfiguration().getTransportOut(
+                        new QName(Constants.TRANSPORT_MAIL)));
             msgContext.setServerSide(true);
 
-            msgContext.setProperty(MailConstants.CONTENT_TYPE,
-                    mimeMessage.getContentType());
-            msgContext.setWSAAction(
-                    getMailHeader(MailConstants.HEADER_SOAP_ACTION,
-                            mimeMessage));
+            msgContext.setProperty(MailConstants.CONTENT_TYPE, mimeMessage.getContentType());
+            msgContext.setWSAAction(getMailHeader(MailConstants.HEADER_SOAP_ACTION, mimeMessage));
 
             String serviceURL = mimeMessage.getSubject();
             if (serviceURL == null) {
@@ -91,42 +89,44 @@
             String replyTo = ((InternetAddress) mimeMessage.getReplyTo()[0]).getAddress();
             if (replyTo != null) {
                 msgContext.setReplyTo(
-                        new EndpointReference(AddressingConstants.WSA_REPLY_TO,
-                                replyTo));
+                    new EndpointReference(AddressingConstants.WSA_REPLY_TO, replyTo));
             }
 
             String recepainets = ((InternetAddress) mimeMessage.getAllRecipients()[0]).getAddress();
 
-
             if (recepainets != null) {
                 msgContext.setTo(
-                        new EndpointReference(AddressingConstants.WSA_FROM,
-                                recepainets + "/" + serviceURL));
+                    new EndpointReference(
+                        AddressingConstants.WSA_FROM,
+                        recepainets + "/" + serviceURL));
             }
 
             // add the SOAPEnvelope
             String message = mimeMessage.getContent().toString();
             System.out.println("message[" + message + "]");
-            ByteArrayInputStream bais =
-                    new ByteArrayInputStream(message.getBytes());
-            XMLStreamReader reader = XMLInputFactory.newInstance()
-                    .createXMLStreamReader(bais);
+            ByteArrayInputStream bais = new ByteArrayInputStream(message.getBytes());
+            XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(bais);
             StAXBuilder builder = new StAXSOAPModelBuilder(reader);
-            msgContext.setEnvelope((SOAPEnvelope) builder.getDocumentElement());
-            // invoke the Axis engine
-            engine.receive(msgContext);
-        } catch (Exception e) {
-            AxisFault af;
-            if (e instanceof AxisFault) {
-                af = (AxisFault) e;
-                log.debug("Error occured while trying to process the mail.",
-                        af);
+  
+            SOAPEnvelope envelope = (SOAPEnvelope) builder.getDocumentElement();
+            msgContext.setEnvelope(envelope);
+            if (envelope.getBody().hasFault()) {
+                engine.receiveFault(msgContext);
             } else {
-                af = AxisFault.makeFault(e);
+                engine.receive(msgContext);
+            }
+        } catch (Exception e) {
+            try {
+                if (msgContext != null) {
+                    MessageContext faultContext = engine.createFaultMessageContext(msgContext, e);
+                    engine.sendFault(faultContext);
+                }
+            } catch (Exception e1) {
+                log.error(e);
+                e.printStackTrace();
             }
         }
     }
-
 
     private String getMailHeader(String headerName, MimeMessage mimeMessage) throws AxisFault {
         try {

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/tcp/TCPWorker.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/tcp/TCPWorker.java?rev=219929&r1=219928&r2=219929&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/tcp/TCPWorker.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/tcp/TCPWorker.java Wed Jul 20 08:51:50 2005
@@ -17,10 +17,22 @@
  */
 package org.apache.axis2.transport.tcp;
 
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.net.Socket;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
 import org.apache.axis2.Constants;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.TransportInDescription;
 import org.apache.axis2.description.TransportOutDescription;
+import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.engine.AxisEngine;
 import org.apache.axis2.engine.AxisFault;
 import org.apache.axis2.om.impl.llom.builder.StAXBuilder;
@@ -29,16 +41,9 @@
 import org.apache.axis2.util.threadpool.AxisWorker;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.Reader;
-import java.net.Socket;
-
+/**
+ * This Class is the work hoarse of the TCP request, this process the incomming SOAP Message.  
+ */
 public class TCPWorker implements AxisWorker {
     protected Log log = LogFactory.getLog(getClass().getName());
     private ConfigurationContext configurationContext;
@@ -52,38 +57,42 @@
     public void doWork() {
         MessageContext msgContext = null;
         try {
-            Reader in = new InputStreamReader(socket.getInputStream());
-            TransportOutDescription transportOut =
-                    configurationContext.getAxisConfiguration()
-                    .getTransportOut(new QName(Constants.TRANSPORT_TCP));
-            msgContext =
-                    new MessageContext(configurationContext,
-                            configurationContext.getAxisConfiguration()
-                    .getTransportIn(new QName(Constants.TRANSPORT_TCP)),
-                            transportOut);
-            msgContext.setServerSide(true);
-            OutputStream out = socket.getOutputStream();
-            msgContext.setProperty(MessageContext.TRANSPORT_OUT, out);
-
             AxisEngine engine = new AxisEngine(configurationContext);
-            try {
-                XMLStreamReader xmlreader = XMLInputFactory.newInstance()
-                        .createXMLStreamReader(in);
+            AxisConfiguration axisConf = configurationContext.getAxisConfiguration();
+
+            TransportOutDescription transportOut =
+                axisConf.getTransportOut(new QName(Constants.TRANSPORT_TCP));
+            TransportInDescription transportIn =
+                axisConf.getTransportIn(new QName(Constants.TRANSPORT_TCP));
+            if (transportOut != null && transportIn != null) {
+                //create the Message Context and fill in the values
+                msgContext = new MessageContext(configurationContext, transportIn, transportOut);
+                msgContext.setServerSide(true);
+                OutputStream out = socket.getOutputStream();
+                msgContext.setProperty(MessageContext.TRANSPORT_OUT, out);
+
+                //create the SOAP Envelope
+                Reader in = new InputStreamReader(socket.getInputStream());
+                XMLStreamReader xmlreader = XMLInputFactory.newInstance().createXMLStreamReader(in);
                 StAXBuilder builder = new StAXSOAPModelBuilder(xmlreader);
-                msgContext.setEnvelope(
-                        (SOAPEnvelope) builder.getDocumentElement());
-            } catch (Exception e) {
-                throw new AxisFault(e.getMessage(), e);
+                SOAPEnvelope envelope = (SOAPEnvelope) builder.getDocumentElement();
+                msgContext.setEnvelope(envelope);
+                if (envelope.getBody().hasFault()) {
+                    engine.receiveFault(msgContext);
+                } else {
+                    engine.receive(msgContext);
+                }
+            } else {
+                throw new AxisFault("Unknown transport " + Constants.TRANSPORT_TCP);
             }
-            engine.receive(msgContext);
 
         } catch (Throwable e) {
             try {
                 AxisEngine engine = new AxisEngine(configurationContext);
                 if (msgContext != null) {
-                    msgContext.setProperty(MessageContext.TRANSPORT_OUT,
-                            socket.getOutputStream());
-                    engine.handleFault(msgContext, e);
+                    msgContext.setProperty(MessageContext.TRANSPORT_OUT, socket.getOutputStream());
+                    MessageContext faultContext = engine.createFaultMessageContext(msgContext, e);
+                    engine.sendFault(faultContext);
                 }
             } catch (Exception e1) {
                 log.error(e);

Modified: webservices/axis/trunk/java/modules/core/test/org/apache/axis2/engine/EnginePausingTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/test/org/apache/axis2/engine/EnginePausingTest.java?rev=219929&r1=219928&r2=219929&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/test/org/apache/axis2/engine/EnginePausingTest.java (original)
+++ webservices/axis/trunk/java/modules/core/test/org/apache/axis2/engine/EnginePausingTest.java Wed Jul 20 08:51:50 2005
@@ -142,7 +142,7 @@
         }
         engine.receive(mc);
 
-        assertEquals(executedHandlers.size(), 27);
+        assertEquals(27,executedHandlers.size());
         for (int i = 15; i < 27; i++) {
             assertEquals(((Integer) executedHandlers.get(i)).intValue(),
                     i + 1);



Mime
View raw message