Fault policy Java action in 11g
Oracle SOA Suite 11g makes it possible to use fault policies in order to catch and act on certain types of errors. This can be very useful and if the built-in actions are not enough it is possible to write custom actions in Java. See How to Use a Java Action Fault Policy in the Developer’s Guide.
Both the documentation and the API has room for improvement, though.
The documentation helpfully records that IFaultRecoveryJavaClass needs fabric-runtime.jar, but it fails to mention that orabpel.jar is needed as well for IBPELFaultRecoveryContext. Unfortunately the plain IFaultRecoveryContext interface is so limited that it is almost useless. It doesn’t even provide access to the fault. In order to be of use the context must be cast into a IBPELFaultRecoveryContext (for BPEL faults).
IFaultRecoveryContext does include a method named getProperties that returns the property set for the fault policy action. Does it return a Properties object? No, it returns a raw Map. Oh well, but surely it is a map from String to String? Same thing, right? Wrong. It returns a map from String to ArrayList. As nothing is documented I found that out with trial and error. Typically the first element in the list can be cast into a String and used.
Finally the documentation uses elements named ReturnValue in the fault policy, but the implementation uses returnValue.