You are viewing a plain text version of this content. The canonical link for it is here.
Posted to sandesha-dev@ws.apache.org by ch...@apache.org on 2006/11/27 01:32:42 UTC
svn commit: r479476 - in
/webservices/sandesha/branches/sandesha2/java/1_1/src/org/apache/sandesha2:
handlers/SandeshaGlobalInHandler.java handlers/SandeshaInHandler.java
util/FaultManager.java util/SandeshaUtil.java
Author: chamikara
Date: Sun Nov 26 16:32:42 2006
New Revision: 479476
URL: http://svn.apache.org/viewvc?view=rev&rev=479476
Log:
Corrected the Fault processing logic to call the SandeshaListner if available.
Modified:
webservices/sandesha/branches/sandesha2/java/1_1/src/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java
webservices/sandesha/branches/sandesha2/java/1_1/src/org/apache/sandesha2/handlers/SandeshaInHandler.java
webservices/sandesha/branches/sandesha2/java/1_1/src/org/apache/sandesha2/util/FaultManager.java
webservices/sandesha/branches/sandesha2/java/1_1/src/org/apache/sandesha2/util/SandeshaUtil.java
Modified: webservices/sandesha/branches/sandesha2/java/1_1/src/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/branches/sandesha2/java/1_1/src/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java?view=diff&rev=479476&r1=479475&r2=479476
==============================================================================
--- webservices/sandesha/branches/sandesha2/java/1_1/src/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java (original)
+++ webservices/sandesha/branches/sandesha2/java/1_1/src/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java Sun Nov 26 16:32:42 2006
@@ -108,39 +108,6 @@
boolean rolebacked = false;
try {
- // 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) {
-
- // constructing the fault
- AxisFault axisFault = getAxisFaultFromFromSOAPFault(faultPart);
-
- //If this is a RM related fault. I.e. one that was defined in the WSRM spec. It will be
- //handled at this point.
- SOAPFaultCode faultCode = axisFault.getFaultCodeElement();
- SOAPFaultSubCode faultSubCode = faultCode!=null?faultCode.getSubCode():null;
- SOAPFaultValue faultSubcodeValue = faultSubCode!=null?faultSubCode.getValue():null;
- String subCodeText = faultSubcodeValue!=null?faultSubcodeValue.getText():null;
-
- if (subCodeText!=null && FaultManager.isRMFault(subCodeText)) {
- //handling the fault here and pausing the message.
-
- FaultManager faultManager = new FaultManager ();
- faultManager.manageIncomingRMFault (axisFault, msgContext);
-
- msgContext.pause();
- returnValue = InvocationResponse.SUSPEND;
- }
-
- }
// Quitting the message with minimum processing if not intended for
// RM.
@@ -358,13 +325,6 @@
public String getName() {
return Sandesha2Constants.GLOBAL_IN_HANDLER_NAME;
- }
-
- private AxisFault getAxisFaultFromFromSOAPFault(SOAPFault faultPart) {
- AxisFault axisFault = new AxisFault(faultPart.getCode(), faultPart.getReason(), faultPart.getNode(), faultPart
- .getRole(), faultPart.getDetail());
-
- return axisFault;
}
}
Modified: webservices/sandesha/branches/sandesha2/java/1_1/src/org/apache/sandesha2/handlers/SandeshaInHandler.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/branches/sandesha2/java/1_1/src/org/apache/sandesha2/handlers/SandeshaInHandler.java?view=diff&rev=479476&r1=479475&r2=479476
==============================================================================
--- webservices/sandesha/branches/sandesha2/java/1_1/src/org/apache/sandesha2/handlers/SandeshaInHandler.java (original)
+++ webservices/sandesha/branches/sandesha2/java/1_1/src/org/apache/sandesha2/handlers/SandeshaInHandler.java Sun Nov 26 16:32:42 2006
@@ -37,6 +37,7 @@
import org.apache.sandesha2.msgprocessors.UsesSequenceSTRProcessor;
import org.apache.sandesha2.storage.StorageManager;
import org.apache.sandesha2.storage.Transaction;
+import org.apache.sandesha2.util.FaultManager;
import org.apache.sandesha2.util.MsgInitializer;
import org.apache.sandesha2.util.SandeshaUtil;
@@ -119,6 +120,10 @@
log.debug(message);
throw new AxisFault(message);
}
+
+ //processing any incoming faults.
+ //This is responsible for Sandesha2 specific
+ FaultManager.processMessagesForFaults(msgCtx);
RMMsgContext rmMsgCtx = null;
try {
Modified: webservices/sandesha/branches/sandesha2/java/1_1/src/org/apache/sandesha2/util/FaultManager.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/branches/sandesha2/java/1_1/src/org/apache/sandesha2/util/FaultManager.java?view=diff&rev=479476&r1=479475&r2=479476
==============================================================================
--- webservices/sandesha/branches/sandesha2/java/1_1/src/org/apache/sandesha2/util/FaultManager.java (original)
+++ webservices/sandesha/branches/sandesha2/java/1_1/src/org/apache/sandesha2/util/FaultManager.java Sun Nov 26 16:32:42 2006
@@ -26,7 +26,9 @@
import org.apache.axiom.om.OMElement;
import org.apache.axiom.soap.SOAP11Constants;
import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axiom.soap.SOAPEnvelope;
import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFault;
import org.apache.axiom.soap.SOAPFaultCode;
import org.apache.axiom.soap.SOAPFaultDetail;
import org.apache.axiom.soap.SOAPFaultReason;
@@ -43,6 +45,7 @@
import org.apache.axis2.context.ServiceGroupContext;
import org.apache.axis2.description.AxisOperation;
import org.apache.axis2.description.AxisOperationFactory;
+import org.apache.axis2.engine.Handler.InvocationResponse;
import org.apache.axis2.util.Utils;
import org.apache.axis2.wsdl.WSDLConstants.WSDL20_2004Constants;
import org.apache.commons.logging.Log;
@@ -51,6 +54,8 @@
import org.apache.sandesha2.RMMsgContext;
import org.apache.sandesha2.Sandesha2Constants;
import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.client.SandeshaClientConstants;
+import org.apache.sandesha2.client.SandeshaListener;
import org.apache.sandesha2.i18n.SandeshaMessageHelper;
import org.apache.sandesha2.i18n.SandeshaMessageKeys;
import org.apache.sandesha2.storage.StorageManager;
@@ -483,12 +488,43 @@
}
- public void manageIncomingRMFault (AxisFault fault, MessageContext msgContext) {
+ private static void manageIncomingFault (AxisFault fault, MessageContext msgContext) {
+
+ if (log.isErrorEnabled())
+ log.error(fault);
+
+ SandeshaListener listner = (SandeshaListener) msgContext.getProperty(SandeshaClientConstants.SANDESHA_LISTENER);
+ if (listner!=null)
+ listner.onError(fault);
- //TODO implement code to handle the rm fault
+ }
+
+
+ public static void processMessagesForFaults (MessageContext msgContext) {
- log.error(fault);
+ SOAPEnvelope envelope = msgContext.getEnvelope();
+ if (envelope==null)
+ return;
+ SOAPFault faultPart = envelope.getBody().getFault();
+
+ if (faultPart != null) {
+
+ // constructing the fault
+ AxisFault axisFault = getAxisFaultFromFromSOAPFault(faultPart);
+ manageIncomingFault (axisFault, msgContext);
+
+
+ }
+
}
+
+ private static AxisFault getAxisFaultFromFromSOAPFault(SOAPFault faultPart) {
+ AxisFault axisFault = new AxisFault(faultPart.getCode(), faultPart.getReason(), faultPart.getNode(), faultPart
+ .getRole(), faultPart.getDetail());
+
+ return axisFault;
+ }
+
}
Modified: webservices/sandesha/branches/sandesha2/java/1_1/src/org/apache/sandesha2/util/SandeshaUtil.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/branches/sandesha2/java/1_1/src/org/apache/sandesha2/util/SandeshaUtil.java?view=diff&rev=479476&r1=479475&r2=479476
==============================================================================
--- webservices/sandesha/branches/sandesha2/java/1_1/src/org/apache/sandesha2/util/SandeshaUtil.java (original)
+++ webservices/sandesha/branches/sandesha2/java/1_1/src/org/apache/sandesha2/util/SandeshaUtil.java Sun Nov 26 16:32:42 2006
@@ -1118,7 +1118,7 @@
Boolean isTransportNonBlocking = (Boolean) msgContext.getProperty(MessageContext.TRANSPORT_NON_BLOCKING);
if (isTransportNonBlocking!=null && isTransportNonBlocking.booleanValue()==true)
- msgContext.setProperty(MessageContext.TRANSPORT_NON_BLOCKING, new Boolean (false));
+ msgContext.setProperty(MessageContext.TRANSPORT_NON_BLOCKING, Boolean.FALSE);
engine.send(msgContext);
---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org