Invokes the specified handler. If there's a fault the appropriate
key will be calculated and used to find the fault chain to be
invoked. This assumes that the workHandler has caught the exception
and already done its fault processing - as needed.
log.debug("Enter: FaultableHandler::invoke");
try {
workHandler.invoke( msgContext );
}
catch( Exception e ) {
entLog.info(Messages.getMessage("toAxisFault00"), e );
AxisFault fault = AxisFault.makeFault(e);
// AxisEngine engine = msgContext.getAxisEngine();
/** Index off fault code.
*
* !!! TODO: This needs to be able to handle searching by faultcode
* hierarchy, i.e. "Server.General.*" or "Server.*", with the
* most specific match winning.
*/
/*
QFault key = fault.getFaultCode() ;
Handler faultHandler = (Handler) faultHandlers.get( key );
*/
Handler faultHandler = null;
Hashtable options = getOptions();
if (options != null) {
Enumeration enumeration = options.keys();
while (enumeration.hasMoreElements()) {
String s = (String) enumeration.nextElement();
if (s.equals("fault-" + fault.getFaultCode().getLocalPart())) {
faultHandler = (Handler)options.get(s);
}
}
}
if ( faultHandler != null ) {
/** faultHandler will (re)throw if it's appropriate, but it
* might also eat the fault. Which brings up another issue -
* should we have a way to pass the Fault directly to the
* faultHandler? Maybe another well-known MessageContext
* property?
*/
faultHandler.invoke( msgContext );
} else {
throw fault;
}
}
log.debug("Exit: FaultableHandler::invoke");