org.apache.axis2
Class AxisFault

java.lang.Object
  extended byjava.lang.Throwable
      extended byjava.lang.Exception
          extended byjava.io.IOException
              extended byjava.rmi.RemoteException
                  extended byorg.apache.axis2.AxisFault
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
DeploymentException, PhaseException

public class AxisFault
extends RemoteException

An exception which maps cleanly to a SOAP fault. This is a base class for exceptions which are mapped to faults.

See Also:
SOAP1.2 specification, SOAP1.1 Faults

SOAP faults contain

  1. A fault string
  2. A fault code
  3. A fault actor
  4. Fault details; an xml tree of fault specific elements

As SOAP1.2 faults are a superset of SOAP1.1 faults, this type holds soap1.2 fault information. When a SOAP1.1 fault is created, spurious information can be discarded. Mapping

           SOAP1.2              SOAP1.1
           node                 faultactor
           reason(0).text       faultstring
           faultcode.value      faultcode
           faultcode.subcode    (discarded)
           detail               detail
           role                 (discarded)
           
, Serialized Form

Constructor Summary
AxisFault(org.apache.ws.commons.soap.SOAPFault fault)
          Make an AxisFault from an incoming SOAPFault
AxisFault(String message)
           
AxisFault(String messageText, QName faultCode)
           
AxisFault(String messageText, QName faultCode, Throwable cause)
           
AxisFault(String messageText, String faultCode)
           
AxisFault(String messageText, String faultCode, Throwable cause)
           
AxisFault(String message, Throwable cause)
           
AxisFault(Throwable cause)
          construct a fault from an exception TODO: handle AxisFaults or SOAPFaultException implementations differently?
 
Method Summary
 void addHeader(org.apache.ws.commons.soap.SOAPHeader header)
          Add a header to the list of fault headers
 void addReason(String text)
          Add a reason for the fault in the empty "" language
 void addReason(String text, String language)
          Add a reason for the fault
 org.apache.ws.commons.om.OMElement getDetail()
          Get the current fault detail
 QName getFaultCode()
           
 String getNodeURI()
          Get the faulting node uri.
 String getReason()
           
 ListIterator headerIterator()
          Iterate over all of the headers
 List headers()
          Get at the headers.
static AxisFault makeFault(Exception e)
          Make an AxisFault based on a passed Exception.
 void setDetail(org.apache.ws.commons.om.OMElement detail)
          Set the entire detail element of the fault
 void setFaultCode(QName soapFaultCode)
           
 void setFaultCode(String soapFaultCode)
           
 void setNodeURI(String nodeURI)
          Set the faulting node uri.
 
Methods inherited from class java.rmi.RemoteException
getCause, getMessage
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getLocalizedMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AxisFault

public AxisFault(org.apache.ws.commons.soap.SOAPFault fault)
Make an AxisFault from an incoming SOAPFault

Parameters:
fault - that caused the failure

AxisFault

public AxisFault(String message)
Parameters:
message -

AxisFault

public AxisFault(Throwable cause)
construct a fault from an exception TODO: handle AxisFaults or SOAPFaultException implementations differently?

Parameters:
cause -

AxisFault

public AxisFault(String messageText,
                 String faultCode)
Parameters:
messageText - - this will appear as the Text in the Reason information item of SOAP Fault
faultCode - - this will appear as the Value in the Code information item of SOAP Fault

AxisFault

public AxisFault(String messageText,
                 QName faultCode)
Parameters:
messageText - - this will appear as the Text in the Reason information item of SOAP Fault
faultCode - - this will appear as the Value in the Code information item of SOAP Fault

AxisFault

public AxisFault(String message,
                 Throwable cause)
Parameters:
message -
cause -

AxisFault

public AxisFault(String messageText,
                 QName faultCode,
                 Throwable cause)
Parameters:
messageText - - this will appear as the Text in the Reason information item of SOAP Fault
faultCode - - this will appear as the Value in the Code information item of SOAP Fault
cause - - this will appear under the Detail information item of SOAP Fault

AxisFault

public AxisFault(String messageText,
                 String faultCode,
                 Throwable cause)
Parameters:
messageText - - this will appear as the Text in the Reason information item of SOAP Fault
faultCode - - this will appear as the Value in the Code information item of SOAP Fault
cause - - this will appear under the Detail information item of SOAP Fault
Method Detail

addHeader

public void addHeader(org.apache.ws.commons.soap.SOAPHeader header)
Add a header to the list of fault headers

Parameters:
header - to add.

addReason

public void addReason(String text)
Add a reason for the fault in the empty "" language

Parameters:
text - text message

addReason

public void addReason(String text,
                      String language)
Add a reason for the fault

Parameters:
text - text message
language - language

getReason

public String getReason()

headerIterator

public ListIterator headerIterator()
Iterate over all of the headers

Returns:
iterator

headers

public List headers()
Get at the headers. Useful for java1.5 iteration.

Returns:
the headers for this fault

makeFault

public static AxisFault makeFault(Exception e)
Make an AxisFault based on a passed Exception. If the Exception is already an AxisFault, simply use that. Otherwise, wrap it in an AxisFault. If the Exception is an InvocationTargetException (which already wraps another Exception), get the wrapped Exception out from there and use that instead of the passed one.

Parameters:
e - the Exception to build a fault for
Returns:
an AxisFault representing e

getDetail

public org.apache.ws.commons.om.OMElement getDetail()
Get the current fault detail

Returns:
om element

getFaultCode

public QName getFaultCode()

getNodeURI

public String getNodeURI()
Get the faulting node uri. SOAP1.2

Returns:
URI as a string or null

setDetail

public void setDetail(org.apache.ws.commons.om.OMElement detail)
Set the entire detail element of the fault

Parameters:
detail -

setFaultCode

public void setFaultCode(QName soapFaultCode)

setFaultCode

public void setFaultCode(String soapFaultCode)

setNodeURI

public void setNodeURI(String nodeURI)
Set the faulting node uri. SOAP1.2