NonStop SOAP for Java User's Manual
SOAP Deployment Descriptor
NonStop SOAP for Java User’s Manual—523860-001
4-8
Fault Handling
Fault Handling
Occasionally, an error occurs on the server side. It could be a bad service 
implementation, a bad client request, or normal operating difficulties. The SOAP 
specification provides for the communication of these errors through the transmittal of 
a SOAP Fault body element within a SOAP Envelope. The SOAP server tries to 
capture an error state and then construct a SOAP Fault message containing a base set 
of information about the error. To augment the fault information for a particular service 
or to perform one or more additional tasks when an error state arises, the SOAP server 
provides a pluggable fault-handling mechanism into which one or more fault listeners 
may be registered to process faults. (The pluggable fault-handling mechanism in 
Apache SOAP works on the event/listener model.). There are two basic fault-handlers: 
•
org.apache.soap.server.DOMFaultListener 
•
org.apache.soap.server.ExceptionFaultListner 
Both fault-handlers augment the SOAP Fault message with additional information 
about the fault; the first by adding a DOM element representing the root exception 
which occurred, and the second by wrapping the root exception in a parameter.
Registering Fault Handlers
Fault handlers are registered by including one or more <faultListener> elements within 
the deployment descriptor of a service. 
Creating New Fault Handlers
Writing a Java class which implements the 
org.apache.soap.server.SOAPFaultListener interface can create a new fault 
handler. The single method which one needs to implement, fault (), takes in a 
SOAPFaultEvent. The SOAPFaultEvent wraps the SOAP Fault and SOAP Exception 
objects that were created due to the error. Once the new fault-handler class is created, 
it has to be registered, see Registering Fault Handlers
.










