Author: objectiser
Date: 2009-11-09 08:47:01 -0500 (Mon, 09 Nov 2009)
New Revision: 253
Modified:
trunk/integration-tests/src/test/java/org/jboss/soa/bpel/tests/samples/QuickstartESBBPELLoanFaultTestCase.java
trunk/runtime/jbossesb-bpel/src/main/java/org/jboss/soa/esb/actions/bpel/BPELInvoke.java
trunk/samples/esb/bpel_loan_fault/build.xml
trunk/samples/esb/bpel_loan_fault/src/org/jboss/soa/esb/samples/quickstart/loanfault/test/SendEsbMessage.java
Log:
Fix for RIFTSAW-110 - added server lib/endorsed to ant script to enable quickstart to
work. Issue is that stax-api.jar contains QName which conflicts with the default one
supplied with the jdk. In case not practical for client to add this endorsed lib folder,
then have also added additional body part in the ESB message containing a textual
representation of the fault type.
Modified:
trunk/integration-tests/src/test/java/org/jboss/soa/bpel/tests/samples/QuickstartESBBPELLoanFaultTestCase.java
===================================================================
---
trunk/integration-tests/src/test/java/org/jboss/soa/bpel/tests/samples/QuickstartESBBPELLoanFaultTestCase.java 2009-11-09
11:22:51 UTC (rev 252)
+++
trunk/integration-tests/src/test/java/org/jboss/soa/bpel/tests/samples/QuickstartESBBPELLoanFaultTestCase.java 2009-11-09
13:47:01 UTC (rev 253)
@@ -33,6 +33,7 @@
private static final String TEST_NAME = "Quickstart_esb_bpel_loan_fault";
protected static final String BODY_FAULT_CODE =
"org.jboss.soa.esb.message.fault.detail.code";
+ protected static final String BODY_BPEL_FAULT_CODE =
"org.jboss.soa.bpel.message.fault.detail.code";
protected static final String BODY_FAULT_MESSAGE =
"org.jboss.soa.esb.message.fault.detail.detail";
public QuickstartESBBPELLoanFaultTestCase() {
@@ -54,10 +55,11 @@
} catch(org.jboss.soa.esb.couriers.FaultMessageException fme) {
assertMessage((String)fme.getReturnedMessage().getBody().get(BODY_FAULT_MESSAGE),
- "<message><errorCode><integer
xmlns=\"http://example.com/loan-approval/xsd/error-messages/\"&...);
+ "<message><errorCode><integer
xmlns=\"http://example.com/loan-approval/xsd/error-messages/\"&...);
+
+ assertMessage((String)fme.getReturnedMessage().getBody().get(BODY_BPEL_FAULT_CODE),
+ "{http://example.com/loan-approval/wsdl/}unableToHandleRequest");
- //System.out.println("FAULT:
"+fme.getReturnedMessage().getBody().get(BODY_FAULT_CODE));
-
} catch(Exception e) {
fail("Test failed with exception: "+e);
}
@@ -73,9 +75,10 @@
} catch(org.jboss.soa.esb.couriers.FaultMessageException fme) {
assertMessage((String)fme.getReturnedMessage().getBody().get(BODY_FAULT_MESSAGE),
- "<message><errorCode><integer
xmlns=\"http://example.com/loan-approval/xsd/error-messages/\"&...);
+ "<message><errorCode><integer
xmlns=\"http://example.com/loan-approval/xsd/error-messages/\"&...);
- //System.out.println("FAULT:
"+fme.getReturnedMessage().getBody().get(BODY_FAULT_CODE));
+ assertMessage((String)fme.getReturnedMessage().getBody().get(BODY_BPEL_FAULT_CODE),
+ "{http://example.com/loan-approval/wsdl/}unableToHandleRequest");
} catch(Exception e) {
fail("Test failed with exception: "+e);
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-09
11:22:51 UTC (rev 252)
+++
trunk/runtime/jbossesb-bpel/src/main/java/org/jboss/soa/esb/actions/bpel/BPELInvoke.java 2009-11-09
13:47:01 UTC (rev 253)
@@ -51,6 +51,7 @@
protected static final String ABORT_ON_FAULT = "abortOnFault";
protected static final String BODY_FAULT_CODE =
"org.jboss.soa.esb.message.fault.detail.code";
+ protected static final String BODY_BPEL_FAULT_CODE =
"org.jboss.soa.bpel.message.fault.detail.code";
protected ConfigTree _config;
private static BPELEngine _bpelEngine;
@@ -256,6 +257,13 @@
// In case we wanted to return the fault message as the message body
//faultException.getFaultMessage().getBody().add(respValue.toString());
+ // Record string representation of faultName, as currently if the client
+ // does not include the stax-api.jar in its list of endorsed libs (as the
+ // JBoss AS server does, then it will result in a class version issue when
+ // it tries to retrieve the ESB fault code (which is transferred as a QName).
+ // See RIFTSAW-110 for more details.
+ faultException.getFaultMessage().getBody().add(BODY_BPEL_FAULT_CODE,
faultName.toString());
+
throw faultException;
}
}
Modified: trunk/samples/esb/bpel_loan_fault/build.xml
===================================================================
--- trunk/samples/esb/bpel_loan_fault/build.xml 2009-11-09 11:22:51 UTC (rev 252)
+++ trunk/samples/esb/bpel_loan_fault/build.xml 2009-11-09 13:47:01 UTC (rev 253)
@@ -12,6 +12,7 @@
description="Will send an esb Message">
<echo>Runs Test ESB Message Sender</echo>
<java fork="yes"
classname="org.jboss.soa.esb.samples.quickstart.loanfault.test.SendEsbMessage"
failonerror="true">
+ <jvmarg
value="-Djava.endorsed.dirs=${org.jboss.esb.server.home}/lib/endorsed"/>
<arg value="LoanFaultBPELESB"/> <!-- service category -->
<arg value="LoanFail"/> <!-- service name -->
<arg
value="<request><firstName>Jane</firstName><name>Bloggs</name><amount>0</amount></request>"/>
<!-- Message text -->
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-09
11:22:51 UTC (rev 252)
+++
trunk/samples/esb/bpel_loan_fault/src/org/jboss/soa/esb/samples/quickstart/loanfault/test/SendEsbMessage.java 2009-11-09
13:47:01 UTC (rev 253)
@@ -38,11 +38,13 @@
*/
public class SendEsbMessage
{
- protected static final String BODY_FAULT_CODE =
"org.jboss.soa.esb.message.fault.detail.code";
+ protected static final String ESB_FAULT_CODE =
"org.jboss.soa.esb.message.fault.detail.code";
+ protected static final String BPEL_FAULT_CODE =
"org.jboss.soa.bpel.message.fault.detail.code";
+ protected static final String FAULT_MESSAGE =
"org.jboss.soa.esb.message.fault.detail.detail";
public static void main(String args[]) throws Exception
{
-// Setting the ConnectionFactory such that it will use scout
+ // Setting the ConnectionFactory such that it will use scout
System.setProperty("javax.xml.registry.ConnectionFactoryClass","org.apache.ws.scout.registry.ConnectionFactoryImpl");
if (args.length < 3)
@@ -55,14 +57,15 @@
esbMessage.getBody().add(args[2]);
- try {
- 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());
- } 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());
- }
+ System.out.println("REPLY: "+respMessage.getBody().get());
+ } catch(org.jboss.soa.esb.couriers.FaultMessageException fme) {
+ System.out.println("FAULT TYPE (AS QNAME):
"+fme.getReturnedMessage().getBody().get(ESB_FAULT_CODE));
+ System.out.println("FAULT TYPE (AS STRING):
"+fme.getReturnedMessage().getBody().get(BPEL_FAULT_CODE));
+ System.out.println("FAULT MESSAGE:
"+fme.getReturnedMessage().getBody().get(FAULT_MESSAGE));
+ }
}
}