Return-Path: Delivered-To: apmail-ws-axis-cvs-archive@www.apache.org Received: (qmail 42879 invoked from network); 9 Mar 2006 10:25:50 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 9 Mar 2006 10:25:50 -0000 Received: (qmail 12634 invoked by uid 500); 9 Mar 2006 10:25:29 -0000 Delivered-To: apmail-ws-axis-cvs-archive@ws.apache.org Received: (qmail 12445 invoked by uid 500); 9 Mar 2006 10:25:28 -0000 Mailing-List: contact axis-cvs-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-cvs@ws.apache.org Received: (qmail 12434 invoked by uid 500); 9 Mar 2006 10:25:28 -0000 Delivered-To: apmail-ws-axis2-cvs@ws.apache.org Received: (qmail 12431 invoked by uid 99); 9 Mar 2006 10:25:28 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Mar 2006 02:25:28 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 09 Mar 2006 02:25:27 -0800 Received: (qmail 42512 invoked by uid 65534); 9 Mar 2006 10:24:55 -0000 Message-ID: <20060309102455.42511.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r384482 - /webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java Date: Thu, 09 Mar 2006 10:24:54 -0000 To: axis2-cvs@ws.apache.org From: chinthaka@apache.org X-Mailer: svnmailer-1.0.7 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: chinthaka Date: Thu Mar 9 02:24:52 2006 New Revision: 384482 URL: http://svn.apache.org/viewcvs?rev=384482&view=rev Log: If a fault is due to a fault, we can send the fault message to the faultTo EPR (Hope one can understand that statement ;)). So in that case, ignoring the faultTo epr and trying other options (replyTo or output stream.) Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java?rev=384482&r1=384481&r2=384482&view=diff ============================================================================== --- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java (original) +++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java Thu Mar 9 02:24:52 2006 @@ -35,11 +35,21 @@ import org.apache.ws.commons.om.OMAbstractFactory; import org.apache.ws.commons.om.OMElement; import org.apache.ws.commons.om.OMNamespace; -import org.apache.ws.commons.soap.*; +import org.apache.ws.commons.soap.SOAP11Constants; +import org.apache.ws.commons.soap.SOAP12Constants; +import org.apache.ws.commons.soap.SOAPConstants; +import org.apache.ws.commons.soap.SOAPEnvelope; +import org.apache.ws.commons.soap.SOAPFault; +import org.apache.ws.commons.soap.SOAPFaultCode; +import org.apache.ws.commons.soap.SOAPFaultDetail; +import org.apache.ws.commons.soap.SOAPFaultReason; +import org.apache.ws.commons.soap.SOAPHeaderBlock; +import org.apache.ws.commons.soap.SOAPProcessingException; import javax.xml.namespace.QName; import java.util.ArrayList; import java.util.Iterator; +import java.util.Map; /** * There is one engine for the Server and the Client. the send() and receive() @@ -153,7 +163,8 @@ processingContext.getProperty(MessageContext.CHARACTER_SET_ENCODING)); // register the fault message context - if (processingContext.getAxisOperation() != null && processingContext.getOperationContext() != null) { + if (processingContext.getAxisOperation() != null && processingContext.getOperationContext() != null) + { processingContext.getAxisOperation().addFaultMessageContext(faultContext, processingContext.getOperationContext()); } @@ -165,10 +176,20 @@ faultContext.setProperty(Constants.FAULT_INFORMATION_FOR_HEADERS, faultInfoForHeaders); } + // if the exception is due to a problem in the faultTo header itself, we can not use those + // fault informatio to send the error. Try to send using replyTo, leave it to transport + boolean doNotSendFaultUsingFaultTo = false; + if (faultInfoForHeaders != null) { + String problemHeaderName = (String) ((Map) faultInfoForHeaders).get(AddressingConstants.Final.FAULT_HEADER_PROB_HEADER_QNAME); + doNotSendFaultUsingFaultTo = (problemHeaderName != null && (AddressingConstants.WSA_DEFAULT_PREFIX + ":" + AddressingConstants.WSA_FAULT_TO).equals(problemHeaderName)); + } + EndpointReference faultTo = processingContext.getFaultTo(); - if (faultTo != null) { + if (faultTo != null && !doNotSendFaultUsingFaultTo) { faultContext.setTo(processingContext.getFaultTo()); - } else if (processingContext.getEnvelope().getHeader() != null && processingContext.getEnvelope().getHeader().getFirstChildWithName(new QName("FaultTo")) != null) { + } else + if (!doNotSendFaultUsingFaultTo && processingContext.getEnvelope().getHeader() != null && processingContext.getEnvelope().getHeader().getFirstChildWithName(new QName("FaultTo")) != null) + { OMElement faultToElement = processingContext.getEnvelope().getHeader().getFirstChildWithName(new QName("FaultTo")); faultTo = new EndpointReference(""); faultTo.fromOM(faultToElement); @@ -278,7 +299,9 @@ fault.setCode((SOAPFaultCode) faultCode); } else if (soapException != null) { soapFaultCode = soapException.getFaultCode(); - } else if (((exception = e) instanceof AxisFault || (exception = e.getCause()) instanceof AxisFault)) { + } else + if (((exception = e) instanceof AxisFault || (exception = e.getCause()) instanceof AxisFault)) + { QName faultCodeQName = ((AxisFault) exception).getFaultCode(); if (faultCodeQName != null) { if (faultCodeQName.getLocalPart().indexOf(":") == -1) { @@ -308,7 +331,9 @@ message = fault.getReason().getSOAPText().getText(); } else if (soapException != null) { message = soapException.getMessage(); - } else if (((exception = e) instanceof AxisFault || (exception = e.getCause()) instanceof AxisFault)) { + } else + if (((exception = e) instanceof AxisFault || (exception = e.getCause()) instanceof AxisFault)) + { message = ((AxisFault) exception).getReason(); message = message != null && "".equals(message) ? message : e.getMessage();