faultActor
protected String faultActor
faultCode
protected QName faultCode
faultDetails
protected Vector faultDetails
faultHeaders
protected ArrayList faultHeaders
SOAP headers which should be serialized with the Fault.
faultNode
protected String faultNode
faultString
protected String faultString
faultSubCode
protected Vector faultSubCode
SOAP1.2 addition: subcodes of faults; a Vector of QNames
log
protected static Log log
The Log
used by this class for all logging.
AxisFault
public AxisFault()
No-arg constructor for building one from an XML stream.
AxisFault
protected AxisFault(Exception target)
Wrap an AxisFault around an existing Exception. This is private
to force everyone to use makeFault() above, which sanity-checks us.
target
- the target Exception
AxisFault
public AxisFault(String message)
create a simple axis fault from the message. Classname and stack trace
go into the fault details.
AxisFault
public AxisFault(String code,
String faultString,
String actor,
Element[] details)
Make a fault in the Constants.NS_URI_AXIS
namespace.
code
- fault code which will be passed into the Axis namespacefaultString
- fault stringactor
- fault actordetails
- details; if null the current stack trace and classname is
inserted into the details.
AxisFault
public AxisFault(String message,
Throwable t)
create a fault from any throwable;
When faulting a throwable (as opposed to an exception),
stack trace information does not go into the fault.
message
- any extra text to with the faultt
- whatever is to be turned into a fault
AxisFault
public AxisFault(QName code,
String faultString,
String actor,
Element[] details)
Make a fault in any namespace.
code
- fault code which will be passed into the Axis namespacefaultString
- fault stringactor
- fault actordetails
- details; if null the current stack trace and classname is
inserted into the details.
AxisFault
public AxisFault(QName code,
QName[] subcodes,
String faultString,
String actor,
String node,
Element[] details)
Make a fault in any namespace.
code
- fault code which will be passed into the Axis namespacesubcodes
- fault subcodes which will be pased into the Axis namespacefaultString
- fault stringactor
- fault actor, same as fault role in SOAP 1.2node
- which node caused the fault on the SOAP pathdetails
- details; if null the current stack trace and classname is
inserted into the details.
addFaultDetail
public void addFaultDetail(Element detail)
Append an element to the fault detail list.
detail
- the new element to add
addFaultDetail
public void addFaultDetail(QName qname,
String body)
Create an element of the given qname and add it to the details.
qname
- qname of the elementbody
- string to use as body
addFaultDetailString
public void addFaultDetailString(String detail)
add a string tag to the fault details.
addFaultSubCode
public void addFaultSubCode(QName code)
Add a fault sub-code.
This is new in SOAP 1.2, ignored in SOAP 1.1.
code
- the QName
of the fault sub-code to add
addFaultSubCodeAsString
public void addFaultSubCodeAsString(String code)
Add a fault sub-code with the local name code
and namespace
Constants.NS_URI_AXIS
.
This is new in SOAP 1.2, ignored in SOAP 1.1
code
- the local name of the code to add
addHeader
public void addHeader(SOAPHeaderElement header)
Add a SOAP header which should be serialized along with the
fault.
header
- a SOAPHeaderElement containing some fault-relevant stuff
addHostname
public void addHostname(String hostname)
add the hostname string. If one already exists, remove it.
hostname
- string name of a host
addHostnameIfNeeded
public void addHostnameIfNeeded()
add the hostname of the current system. This is very useful for
locating faults on a cluster.
clearFaultDetails
public void clearFaultDetails()
Clear the fault details list.
clearFaultSubCodes
public void clearFaultSubCodes()
Clear all fault sub-codes.
This is new in SOAP 1.2, ignored in SOAP 1.1.
clearHeaders
public void clearHeaders()
Clear all fault headers.
dump
public void dump()
Dump the fault info to the log at debug level.
dumpToString
public String dumpToString()
turn the fault and details into a string, with XML escaping.
subclassers: for security (cross-site-scripting) reasons,
escape everything that could contain caller-supplied data.
- stringified fault details
getFaultActor
public String getFaultActor()
get the fault actor
getFaultCode
public QName getFaultCode()
Get the fault code QName
.
- fault code QName or null if there is none yet.
getFaultDetails
public Element[] getFaultDetails()
Get all the fault details.
- an array of fault details, or null for none
getFaultNode
public String getFaultNode()
Get the fault node.
This is new in SOAP 1.2
getFaultReason
public String getFaultReason()
getFaultRole
public String getFaultRole()
- the name of the fault actor
getFaultString
public String getFaultString()
Get the fault string; this will never be null but may be the
empty string.
getFaultSubCodes
public QName[] getFaultSubCodes()
get the fault subcode list; only used in SOAP 1.2
- null for no subcodes, or a QName array
getHeaders
public ArrayList getHeaders()
Get the SOAP headers associated with this fault.
- an ArrayList containing any headers associated with this fault
initFaultSubCodes
protected void initFaultSubCodes()
Do whatever is needed to create the fault subcodes
data structure, if it is needed.
lookupFaultDetail
public Element lookupFaultDetail(QName qname)
Find a fault detail element by its qname.
qname
- name of the node to look for
- the matching element or null
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.
e
- the Exception
to build a fault for
- an
AxisFault
representing e
output
public void output(SerializationContext context)
throws Exception
Add this fault and any needed headers to the output context.
printStackTrace
public void printStackTrace(PrintStream ps)
The override of the base class method prints out the
fault info before the stack trace.
printStackTrace
public void printStackTrace(java.io.PrintWriter pw)
The override of the base class method prints out the
fault info before the stack trace.
removeFaultDetail
public boolean removeFaultDetail(QName qname)
Find and remove a specified fault detail element.
qname
- qualified name of detail
- true if it was found and removed, false otherwise
removeHostname
public void removeHostname()
strip out the hostname on a message. This
is useful for security reasons.
setFaultActor
public void setFaultActor(String actor)
Set the fault actor.
setFaultCode
public void setFaultCode(String code)
expect to see this go away after 1.1, use
setFaultCodeAsString instead!
Set the fault code (as a String).
setFaultCode
public void setFaultCode(QName code)
Set the fault code.
setFaultCodeAsString
public void setFaultCodeAsString(String code)
set a fault code string that is turned into a qname
in the SOAP 1.1 or 1.2 namespace, depending on the current context
setFaultDetail
public void setFaultDetail(Element[] details)
Set the fault detail element to the arrary of details.
details
- list of detail elements, can be null
setFaultDetailString
public void setFaultDetailString(String details)
set the fault details to a string element.
setFaultNode
public void setFaultNode(String node)
Set the fault node.
This is new in SOAP 1.2.
node
- a String
representing the fault node
setFaultReason
public void setFaultReason(String str)
This is SOAP 1.2 equivalent of setFaultString(java.lang.String)
.
str
- the fault reason as a String
setFaultRole
public void setFaultRole(String role)
This is SOAP 1.2 equivalent of setFaultActor(java.lang.String)
.
setFaultString
public void setFaultString(String str)
Set a fault string.
str
- new fault string; null is turned into ""
toString
public String toString()
Stringify this fault as the current fault string.
- the fault string, possibly the empty string, but never null
writeDetails
public void writeDetails(QName qname,
SerializationContext context)
throws java.io.IOException
Writes any exception data to the faultDetails.
This can be overridden (and is) by emitted exception clases.
The base implementation will attempt to serialize exception data the
fault was created from an Exception and a type mapping is found for it.
qname
- the QName
to write this undercontext
- the SerializationContext
to write this fault
to