XFireHome DocumentationJavadocs QuicklinksAegis Binding DevelopersDeveloper Space |
Exceptions in ServicesAny non-runtime exception that is thrown by a service will eventually be caught by XFire and turned into a Fault. The fault is created by the static method XFireFault.createFault(Exception e). If a fault occurrs, all the handlers that been executed will have their handleFault() method executed in the order reverse of execution. When a fault occurs, the fault pipeline is invoked. This is created from the service's fault handlers, the transport's fault handlers, and the global fault handlers. To add a handler to the fault pipeline you would do something like so: Service myService = ...;
myService.addFaultHandler(new MyFaultHandler());
Inside your FaultHandler you may want to get ahold of the fault. This can be done like so: public void invoke(MessageContext context) throws Exception { XFireFault fault = (XFireFault) context.getExchange().getFaultMessage().getBody(); ... do something with the fault } |