XFire

Home
Bug/Issue Reporting
Download
FAQ
Get Involved
License
News
Performance
Stack Comparison
Support
Who uses XFire\?
XFire Team

Documentation

Javadocs
Reports
User's Guide
Release Notes

Quicklinks

Aegis Binding
Client
JAXB 2.0
JSR 181 Annotations
Spring

Developers

Developer Space
CVS
Building
Architecture
Interesting Projects
Roadmap
Release Process
JAX\-WS

Exceptions in Services

Any 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
}