org.codehaus.xfire.fault
Class XFireFault

java.lang.Object
  |
  +--java.lang.Throwable
        |
        +--java.lang.Exception
              |
              +--org.codehaus.xfire.fault.XFireFault
All Implemented Interfaces:
java.io.Serializable

public class XFireFault
extends java.lang.Exception

In XFire, applications throw their own declared exceptions which are then turned into faults. The XFireFault class wraps these exceptions extracting out the details for the fault message.

If the developer wishes to generate their own custom fault messages, they can either override XFireFault to provide the FaultHandlers with the necessary information or write a new FaultHandler.

TODO Add i18n support

Since:
Feb 14, 2004
Author:
Dan Diephouse
See Also:
Serialized Form

Field Summary
static java.lang.String DATA_ENCODING_UNKNOWN
           
static java.lang.String MUST_UNDERSTAND
           
static java.lang.String RECEIVER
          "The message could not be processed for reasons attributable to the processing of the message rather than to the contents of the message itself." -- SOAP 1.2 Spec
static java.lang.String SENDER
          "The message was incorrectly formed or did not contain the appropriate information in order to succeed." -- SOAP 1.2 Spec
static java.lang.String VERSION_MISMATCH
          Fault codes.
 
Fields inherited from class java.lang.Exception
 
Constructor Summary
XFireFault(java.lang.Exception exception)
          Create a fault for the specified exception.
XFireFault(java.lang.Exception exception, java.lang.String code)
          Create a fault with the specified faultCode.
XFireFault(java.lang.String message, java.lang.Exception exception, java.lang.String code)
          Create a fault.
XFireFault(java.lang.String message, java.lang.String code)
          Create an exception wih the specified fault message and faultCode.
 
Method Summary
static XFireFault createFault(java.lang.Exception e)
           
 java.lang.String getCode()
           
 java.util.List getDetail()
          A list of Element's that provide the message detail.
 java.lang.String getReason()
           
 org.w3c.dom.Element getSubCode()
          Returns the SubCode for the Fault Code.
 void setDetail(java.util.List detail)
           
 void setSubCode(org.w3c.dom.Element subCode)
           
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

VERSION_MISMATCH

public static final java.lang.String VERSION_MISMATCH
Fault codes.

See Also:
Constant Field Values

MUST_UNDERSTAND

public static final java.lang.String MUST_UNDERSTAND
See Also:
Constant Field Values

DATA_ENCODING_UNKNOWN

public static final java.lang.String DATA_ENCODING_UNKNOWN
See Also:
Constant Field Values

SENDER

public static final java.lang.String SENDER
"The message was incorrectly formed or did not contain the appropriate information in order to succeed." -- SOAP 1.2 Spec

See Also:
Constant Field Values

RECEIVER

public static final java.lang.String RECEIVER
"The message could not be processed for reasons attributable to the processing of the message rather than to the contents of the message itself." -- SOAP 1.2 Spec

See Also:
Constant Field Values
Constructor Detail

XFireFault

public XFireFault(java.lang.String message,
                  java.lang.Exception exception,
                  java.lang.String code)
Create a fault.

Parameters:
exception - The exception which caused this fault.
code - The fault code. See XFireFault's static fields.

XFireFault

public XFireFault(java.lang.Exception exception)
Create a fault for the specified exception. The faultCode is set to RECEIVER.

Parameters:
exception -

XFireFault

public XFireFault(java.lang.Exception exception,
                  java.lang.String code)
Create a fault with the specified faultCode. The exception message is used for the fault message.

Parameters:
exception - The exception that caused this fault.
code - The fault code. See XFireFault's static fields.

XFireFault

public XFireFault(java.lang.String message,
                  java.lang.String code)
Create an exception wih the specified fault message and faultCode.

Parameters:
message - The fault message.
code - The fault code. See XFireFault's static fields.
Method Detail

createFault

public static XFireFault createFault(java.lang.Exception e)

getCode

public java.lang.String getCode()
Returns:

getReason

public java.lang.String getReason()

getSubCode

public org.w3c.dom.Element getSubCode()
Returns the SubCode for the Fault Code. TODO: The spec seems unclear whether or not there can be multiple subcodes. Its an easy enough change to support multiple subcodes.

Returns:
The SubCode element as detailed by the SOAP 1.2 spec.

setSubCode

public void setSubCode(org.w3c.dom.Element subCode)

getDetail

public java.util.List getDetail()
A list of Element's that provide the message detail.

Returns:

setDetail

public void setDetail(java.util.List detail)


Copyright © 2004 Codehaus. All Rights Reserved.