Package org.apache.axis2
Class AxisFault
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.io.IOException
java.rmi.RemoteException
org.apache.axis2.AxisFault
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ClusteringFault,DataRetrievalException,DeploymentException,PhaseException
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
- A fault string
- A fault code
- A fault actor
- Fault details; an xml tree of fault specific elements
SOAP1.2 SOAP1.1 node faultactor reason(0).text faultstring faultcode.value faultcode faultcode.subcode (discarded) detail detail role (discarded) - Serialized Form
-
Field Summary
Fields inherited from class java.rmi.RemoteException
detail -
Constructor Summary
ConstructorsModifierConstructorDescriptionConstructor.Constructor.ConstructorConstructorAxisFault(String message, MessageContext faultMessageContext) Create an AxisFault by providing a textual message and a MessageContext that contains the actual fault representation.AxisFault(String message, MessageContext faultMessageContext, Throwable cause) protectedConstruct a fault from a Throwable.AxisFault(QName faultCode, String faultReason, String faultNode, String faultRole, org.apache.axiom.om.OMElement faultDetail) ConstructorConstructorConstructorAxisFault(org.apache.axiom.soap.SOAPFault fault) AxisFault(org.apache.axiom.soap.SOAPFaultCode soapFaultCode, org.apache.axiom.soap.SOAPFaultReason soapFaultReason, org.apache.axiom.soap.SOAPFaultNode soapFaultNode, org.apache.axiom.soap.SOAPFaultRole soapFaultRole, org.apache.axiom.soap.SOAPFaultDetail soapFaultDetail) This is just a convenience method for the user.AxisFault(org.apache.axiom.soap.SOAPFault fault, MessageContext faultCtx) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddHeader(org.apache.axiom.soap.SOAPHeaderBlock header) Add a header to the list of fault headersvoidAdd a reason for the fault in the empty "" languagevoidAdd a reason for the faultorg.apache.axiom.om.OMElementGet the current fault detail.List<org.apache.axiom.om.OMElement>Get the SOAP fault detail elements.org.apache.axiom.soap.SOAPFaultCodeorg.apache.axiom.soap.SOAPFaultDetailReturns the MessageContext representation of the fault if the fault was created by providing that.org.apache.axiom.soap.SOAPFaultNodeorg.apache.axiom.soap.SOAPFaultReasonorg.apache.axiom.soap.SOAPFaultRoleintReturns the detail message, including the message from the cause, if any, of this exception.Get the faulting node uri.Returns the first fault reason, if available.ListIterator<org.apache.axiom.soap.SOAPHeaderBlock>Iterate over all of the headersList<org.apache.axiom.soap.SOAPHeaderBlock>headers()Get at the headers.static AxisFaultMake an AxisFault based on a passed Exception.voidsetDetail(org.apache.axiom.om.OMElement detail) Set the entire detail element of the faultvoidsetDetails(List<org.apache.axiom.om.OMElement> details) Set the SOAP fault details.voidsetFaultAction(String faultAction) Set the (OPTIONAL) action value for the fault messagevoidsetFaultCode(String soapFaultCode) voidsetFaultCode(QName soapFaultCode) voidsetFaultSubCodes(List<QName> faultSubCodes) voidsetFaultType(int faultType) voidsetNodeURI(String nodeURI) Set the faulting node uri.Methods inherited from class java.rmi.RemoteException
getCauseMethods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
AxisFault
Constructor.- Parameters:
message- the human-readable text describing the fault
-
AxisFault
Constructor- Parameters:
faultCode- - fault code of the message as a QNamefaultReason- - the reason for the fault. The language will be defaulted to 'en'cause- embedded fault which caused this one
-
AxisFault
Constructor- Parameters:
faultCode- - fault code of the message as a QNamefaultSubCodes- - list sub fault codes as a list if QNamesfaultReason- - the reason for the fault. The language will be defaulted to 'en'cause- embedded fault which caused this one
-
AxisFault
public AxisFault(QName faultCode, String faultReason, String faultNode, String faultRole, org.apache.axiom.om.OMElement faultDetail) Constructor- Parameters:
faultCode- a QName for the fault codefaultReason- the reason for the fault. The language will be defaulted to 'en'faultNode- a URL identifying the SOAP node generating this fault, or nullfaultRole- a URL identifying the SOAP role active when generating this fault, or nullfaultDetail- arbitrary XML containing application-specific fault data
-
AxisFault
public AxisFault(org.apache.axiom.soap.SOAPFaultCode soapFaultCode, org.apache.axiom.soap.SOAPFaultReason soapFaultReason, org.apache.axiom.soap.SOAPFaultNode soapFaultNode, org.apache.axiom.soap.SOAPFaultRole soapFaultRole, org.apache.axiom.soap.SOAPFaultDetail soapFaultDetail) This is just a convenience method for the user. If you set these, do not use other methods in this class to get and set things. Any of the parameters can be null- Parameters:
soapFaultCode- the fault codesoapFaultReason- the fault reasonsoapFaultNode- the SOAPFaultNode representing the source node for this faultsoapFaultRole- the SOAPFaultRole representing the source role for this faultsoapFaultDetail- the SOAPFaultDetail containing any application-specific info
-
AxisFault
public AxisFault(org.apache.axiom.soap.SOAPFault fault) -
AxisFault
-
AxisFault
Construct a fault from a Throwable. This is a protected constructor - in general to make an AxisFault from an Exception, you should be calling AxisFault.makeFault(e), which prevents AxisFaults within AxisFaults.- Parameters:
cause- the Throwable that caused the problem
-
AxisFault
Constructor.- Parameters:
messageText- - this will appear as the Text in the Reason information item of SOAP FaultfaultCode- - this will appear as the Value in the Code information item of SOAP Fault
-
AxisFault
Constructor- Parameters:
messageText- this will appear as the Text in the Reason information item of SOAP FaultfaultCode- this will appear as the Value in the Code information item of SOAP Fault
-
AxisFault
Constructor- Parameters:
message- this will appear as the Text in the Reason information item of SOAP Faultcause- the embedded Throwable that caused this fault
-
AxisFault
- Parameters:
messageText- - this will appear as the Text in the Reason information item of SOAP FaultfaultCode- - this will appear as the Value in the Code information item of SOAP Faultcause- - this will appear under the Detail information item of SOAP Fault
-
AxisFault
- Parameters:
message-faultMessageContext-cause-
-
AxisFault
- Parameters:
messageText- - this will appear as the Text in the Reason information item of SOAP FaultfaultCode- - this will appear as the Value in the Code information item of SOAP Faultcause- - this will appear under the Detail information item of SOAP Fault
-
AxisFault
Create an AxisFault by providing a textual message and a MessageContext that contains the actual fault representation.- Parameters:
message- A string that's really only useful for logging.faultMessageContext- A MessageContext which must contain SOAP fault info
-
-
Method Details
-
addHeader
public void addHeader(org.apache.axiom.soap.SOAPHeaderBlock header) Add a header to the list of fault headers- Parameters:
header- to add.
-
addReason
Add a reason for the fault in the empty "" language- Parameters:
text- text message
-
addReason
Add a reason for the fault- Parameters:
text- text messagelanguage- language
-
getReason
Returns the first fault reason, if available. If not found, returns null.- Returns:
- faultReason
-
headerIterator
Iterate over all of the headers- Returns:
- iterator
-
headers
Get at the headers. Useful for java1.5 iteration.- Returns:
- the headers for this fault
-
makeFault
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- theExceptionto build a fault for- Returns:
- an
AxisFaultrepresentinge
-
getDetail
public org.apache.axiom.om.OMElement getDetail()Get the current fault detail. If the fault has several detail elements, only the first one is returned.- Returns:
- the (first) detail element, or
nullif there is no detail element
-
getDetails
Get the SOAP fault detail elements.- Returns:
- the list of SOAP fault detail elements, or
nullif no detail elements have been set for this fault
-
getFaultCode
-
getFaultSubCodes
-
getFaultCodeElement
public org.apache.axiom.soap.SOAPFaultCode getFaultCodeElement()- Returns:
- SOAPFaultCode if, user has set a
SOAPFaultCodeelement when constructing theAxisFault
-
getFaultReasonElement
public org.apache.axiom.soap.SOAPFaultReason getFaultReasonElement()- Returns:
- SOAPFaultCode if, user has set a
SOAPFaultReasonelement when constructing theAxisFault
-
getFaultNodeElement
public org.apache.axiom.soap.SOAPFaultNode getFaultNodeElement()- Returns:
- SOAPFaultCode if, user has set a
SOAPFaultNodeelement when constructing theAxisFault
-
getFaultRoleElement
public org.apache.axiom.soap.SOAPFaultRole getFaultRoleElement()- Returns:
- SOAPFaultCode if, user has set a
SOAPFaultRoleelement when constructing theAxisFault
-
getFaultDetailElement
public org.apache.axiom.soap.SOAPFaultDetail getFaultDetailElement()- Returns:
- SOAPFaultCode if, user has set a
SOAPFaultDetailelement when constructing theAxisFault
-
getNodeURI
Get the faulting node uri. SOAP1.2- Returns:
- URI as a string or null
-
setDetail
public void setDetail(org.apache.axiom.om.OMElement detail) Set the entire detail element of the fault- Parameters:
detail- an OMElement which MUST be
-
setDetails
Set the SOAP fault details.- Parameters:
details- a list of elements for the SOAP fault details
-
setFaultCode
-
setFaultSubCodes
-
setFaultCode
-
setNodeURI
Set the faulting node uri. (SOAP1.2)- Parameters:
nodeURI- a String containing a URI indicating which SOAP Node faulted
-
getFaultNode
-
getFaultRole
-
getFaultMessageContext
Returns the MessageContext representation of the fault if the fault was created by providing that.- Returns:
- The MessageContext representing the fault message or null if the fault was not created with MessageContext representation.
-
getFaultAction
- Returns:
- the action value set for the fault message
-
setFaultAction
Set the (OPTIONAL) action value for the fault message- Parameters:
faultAction- a String containing an action URI for the fault
-
getMessage
Returns the detail message, including the message from the cause, if any, of this exception.- Overrides:
getMessagein classRemoteException- Returns:
- the detail message
-
getFaultType
public int getFaultType() -
setFaultType
public void setFaultType(int faultType)
-