Author: chamikara
Date: Tue Apr  4 01:48:07 2006
New Revision: 391249

URL: http://svn.apache.org/viewcvs?rev=391249&view=rev
Log:
Added the RMFaultCallback feature, which can be used to programatically handle 
faults that come due to RM control messages.

Added:
    
webservices/sandesha/trunk/src/org/apache/sandesha2/client/RMFaultCallback.java
Modified:
    webservices/sandesha/trunk/src/org/apache/sandesha2/Sandesha2Constants.java
    
webservices/sandesha/trunk/src/org/apache/sandesha2/client/Sandesha2ClientAPI.java
    
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java
    
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaInHandler.java
    
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java
    
webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java
    
webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqMsgProcessor.java
    
webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/MsgProcessorFactory.java
    
webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/TerminateSeqResponseMsgProcessor.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/util/SandeshaUtil.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/workers/Sender.java

Modified: 
webservices/sandesha/trunk/src/org/apache/sandesha2/Sandesha2Constants.java
URL: 
http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/Sandesha2Constants.java?rev=391249&r1=391248&r2=391249&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/Sandesha2Constants.java 
(original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/Sandesha2Constants.java 
Tue Apr  4 01:48:07 2006
@@ -189,7 +189,9 @@
                
                int TERMINATE_SEQ_RESPONSE = 9;
 
-               int MAX_MESSAGE_TYPE = 9;
+               int FAULT_MSG = 10;
+               
+               int MAX_MESSAGE_TYPE = 10;
        }
 
        public interface MessageParts {

Added: 
webservices/sandesha/trunk/src/org/apache/sandesha2/client/RMFaultCallback.java
URL: 
http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/client/RMFaultCallback.java?rev=391249&view=auto
==============================================================================
--- 
webservices/sandesha/trunk/src/org/apache/sandesha2/client/RMFaultCallback.java 
(added)
+++ 
webservices/sandesha/trunk/src/org/apache/sandesha2/client/RMFaultCallback.java 
Tue Apr  4 01:48:07 2006
@@ -0,0 +1,26 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy 
of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations 
under
+ * the License.
+ *  
+ */
+
+package org.apache.sandesha2.client;
+
+import org.apache.axis2.AxisFault;
+
+public abstract class RMFaultCallback {
+
+       public abstract void onError(AxisFault fault);
+
+}

Modified: 
webservices/sandesha/trunk/src/org/apache/sandesha2/client/Sandesha2ClientAPI.java
URL: 
http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/client/Sandesha2ClientAPI.java?rev=391249&r1=391248&r2=391249&view=diff
==============================================================================
--- 
webservices/sandesha/trunk/src/org/apache/sandesha2/client/Sandesha2ClientAPI.java
 (original)
+++ 
webservices/sandesha/trunk/src/org/apache/sandesha2/client/Sandesha2ClientAPI.java
 Tue Apr  4 01:48:07 2006
@@ -74,6 +74,7 @@
        public static String MESSAGE_NUMBER = 
"Sandesha2ClientAPIPropertyMessageNumber";
        public static String RM_SPEC_VERSION = 
"Sandesha2ClientAPIPropertyRMSpecVersion";
        public static String DUMMY_MESSAGE = "Sandesha2ClientAPIDummyMessage"; 
//If this property is set, even though this message will invoke the RM 
handlers, this will not be sent as an actual application message
+       public static String RM_FAULT_CALLBACK = 
"Sandesha2ClientAPIRMFaultCallback";
        public static String VALUE_TRUE = "true";
        public static String VALUE_FALSE = "false";
        

Modified: 
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java
URL: 
http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java?rev=391249&r1=391248&r2=391249&view=diff
==============================================================================
--- 
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java
 (original)
+++ 
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java
 Tue Apr  4 01:48:07 2006
@@ -27,14 +27,20 @@
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.context.OperationContext;
+import org.apache.axis2.context.OperationContextFactory;
 import org.apache.axis2.engine.AxisEngine;
 import org.apache.axis2.handlers.AbstractHandler;
 import org.apache.axiom.soap.SOAPBody;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPFaultReason;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.sandesha2.RMMsgContext;
 import org.apache.sandesha2.Sandesha2Constants;
 import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.client.RMFaultCallback;
+import org.apache.sandesha2.client.Sandesha2ClientAPI;
 import org.apache.sandesha2.msgprocessors.ApplicationMsgProcessor;
 import org.apache.sandesha2.storage.StorageManager;
 import org.apache.sandesha2.storage.beanmanagers.SequencePropertyBeanMgr;
@@ -58,6 +64,56 @@
 
        public void invoke(MessageContext msgContext) throws AxisFault {
 
+               ConfigurationContext configContext = 
msgContext.getConfigurationContext();
+               if ( configContext==null)
+                       throw new AxisFault ("Configuration context is not 
set");
+               
+               SOAPEnvelope envelope = msgContext.getEnvelope();
+               if (envelope==null)
+                       throw new SandeshaException ("SOAP envelope is not 
set");
+               
+               //processing faults.
+               //Had to do this before dispatching. A fault message comes with 
the relatesTo part. So this will
+               //fill the opContext of te req/res message. But RM keeps 
retransmitting. So RM has to report the 
+               //error and stop this fault being dispatched as the response 
message.
+               
+               SOAPFault faultPart = envelope.getBody().getFault();
+               
+               if (faultPart!=null) {
+                       RelatesTo relatesTo = msgContext.getRelatesTo();
+                       if (relatesTo!=null) {
+                               String relatesToValue = relatesTo.getValue();
+                               OperationContext operationContext = 
configContext.getOperationContext(relatesToValue);
+                               if (operationContext!=null) {
+                                       MessageContext requestMessage = 
operationContext.getMessageContext(OperationContextFactory.MESSAGE_LABEL_OUT_VALUE);
+                                       if (requestMessage!=null) {
+                                               
if(SandeshaUtil.isRetriableOnFaults(requestMessage)){
+                                                       
+                                                       RMFaultCallback 
faultCallback = (RMFaultCallback) 
operationContext.getProperty(Sandesha2ClientAPI.RM_FAULT_CALLBACK);
+                                                       if 
(faultCallback!=null) {
+                                                               
+                                                               
+                                                               //constructing 
the fault
+                                                               AxisFault 
axisFault = getAxisFaultFromFromSOAPFault (faultPart);
+                                                               
+                                                               
+                                                               //reporting the 
fault
+                                                               
log.error(axisFault);
+                                                               if 
(faultCallback!=null) {
+                                                                       
faultCallback.onError(axisFault);
+                                                               } 
+                                                               
+                                                       }
+                                                       
+                                                       //stopping the fault 
from going further and getting dispatched
+                                                       msgContext.pause(); 
//TODO let this go in the last try
+                                                       return;
+                                               }
+                                       }
+                               }
+                       }
+               }
+               
                //Quitting the message with minimum processing if not intended 
for RM.
                boolean isRMGlobalMessage = 
SandeshaUtil.isRMGlobalMessage(msgContext);
                if (!isRMGlobalMessage) {
@@ -237,4 +293,17 @@
        public QName getName() {
                return new QName(Sandesha2Constants.GLOBAL_IN_HANDLER_NAME);
        }
+       
+       private AxisFault getAxisFaultFromFromSOAPFault (SOAPFault faultPart) {
+               SOAPFaultReason reason = faultPart.getReason();
+               
+               AxisFault axisFault = null;
+               if (reason!=null)
+                       axisFault = new AxisFault (reason.getText());
+               else
+                       axisFault = new AxisFault ("");
+               
+               return axisFault;
+       }
+       
 }

Modified: 
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaInHandler.java
URL: 
http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaInHandler.java?rev=391249&r1=391248&r2=391249&view=diff
==============================================================================
--- 
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaInHandler.java
 (original)
+++ 
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaInHandler.java
 Tue Apr  4 01:48:07 2006
@@ -53,6 +53,8 @@
 
        public void invoke(MessageContext msgCtx) throws AxisFault {
        
+               
+               
                ConfigurationContext context = msgCtx.getConfigurationContext();
                if (context == null) {
                        String message = "ConfigurationContext is null";
@@ -81,8 +83,7 @@
                        throw new AxisFault(message);
                }
                
-               MsgProcessor msgProcessor = MsgProcessorFactory
-                               .getMessageProcessor(rmMsgCtx.getMessageType());
+               MsgProcessor msgProcessor = 
MsgProcessorFactory.getMessageProcessor (rmMsgCtx);
 
                try {
                        if (msgProcessor!=null)

Modified: 
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java
URL: 
http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java?rev=391249&r1=391248&r2=391249&view=diff
==============================================================================
--- 
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java
 (original)
+++ 
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java
 Tue Apr  4 01:48:07 2006
@@ -131,7 +131,7 @@
                        } else if (!msgCtx.isServerSide()) //if client side.
                            msgProcessor = new ApplicationMsgProcessor ();
                }else  {
-                       msgProcessor = 
MsgProcessorFactory.getMessageProcessor(messageType);
+                       msgProcessor = 
MsgProcessorFactory.getMessageProcessor(rmMsgCtx);
                }
                
                if (msgProcessor!=null)

Modified: 
webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java
URL: 
http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java?rev=391249&r1=391248&r2=391249&view=diff
==============================================================================
--- 
webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java
 (original)
+++ 
webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java
 Tue Apr  4 01:48:07 2006
@@ -43,6 +43,7 @@
 import org.apache.sandesha2.Sandesha2Constants;
 import org.apache.sandesha2.SandeshaException;
 import org.apache.sandesha2.SpecSpecificConstants;
+import org.apache.sandesha2.client.RMFaultCallback;
 import org.apache.sandesha2.client.Sandesha2ClientAPI;
 import org.apache.sandesha2.storage.StorageManager;
 import org.apache.sandesha2.storage.Transaction;
@@ -435,6 +436,15 @@
                
                MessageContext msgContext = rmMsgCtx.getMessageContext();
                ConfigurationContext configContext = msgContext 
.getConfigurationContext();
+               
+               //setting the Fault callback            
+               RMFaultCallback faultCallback = (RMFaultCallback) 
msgContext.getOptions().getProperty(Sandesha2ClientAPI.RM_FAULT_CALLBACK);
+               if (faultCallback!=null) {
+                       OperationContext operationContext = 
msgContext.getOperationContext();
+                       if (operationContext!=null) {
+                               
operationContext.setProperty(Sandesha2ClientAPI.RM_FAULT_CALLBACK,faultCallback);
+                       }
+               }
                
                //retrieving the the storage manager
                StorageManager storageManager = 
SandeshaUtil.getSandeshaStorageManager(configContext);

Modified: 
webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqMsgProcessor.java
URL: 
http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqMsgProcessor.java?rev=391249&r1=391248&r2=391249&view=diff
==============================================================================
--- 
webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqMsgProcessor.java
 (original)
+++ 
webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqMsgProcessor.java
 Tue Apr  4 01:48:07 2006
@@ -23,6 +23,7 @@
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.OperationContext;
 import org.apache.axis2.engine.AxisEngine;
 import org.apache.axis2.util.Utils;
 import org.apache.commons.logging.Log;
@@ -31,6 +32,8 @@
 import org.apache.sandesha2.Sandesha2Constants;
 import org.apache.sandesha2.SandeshaException;
 import org.apache.sandesha2.SpecSpecificConstants;
+import org.apache.sandesha2.client.RMFaultCallback;
+import org.apache.sandesha2.client.Sandesha2ClientAPI;
 import org.apache.sandesha2.storage.StorageManager;
 import org.apache.sandesha2.storage.Transaction;
 import org.apache.sandesha2.storage.beanmanagers.CreateSeqBeanMgr;
@@ -58,7 +61,6 @@
        
        public void processInMessage(RMMsgContext createSeqRMMsg)
                        throws SandeshaException {
-
                
                MessageContext createSeqMsg = 
createSeqRMMsg.getMessageContext();
                CreateSequence createSeqPart = (CreateSequence) 
createSeqRMMsg.getMessagePart(Sandesha2Constants.MessageParts.CREATE_SEQ);
@@ -225,5 +227,15 @@
        
        public void processOutMessage(RMMsgContext rmMsgCtx) throws 
SandeshaException {
                
+               MessageContext msgCtx = rmMsgCtx.getMessageContext();
+               
+               //adding the RM_FAULT_CALLBACK
+               RMFaultCallback faultCallback = (RMFaultCallback) 
msgCtx.getOptions().getProperty(Sandesha2ClientAPI.RM_FAULT_CALLBACK);
+               if (faultCallback!=null) {
+                       OperationContext operationContext = 
msgCtx.getOperationContext();
+                       if (operationContext!=null) {
+                               
operationContext.setProperty(Sandesha2ClientAPI.RM_FAULT_CALLBACK,faultCallback);
+                       }
+               }
        }
 }

Modified: 
webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/MsgProcessorFactory.java
URL: 
http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/MsgProcessorFactory.java?rev=391249&r1=391248&r2=391249&view=diff
==============================================================================
--- 
webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/MsgProcessorFactory.java
 (original)
+++ 
webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/MsgProcessorFactory.java
 Tue Apr  4 01:48:07 2006
@@ -17,6 +17,7 @@
 
 package org.apache.sandesha2.msgprocessors;
 
+import org.apache.sandesha2.RMMsgContext;
 import org.apache.sandesha2.Sandesha2Constants;
 
 /**
@@ -27,8 +28,11 @@
 
 public class MsgProcessorFactory {
 
-       public static MsgProcessor getMessageProcessor(int msgType) {
-               switch (msgType) {
+       public static MsgProcessor getMessageProcessor(RMMsgContext 
rmMessageContext) {
+               
+               int messageType = rmMessageContext.getMessageType();
+               
+               switch (messageType) {
                case (Sandesha2Constants.MessageTypes.CREATE_SEQ):
                        return new CreateSeqMsgProcessor();
                case (Sandesha2Constants.MessageTypes.TERMINATE_SEQ):

Modified: 
webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/TerminateSeqResponseMsgProcessor.java
URL: 
http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/TerminateSeqResponseMsgProcessor.java?rev=391249&r1=391248&r2=391249&view=diff
==============================================================================
--- 
webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/TerminateSeqResponseMsgProcessor.java
 (original)
+++ 
webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/TerminateSeqResponseMsgProcessor.java
 Tue Apr  4 01:48:07 2006
@@ -36,7 +36,6 @@
                
                
                //TODO add processing logic
-               System.out.println("");
                
                terminateResRMMsg.pause();
        }

Modified: 
webservices/sandesha/trunk/src/org/apache/sandesha2/util/SandeshaUtil.java
URL: 
http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/util/SandeshaUtil.java?rev=391249&r1=391248&r2=391249&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/util/SandeshaUtil.java 
(original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/util/SandeshaUtil.java 
Tue Apr  4 01:48:07 2006
@@ -35,6 +35,7 @@
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
 import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.client.Options;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.context.MessageContextConstants;
@@ -395,6 +396,50 @@
                return rmGlobalMsg;
        }
 
+       // RM will retry sending the message even if a fault arrive for 
following message types.
+       public static boolean isRetriableOnFaults(MessageContext msgCtx) {
+               boolean rmGlobalMsg = false;
+
+               String action = msgCtx.getWSAAction();
+//             SOAPEnvelope env = msgCtx.getEnvelope();
+//             SOAPHeader header = null;
+//             if (env != null)
+//                     header = env.getHeader();
+//             else {
+//                     log.error("SOAP envelope is null");
+//                     return false;
+//             }
+
+               // TODO make this spec indipendent
+
+//             OMElement sequenceElem = null;
+//             if (header != null)
+//                     sequenceElem = header.getFirstChildWithName(new 
QName(Sandesha2Constants.SPEC_2005_02.NS_URI,
+//                                     
Sandesha2Constants.WSRM_COMMON.SEQUENCE));
+//
+//             if (sequenceElem == null)
+//                     sequenceElem = header.getFirstChildWithName(new 
QName(Sandesha2Constants.SPEC_2005_10.NS_URI,
+//                                     
Sandesha2Constants.WSRM_COMMON.SEQUENCE));
+//
+//             if (sequenceElem != null)
+//                     rmGlobalMsg = true;
+
+
+               if 
(Sandesha2Constants.SPEC_2005_02.Actions.ACTION_CREATE_SEQUENCE.equals(action))
+                       rmGlobalMsg = true;
+
+               if 
(Sandesha2Constants.SPEC_2005_10.Actions.ACTION_CREATE_SEQUENCE.equals(action))
+                       rmGlobalMsg = true;
+
+//             if 
(Sandesha2Constants.SPEC_2005_10.Actions.ACTION_TERMINATE_SEQUENCE.equals(action))
+//                     rmGlobalMsg = true;
+//
+//             if 
(Sandesha2Constants.SPEC_2005_10.Actions.ACTION_CLOSE_SEQUENCE.equals(action))
+//                     rmGlobalMsg = true;
+
+               return rmGlobalMsg;
+       }
+       
        public static MessageContext 
createNewRelatedMessageContext(RMMsgContext referenceRMMessage, AxisOperation 
operation)
                        throws SandeshaException {
                try {
@@ -405,6 +450,16 @@
                        MessageContext newMessageContext = new MessageContext();
                        
newMessageContext.setConfigurationContext(configContext);
 
+//                     Options referenceMsgOptions = 
referenceMessage.getOptions();
+//                     Options newOptions = null;
+//                     if (referenceMsgOptions!=null)
+//                             newOptions = new Options (referenceMsgOptions);
+//                     else
+                       
+                       Options newOptions = new Options ();
+                       
+                       newMessageContext.setOptions(newOptions);
+                       
                        if (referenceMessage.getAxisServiceGroup() != null) {
                                
newMessageContext.setAxisServiceGroup(referenceMessage.getAxisServiceGroup());
                                
newMessageContext.setServiceGroupContext(referenceMessage.getServiceGroupContext());
@@ -826,7 +881,7 @@
                                SOAPFactory soapFactory = new SOAP11Factory();
 
                                builder = new StAXOMBuilder(xmlreader);
-                               builder.setOmbuilderFactory(soapFactory);
+                               builder.setOMBuilderFactory(soapFactory);
                                envelope = soapFactory.getDefaultEnvelope();
                                
envelope.getBody().addChild(builder.getDocumentElement());
 

Modified: 
webservices/sandesha/trunk/src/org/apache/sandesha2/workers/Sender.java
URL: 
http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/workers/Sender.java?rev=391249&r1=391248&r2=391249&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/workers/Sender.java 
(original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/workers/Sender.java Tue 
Apr  4 01:48:07 2006
@@ -22,6 +22,7 @@
 
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPFault;
 import org.apache.axiom.soap.SOAPHeader;
 import org.apache.axiom.soap.SOAPHeaderBlock;
 import org.apache.axis2.AxisFault;
@@ -328,7 +329,6 @@
                                
                                if (isFaultEnvelope(resenvelope)) {
                                        
engine.receiveFault(responseMessageContext);
-                                       System.out.println("Sender Got a 
fault");
                                }else {
                                        engine.receive(responseMessageContext);
                                }
@@ -358,23 +358,12 @@
                return false;
        }
        
-       private boolean isFaultEnvelope (SOAPEnvelope envelope) throws 
SandeshaException {
-               SOAPHeader header = envelope.getHeader();
-               
-               OMElement actionElement = header.getFirstChildWithName(new 
QName (AddressingConstants.Final.WSA_NAMESPACE,AddressingConstants.WSA_ACTION));
-               if (actionElement==null)
-                       actionElement = header.getFirstChildWithName(new QName 
(AddressingConstants.Submission.WSA_NAMESPACE,AddressingConstants.WSA_ACTION));
-               
-               String action = actionElement.getText().trim();
-               
-               if (action==null)
-                       throw new SandeshaException ("Given envelope does not 
contain a wsa:action");
-               
-               if (action.equals(AddressingConstants.Final.WSA_FAULT_ACTION)
-                               || 
action.equals("http://schemas.xmlsoap.org/ws/2004/08/addressing/fault";))
+       private boolean isFaultEnvelope (SOAPEnvelope envelope) throws 
SandeshaException {              
+               SOAPFault fault = envelope.getBody().getFault();
+               if (fault!=null)
                        return true;
-               
-               return false;
+               else
+                       return false;
        }
        
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to