Author: objectiser
Date: 2009-11-06 09:09:50 -0500 (Fri, 06 Nov 2009)
New Revision: 247
Modified:
trunk/runtime/jbossesb-bpel/src/main/java/org/jboss/soa/esb/actions/bpel/BPELInvoke.java
trunk/samples/esb/bpel_loan_fault/jboss-esb.xml
trunk/samples/esb/bpel_loan_fault/src/org/jboss/soa/esb/samples/quickstart/loanfault/test/SendEsbMessage.java
Log:
BPEL Invoke fault handling and example working - although example test client has issue
because of incompatible versions of QName - still to be investigated.
Modified:
trunk/runtime/jbossesb-bpel/src/main/java/org/jboss/soa/esb/actions/bpel/BPELInvoke.java
===================================================================
---
trunk/runtime/jbossesb-bpel/src/main/java/org/jboss/soa/esb/actions/bpel/BPELInvoke.java 2009-11-06
13:44:23 UTC (rev 246)
+++
trunk/runtime/jbossesb-bpel/src/main/java/org/jboss/soa/esb/actions/bpel/BPELInvoke.java 2009-11-06
14:09:50 UTC (rev 247)
@@ -233,9 +233,12 @@
// Check if fault name should be set
if (faultName != null) {
+ logger.debug("Fault '"+faultName+"' detected, throwing
exception");
+
//ret.getFault().setReason(faultName.toString());
throw new
org.jboss.soa.esb.actions.ActionProcessingDetailFaultException(faultName,
- "Fault", respValue.toString());
+ "Fault '"+faultName+"' occurred when calling service
'"+serviceName+"'",
+ respValue.toString());
}
}
} catch(org.jboss.soa.esb.actions.ActionProcessingDetailFaultException fault) {
@@ -243,9 +246,13 @@
// Determine whether to abort action pipeline with exception or return
// fault message for continued processing
if (_config.getAttribute(ABORT_ON_FAULT,
"true").equalsIgnoreCase("true")) {
+ logger.debug("Rethrowing BPEL fault: "+fault);
+
throw fault;
} else {
ret = fault.getFaultMessage();
+
+ logger.debug("Returning fault as message: "+ret);
}
} catch(Exception e) {
Modified: trunk/samples/esb/bpel_loan_fault/jboss-esb.xml
===================================================================
--- trunk/samples/esb/bpel_loan_fault/jboss-esb.xml 2009-11-06 13:44:23 UTC (rev 246)
+++ trunk/samples/esb/bpel_loan_fault/jboss-esb.xml 2009-11-06 14:09:50 UTC (rev 247)
@@ -38,8 +38,12 @@
<action name="action2"
class="org.jboss.soa.esb.actions.bpel.BPELInvoke">
<property name="service"
value="{http://example.com/loan-approval/wsdl/}loanService"/>
<property name="operation" value="request"
/>
+ <property name="abortOnFault" value="true" />
</action>
- <!-- The next action is for Continuous Integration testing -->
+ <action name="action3"
class="org.jboss.soa.esb.actions.SystemPrintln">
+ <property name="printfull"
value="true"/>
+ </action>
+ <!-- The next action is for Continuous Integration testing -->
<action name="testStore"
class="org.jboss.soa.esb.actions.TestMessageStore"/>
</actions>
</service>
Modified:
trunk/samples/esb/bpel_loan_fault/src/org/jboss/soa/esb/samples/quickstart/loanfault/test/SendEsbMessage.java
===================================================================
---
trunk/samples/esb/bpel_loan_fault/src/org/jboss/soa/esb/samples/quickstart/loanfault/test/SendEsbMessage.java 2009-11-06
13:44:23 UTC (rev 246)
+++
trunk/samples/esb/bpel_loan_fault/src/org/jboss/soa/esb/samples/quickstart/loanfault/test/SendEsbMessage.java 2009-11-06
14:09:50 UTC (rev 247)
@@ -38,6 +38,8 @@
*/
public class SendEsbMessage
{
+ protected static final String BODY_FAULT_CODE =
"org.jboss.soa.esb.message.fault.detail.code";
+
public static void main(String args[]) throws Exception
{
// Setting the ConnectionFactory such that it will use scout
@@ -53,9 +55,14 @@
esbMessage.getBody().add(args[2]);
- Message respMessage = new ServiceInvoker(args[0],
args[1]).deliverSync(esbMessage, 5000);
+ try {
+ Message respMessage = new ServiceInvoker(args[0],
args[1]).deliverSync(esbMessage, 5000);
- System.out.println("REPLY: "+respMessage.getBody().get());
+ System.out.println("REPLY: "+respMessage.getBody().get());
+ } catch(org.jboss.soa.esb.couriers.FaultMessageException fme) {
+ System.out.println("FAULT:
"+fme.getReturnedMessage().getBody().get(BODY_FAULT_CODE));
+ System.out.println("FAULT ("+fme.getCode()+") MESSAGE:
"+fme.getReturnedMessage().getBody().get());
+ }
}
}