Index: modules/rampart-core/src/main/java/org/apache/rampart/handler/WSDoAllHandler.java
===================================================================
--- modules/rampart-core/src/main/java/org/apache/rampart/handler/WSDoAllHandler.java	(revision 141099)
+++ modules/rampart-core/src/main/java/org/apache/rampart/handler/WSDoAllHandler.java	(working copy)
@@ -68,10 +68,54 @@
     public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {
         //If the security module is not engaged for this service
         //do not do any processing
-        if (msgContext.isEngaged(WSSHandlerConstants.SECURITY_MODULE_NAME)) {
+        //check in in/out message contexts
+        if (msgContext.getProperty(WSSHandlerConstants.RAMPART_ENGAGED) == null) {
+            //check if operation context & its in-message context exist (doesn't exist for soap fault)
+            //when this is invoked in the out flow.
+            if (msgContext.getOperationContext() != null &&
+                msgContext.getOperationContext().getProperty("In") != null) {
+                if (msgContext.getOperationContext().getMessageContext("In").getProperty(
+                        WSSHandlerConstants.RAMPART_ENGAGED) == null) {
+
+                    if (!msgContext.isEngaged(WSSHandlerConstants.SECURITY_MODULE_NAME)) {
+                        msgContext.setProperty(WSSHandlerConstants.RAMPART_ENGAGED, "false");
+
+                    } else {
+                        msgContext.setProperty(WSSHandlerConstants.RAMPART_ENGAGED, "true");
+                        this.processMessage(msgContext);
+                    }
+                } else {
+                    String isEngaged = (String) msgContext.getOperationContext().
+                            getMessageContext("In").getProperty(WSSHandlerConstants.RAMPART_ENGAGED);
+                    if (!Boolean.parseBoolean(isEngaged)) {
+                        msgContext.setProperty(WSSHandlerConstants.RAMPART_ENGAGED, "false");
+                        
+                    } else {
+                        msgContext.setProperty(WSSHandlerConstants.RAMPART_ENGAGED, "true");
+                        this.processMessage(msgContext);
+                    }
+                }
+            } else {
+                if (!msgContext.isEngaged(WSSHandlerConstants.SECURITY_MODULE_NAME)) {
+                    msgContext.setProperty(WSSHandlerConstants.RAMPART_ENGAGED, "false");
+
+                } else {
+                    msgContext.setProperty(WSSHandlerConstants.RAMPART_ENGAGED, "true");
+                    this.processMessage(msgContext);
+                }
+            }
+        } else {
+            String isEngaged = (String) msgContext.getProperty(WSSHandlerConstants.RAMPART_ENGAGED);
+            if (Boolean.parseBoolean(isEngaged)) {
+                this.processMessage(msgContext);
+            }
+        }
+        return InvocationResponse.CONTINUE;
+        
+        /*if (msgContext.isEngaged(WSSHandlerConstants.SECURITY_MODULE_NAME)) {
             this.processMessage(msgContext);
         }
-        return InvocationResponse.CONTINUE;        
+        return InvocationResponse.CONTINUE;*/
     }
 
     public void flowComplete(MessageContext msgContext)
Index: modules/rampart-core/src/main/java/org/apache/rampart/handler/PostDispatchVerificationHandler.java
===================================================================
--- modules/rampart-core/src/main/java/org/apache/rampart/handler/PostDispatchVerificationHandler.java	(revision 141099)
+++ modules/rampart-core/src/main/java/org/apache/rampart/handler/PostDispatchVerificationHandler.java	(working copy)
@@ -95,10 +95,24 @@
      */
     public InvocationResponse invoke(MessageContext msgContext)
             throws AxisFault {
-        
-        if (!msgContext.isEngaged(WSSHandlerConstants.SECURITY_MODULE_NAME)) {
+        //check if rampart is engaged
+        if (msgContext.getProperty(WSSHandlerConstants.RAMPART_ENGAGED) == null) {
+            if (!msgContext.isEngaged(WSSHandlerConstants.SECURITY_MODULE_NAME)) {
+                msgContext.setProperty(WSSHandlerConstants.RAMPART_ENGAGED, "false");
+                return InvocationResponse.CONTINUE;
+
+            } else {
+                msgContext.setProperty(WSSHandlerConstants.RAMPART_ENGAGED, "true");
+            }
+        } else {
+            String isEngaged = (String) msgContext.getProperty(WSSHandlerConstants.RAMPART_ENGAGED);
+            if (!Boolean.parseBoolean(isEngaged)) {
+                return InvocationResponse.CONTINUE;
+            }
+        }
+        /*if (!msgContext.isEngaged(WSSHandlerConstants.SECURITY_MODULE_NAME)) {
           return InvocationResponse.CONTINUE;
-        }
+        }*/
 
         Policy policy = msgContext.getEffectivePolicy();
 
Index: modules/rampart-core/src/main/java/org/apache/rampart/handler/RampartSender.java
===================================================================
--- modules/rampart-core/src/main/java/org/apache/rampart/handler/RampartSender.java	(revision 141099)
+++ modules/rampart-core/src/main/java/org/apache/rampart/handler/RampartSender.java	(working copy)
@@ -54,10 +54,51 @@
     }
 
     public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {
+        //check if rampart is engaged
+        //check in the out-message context
+        if (msgContext.getProperty(WSSHandlerConstants.RAMPART_ENGAGED) == null) {
+            //check if operation context & its in-message context exist (doesn't exist for soap fault)
+            if (msgContext.getOperationContext() != null &&
+                msgContext.getOperationContext().getProperty("In") != null) {
+                //check in in-message context
+                if (msgContext.getOperationContext().getMessageContext("In").getProperty(
+                        WSSHandlerConstants.RAMPART_ENGAGED) == null) {
+                    //check if module engaged
+                    if (!msgContext.isEngaged(WSSHandlerConstants.SECURITY_MODULE_NAME)) {
+                        msgContext.setProperty(WSSHandlerConstants.RAMPART_ENGAGED, "false");
+                        return InvocationResponse.CONTINUE;
 
-        if (!msgContext.isEngaged(WSSHandlerConstants.SECURITY_MODULE_NAME)) {
+                    } else {
+                        msgContext.setProperty(WSSHandlerConstants.RAMPART_ENGAGED, "true");
+                    }
+                } else {
+                    String isEngaged = (String) msgContext.getOperationContext().
+                            getMessageContext("In").getProperty(WSSHandlerConstants.RAMPART_ENGAGED);
+                    if (!Boolean.parseBoolean(isEngaged)) {
+                        msgContext.setProperty(WSSHandlerConstants.RAMPART_ENGAGED, "false");
+                        return InvocationResponse.CONTINUE;
+                    } else {
+                        msgContext.setProperty(WSSHandlerConstants.RAMPART_ENGAGED, "true");
+                    }
+                }
+            } else {
+                if (!msgContext.isEngaged(WSSHandlerConstants.SECURITY_MODULE_NAME)) {
+                    msgContext.setProperty(WSSHandlerConstants.RAMPART_ENGAGED, "false");
+                    return InvocationResponse.CONTINUE;
+
+                } else {
+                    msgContext.setProperty(WSSHandlerConstants.RAMPART_ENGAGED, "true");
+                }
+            }
+        } else {
+            String isEngaged = (String) msgContext.getProperty(WSSHandlerConstants.RAMPART_ENGAGED);
+            if (!Boolean.parseBoolean(isEngaged)) {
+                return InvocationResponse.CONTINUE;
+            }
+        }
+        /*if (!msgContext.isEngaged(WSSHandlerConstants.SECURITY_MODULE_NAME)) {
             return InvocationResponse.CONTINUE;
-        }
+        }*/
 
 
         MessageBuilder builder = new MessageBuilder();
Index: modules/rampart-core/src/main/java/org/apache/rampart/handler/WSSHandlerConstants.java
===================================================================
--- modules/rampart-core/src/main/java/org/apache/rampart/handler/WSSHandlerConstants.java	(revision 141099)
+++ modules/rampart-core/src/main/java/org/apache/rampart/handler/WSSHandlerConstants.java	(working copy)
@@ -151,5 +151,7 @@
     
     public final static String WST_NS = "http://schemas.xmlsoap.org/ws/2005/02/trust";
     public static final String REQUEST_SECURITY_TOKEN_RESPONSE_LN = "RequestSecurityTokenResponse";
-    
+
+    public static final String RAMPART_ENGAGED = "rampart_engaged";
+
 }
Index: modules/rampart-core/src/main/java/org/apache/rampart/handler/RampartReceiver.java
===================================================================
--- modules/rampart-core/src/main/java/org/apache/rampart/handler/RampartReceiver.java	(revision 141099)
+++ modules/rampart-core/src/main/java/org/apache/rampart/handler/RampartReceiver.java	(working copy)
@@ -47,23 +47,23 @@
 
 /**
  * Rampart inflow handler.
- * This processes the incoming message and validates it against the effective 
+ * This processes the incoming message and validates it against the effective
  * policy.
  */
 public class RampartReceiver implements Handler {
-	
+
     private static Log mlog = LogFactory.getLog(RampartConstants.MESSAGE_LOG);
-	
+
     private static HandlerDescription EMPTY_HANDLER_METADATA =
         new HandlerDescription("default Handler");
 
     private HandlerDescription handlerDesc;
-    
+
     public RampartReceiver() {
         this.handlerDesc = EMPTY_HANDLER_METADATA;
     }
-    
-    public void cleanup() {        
+
+    public void cleanup() {
     }
 
     public void init(HandlerDescription handlerdesc) {
@@ -72,37 +72,49 @@
 
     public void flowComplete(MessageContext msgContext)
     {
-    	
+
     }
 
     public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {
-        
-        if (!msgContext.isEngaged(WSSHandlerConstants.SECURITY_MODULE_NAME)) {
-          return InvocationResponse.CONTINUE;        
+        //check if rampart is engaged
+        if (msgContext.getProperty(WSSHandlerConstants.RAMPART_ENGAGED) == null) {
+            if (!msgContext.isEngaged(WSSHandlerConstants.SECURITY_MODULE_NAME)) {
+                msgContext.setProperty(WSSHandlerConstants.RAMPART_ENGAGED, "false");
+                return InvocationResponse.CONTINUE;
+
+            } else {
+                msgContext.setProperty(WSSHandlerConstants.RAMPART_ENGAGED, "true");
+            }
+        } else {
+            String isEngaged = (String) msgContext.getProperty(WSSHandlerConstants.RAMPART_ENGAGED);
+            if (!Boolean.parseBoolean(isEngaged)) {
+                return InvocationResponse.CONTINUE;
+            }
         }
-        
+
+
         if(mlog.isDebugEnabled()){
         	mlog.debug("*********************** RampartReceiver received \n"
                     + msgContext.getEnvelope());
         }
-        
+
         RampartEngine engine = new RampartEngine();
         Vector wsResult = null;
         try {
             wsResult = engine.process(msgContext);
-            
+
         } catch (WSSecurityException e) {
             setFaultCodeAndThrowAxisFault(msgContext, e);
         } catch (WSSPolicyException e) {
             setFaultCodeAndThrowAxisFault(msgContext, e);
         } catch (RampartException e) {
             setFaultCodeAndThrowAxisFault(msgContext, e);
-        } 
-        
+        }
+
         if(wsResult == null) {
-          return InvocationResponse.CONTINUE;        
+          return InvocationResponse.CONTINUE;
         }
-        
+
         Vector results = null;
         if ((results = (Vector) msgContext
                 .getProperty(WSHandlerConstants.RECV_RESULTS)) == null) {
@@ -111,7 +123,7 @@
         }
         WSHandlerResult rResult = new WSHandlerResult("", wsResult);
         results.add(0, rResult);
-        
+
         SOAPHeader header = null;
         try {
             header = msgContext.getEnvelope().getHeader();
@@ -137,12 +149,12 @@
         if(headerBlock != null) {
             headerBlock.setProcessed();
         }
-        
-        return InvocationResponse.CONTINUE;        
 
+        return InvocationResponse.CONTINUE;
+
     }
 
-    
+
     public HandlerDescription getHandlerDesc() {
         return this.handlerDesc;
     }
@@ -154,18 +166,18 @@
     public Parameter getParameter(String name) {
         return this.handlerDesc.getParameter(name);
     }
-    
+
     private void setFaultCodeAndThrowAxisFault(MessageContext msgContext, Exception e) throws AxisFault {
-        
-        msgContext.setProperty(RampartConstants.SEC_FAULT, Boolean.TRUE);    
+
+        msgContext.setProperty(RampartConstants.SEC_FAULT, Boolean.TRUE);
         String soapVersionURI =  msgContext.getEnvelope().getNamespace().getNamespaceURI();
         QName faultCode = null;
         /*
          * Get the faultCode from the thrown WSSecurity exception, if there is one
          */
         if (e instanceof WSSecurityException)
-        {        	
-        	faultCode = ((WSSecurityException)e).getFaultCode(); 
+        {
+        	faultCode = ((WSSecurityException)e).getFaultCode();
         }
         /*
          * Otherwise default to InvalidSecurity
@@ -174,19 +186,19 @@
         {
         	faultCode = new QName(WSConstants.INVALID_SECURITY.getNamespaceURI(),WSConstants.INVALID_SECURITY.getLocalPart(),"wsse");
         }
-        
+
         if (soapVersionURI.equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI) ) {
-            
+
             throw new AxisFault(faultCode,e.getMessage(),e);
-                            
+
         } else if (soapVersionURI.equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI)) {
-            
+
             List subfaultCodes = new ArrayList();
             subfaultCodes.add(faultCode);
             throw new AxisFault(Constants.FAULT_SOAP12_SENDER,subfaultCodes,e.getMessage(),e);
-        
-        }        
-        
+
+        }
+
     }
 
 }
Index: pom.xml
===================================================================
--- pom.xml	(revision 141099)
+++ pom.xml	(working copy)
@@ -461,7 +461,7 @@
         <axis2.version>1.6.1-wso2v5</axis2.version>
         <axiom.version>1.2.11-wso2v2</axiom.version>
 
-        <wss4j.version>1.5.11-wso2v4</wss4j.version>
+        <wss4j.version>1.5.11-wso2v5</wss4j.version>
         <xmlsec.version>1.4.2</xmlsec.version>
         <opensaml.version>1.1</opensaml.version>
 
