Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.axis
Class AxisFault  view AxisFault download AxisFault.java

java.lang.Object
  extended byjava.lang.Throwable
      extended byjava.lang.Exception
          extended byjava.io.IOException
              extended byjava.rmi.RemoteException
                  extended byorg.apache.axis.AxisFault
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
NoEndPointException

public class AxisFault
extends java.rmi.RemoteException

An exception which maps cleanly to a SOAP fault. This is a base class for exceptions which are mapped to 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 stuff


Nested Class Summary
 
Nested classes inherited from class java.lang.Throwable
 
Field Summary
protected  java.lang.String faultActor
           
protected  javax.xml.namespace.QName faultCode
           
protected  java.util.Vector faultDetails
           
protected  java.util.ArrayList faultHeaders
          SOAP headers which should be serialized with the Fault.
protected  java.lang.String faultNode
           
protected  java.lang.String faultString
           
protected  java.util.Vector faultSubCode
          SOAP1.2 addition: subcodes of faults; a Vector of QNames
protected static org.apache.commons.logging.Log log
          The Log used by this class for all logging.
 
Fields inherited from class java.rmi.RemoteException
detail
 
Fields inherited from class java.lang.Throwable
 
Constructor Summary
  AxisFault()
          No-arg constructor for building one from an XML stream.
protected AxisFault(java.lang.Exception target)
          Wrap an AxisFault around an existing Exception.
  AxisFault(javax.xml.namespace.QName code, javax.xml.namespace.QName[] subcodes, java.lang.String faultString, java.lang.String actor, java.lang.String node, org.w3c.dom.Element[] details)
          Make a fault in any namespace.
  AxisFault(javax.xml.namespace.QName code, java.lang.String faultString, java.lang.String actor, org.w3c.dom.Element[] details)
          Make a fault in any namespace.
  AxisFault(java.lang.String message)
          create a simple axis fault from the message.
  AxisFault(java.lang.String code, java.lang.String faultString, java.lang.String actor, org.w3c.dom.Element[] details)
          Make a fault in the Constants.NS_URI_AXIS namespace.
  AxisFault(java.lang.String message, java.lang.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.
 
Method Summary
 void addFaultDetail(org.w3c.dom.Element detail)
          Append an element to the fault detail list.
 void addFaultDetail(javax.xml.namespace.QName qname, java.lang.String body)
          Create an element of the given qname and add it to the details.
 void addFaultDetailString(java.lang.String detail)
          add a string tag to the fault details.
 void addFaultSubCode(javax.xml.namespace.QName code)
          Add a fault sub-code.
 void addFaultSubCodeAsString(java.lang.String code)
          Add a fault sub-code with the local name code and namespace Constants.NS_URI_AXIS.
 void addHeader(org.apache.axis.message.SOAPHeaderElement header)
          Add a SOAP header which should be serialized along with the fault.
 void addHostname(java.lang.String hostname)
          add the hostname string.
 void addHostnameIfNeeded()
          add the hostname of the current system.
 void clearFaultDetails()
          Clear the fault details list.
 void clearFaultSubCodes()
          Clear all fault sub-codes.
 void clearHeaders()
          Clear all fault headers.
 void dump()
          Dump the fault info to the log at debug level.
 java.lang.String dumpToString()
          turn the fault and details into a string, with XML escaping.
 java.lang.String getFaultActor()
          get the fault actor
 javax.xml.namespace.QName getFaultCode()
          Get the fault code QName.
 org.w3c.dom.Element[] getFaultDetails()
          Get all the fault details.
 java.lang.String getFaultNode()
          Get the fault node.
 java.lang.String getFaultReason()
          This is SOAP 1.2 equivalent of getFaultString() 55 .
 java.lang.String getFaultRole()
          This is SOAP 1.2 equivalent of getFaultActor() 55 .
 java.lang.String getFaultString()
          Get the fault string; this will never be null but may be the empty string.
 javax.xml.namespace.QName[] getFaultSubCodes()
          get the fault subcode list; only used in SOAP 1.2
 java.util.ArrayList getHeaders()
          Get the SOAP headers associated with this fault.
private  java.lang.String getPlainStackTrace()
          Gets the stack trace as a string.
private  void initFaultDetails()
          Init the fault details data structure; does nothing if this exists already.
protected  void initFaultSubCodes()
          Do whatever is needed to create the fault subcodes data structure, if it is needed.
private  void initFromException(java.lang.Exception target)
          fill in soap fault details from the exception, unless this object already has a stack trace in its details.
private  void initFromSOAPFaultException(javax.xml.rpc.soap.SOAPFaultException fault)
          Initiates the AxisFault with the values from a SOAPFaultException
 org.w3c.dom.Element lookupFaultDetail(javax.xml.namespace.QName qname)
          Find a fault detail element by its qname.
static AxisFault makeFault(java.lang.Exception e)
          Make an AxisFault based on a passed Exception.
 void output(org.apache.axis.encoding.SerializationContext context)
          Add this fault and any needed headers to the output context.
 void printStackTrace(java.io.PrintStream ps)
          The override of the base class method prints out the fault info before the stack trace.
 void printStackTrace(java.io.PrintWriter pw)
          The override of the base class method prints out the fault info before the stack trace.
 boolean removeFaultDetail(javax.xml.namespace.QName qname)
          Find and remove a specified fault detail element.
 void removeHostname()
          strip out the hostname on a message.
 void setFaultActor(java.lang.String actor)
          Set the fault actor.
 void setFaultCode(javax.xml.namespace.QName code)
          Set the fault code.
 void setFaultCode(java.lang.String code)
          Deprecated. expect to see this go away after 1.1, use setFaultCodeAsString instead!
 void setFaultCodeAsString(java.lang.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
 void setFaultDetail(org.w3c.dom.Element[] details)
          Set the fault detail element to the arrary of details.
 void setFaultDetailString(java.lang.String details)
          set the fault details to a string element.
 void setFaultNode(java.lang.String node)
          Set the fault node.
 void setFaultReason(java.lang.String str)
          This is SOAP 1.2 equivalent of setFaultString(java.lang.String) 55 .
 void setFaultRole(java.lang.String role)
          This is SOAP 1.2 equivalent of setFaultActor(java.lang.String) 55 .
 void setFaultString(java.lang.String str)
          Set a fault string.
 java.lang.String toString()
          Stringify this fault as the current fault string.
 void writeDetails(javax.xml.namespace.QName qname, org.apache.axis.encoding.SerializationContext context)
          Writes any exception data to the faultDetails.
 
Methods inherited from class java.rmi.RemoteException
getCause, getMessage
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getLocalizedMessage, getStackTrace, initCause, printStackTrace, setStackTrace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

protected static org.apache.commons.logging.Log log
The Log used by this class for all logging.


faultCode

protected javax.xml.namespace.QName faultCode

faultSubCode

protected java.util.Vector faultSubCode
SOAP1.2 addition: subcodes of faults; a Vector of QNames


faultString

protected java.lang.String faultString

faultActor

protected java.lang.String faultActor

faultDetails

protected java.util.Vector faultDetails

faultNode

protected java.lang.String faultNode

faultHeaders

protected java.util.ArrayList faultHeaders
SOAP headers which should be serialized with the Fault.

Constructor Detail

AxisFault

public AxisFault(java.lang.String code,
                 java.lang.String faultString,
                 java.lang.String actor,
                 org.w3c.dom.Element[] details)
Make a fault in the Constants.NS_URI_AXIS namespace.


AxisFault

public AxisFault(javax.xml.namespace.QName code,
                 java.lang.String faultString,
                 java.lang.String actor,
                 org.w3c.dom.Element[] details)
Make a fault in any namespace.


AxisFault

public AxisFault(javax.xml.namespace.QName code,
                 javax.xml.namespace.QName[] subcodes,
                 java.lang.String faultString,
                 java.lang.String actor,
                 java.lang.String node,
                 org.w3c.dom.Element[] details)
Make a fault in any namespace.

Since:
axis1.1

AxisFault

protected AxisFault(java.lang.Exception target)
Wrap an AxisFault around an existing Exception. This is private to force everyone to use makeFault() above, which sanity-checks us.


AxisFault

public AxisFault(java.lang.String message)
create a simple axis fault from the message. Classname and stack trace go into the fault details.


AxisFault

public AxisFault()
No-arg constructor for building one from an XML stream.


AxisFault

public AxisFault(java.lang.String message,
                 java.lang.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.

Method Detail

makeFault

public static AxisFault makeFault(java.lang.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.


initFromException

private void initFromException(java.lang.Exception target)
fill in soap fault details from the exception, unless this object already has a stack trace in its details. Which, given the way this private method is invoked, is a pretty hard situation to ever achieve. This method adds classname of the exception and the stack trace.


initFromSOAPFaultException

private void initFromSOAPFaultException(javax.xml.rpc.soap.SOAPFaultException fault)
Initiates the AxisFault with the values from a SOAPFaultException


initFaultDetails

private void initFaultDetails()
Init the fault details data structure; does nothing if this exists already.


clearFaultDetails

public void clearFaultDetails()
Clear the fault details list.


dump

public void dump()
Dump the fault info to the log at debug level.


dumpToString

public java.lang.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.


setFaultCode

public void setFaultCode(javax.xml.namespace.QName code)
Set the fault code.


setFaultCode

public void setFaultCode(java.lang.String code)
Deprecated. expect to see this go away after 1.1, use setFaultCodeAsString instead!

Set the fault code (as a String).


setFaultCodeAsString

public void setFaultCodeAsString(java.lang.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


getFaultCode

public javax.xml.namespace.QName getFaultCode()
Get the fault code QName.


addFaultSubCodeAsString

public void addFaultSubCodeAsString(java.lang.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

Since:
axis1.1

initFaultSubCodes

protected void initFaultSubCodes()
Do whatever is needed to create the fault subcodes data structure, if it is needed.


addFaultSubCode

public void addFaultSubCode(javax.xml.namespace.QName code)
Add a fault sub-code. This is new in SOAP 1.2, ignored in SOAP 1.1.

Since:
axis1.1

clearFaultSubCodes

public void clearFaultSubCodes()
Clear all fault sub-codes. This is new in SOAP 1.2, ignored in SOAP 1.1.

Since:
axis1.1

getFaultSubCodes

public javax.xml.namespace.QName[] getFaultSubCodes()
get the fault subcode list; only used in SOAP 1.2

Since:
axis1.1

setFaultString

public void setFaultString(java.lang.String str)
Set a fault string.


getFaultString

public java.lang.String getFaultString()
Get the fault string; this will never be null but may be the empty string.


setFaultReason

public void setFaultReason(java.lang.String str)
This is SOAP 1.2 equivalent of setFaultString(java.lang.String) 55 .

Since:
axis1.1

getFaultReason

public java.lang.String getFaultReason()
This is SOAP 1.2 equivalent of getFaultString() 55 .

Since:
axis1.1

setFaultActor

public void setFaultActor(java.lang.String actor)
Set the fault actor.


getFaultActor

public java.lang.String getFaultActor()
get the fault actor


getFaultRole

public java.lang.String getFaultRole()
This is SOAP 1.2 equivalent of getFaultActor() 55 .

Since:
axis1.1

setFaultRole

public void setFaultRole(java.lang.String role)
This is SOAP 1.2 equivalent of setFaultActor(java.lang.String) 55 .

Since:
axis1.1

getFaultNode

public java.lang.String getFaultNode()
Get the fault node. This is new in SOAP 1.2

Since:
axis1.1

setFaultNode

public void setFaultNode(java.lang.String node)
Set the fault node. This is new in SOAP 1.2.

Since:
axis1.1

setFaultDetail

public void setFaultDetail(org.w3c.dom.Element[] details)
Set the fault detail element to the arrary of details.


setFaultDetailString

public void setFaultDetailString(java.lang.String details)
set the fault details to a string element.


addFaultDetailString

public void addFaultDetailString(java.lang.String detail)
add a string tag to the fault details.


addFaultDetail

public void addFaultDetail(org.w3c.dom.Element detail)
Append an element to the fault detail list.

Since:
Axis1.1

addFaultDetail

public void addFaultDetail(javax.xml.namespace.QName qname,
                           java.lang.String body)
Create an element of the given qname and add it to the details.


getFaultDetails

public org.w3c.dom.Element[] getFaultDetails()
Get all the fault details.


lookupFaultDetail

public org.w3c.dom.Element lookupFaultDetail(javax.xml.namespace.QName qname)
Find a fault detail element by its qname.

Since:
axis1.1

removeFaultDetail

public boolean removeFaultDetail(javax.xml.namespace.QName qname)
Find and remove a specified fault detail element.

Since:
axis1.1

output

public void output(org.apache.axis.encoding.SerializationContext context)
            throws java.lang.Exception
Add this fault and any needed headers to the output context.


toString

public java.lang.String toString()
Stringify this fault as the current fault string.


getPlainStackTrace

private java.lang.String getPlainStackTrace()
Gets the stack trace as a string.


printStackTrace

public void printStackTrace(java.io.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.


addHeader

public void addHeader(org.apache.axis.message.SOAPHeaderElement header)
Add a SOAP header which should be serialized along with the fault.


getHeaders

public java.util.ArrayList getHeaders()
Get the SOAP headers associated with this fault.


clearHeaders

public void clearHeaders()
Clear all fault headers.


writeDetails

public void writeDetails(javax.xml.namespace.QName qname,
                         org.apache.axis.encoding.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.


addHostnameIfNeeded

public void addHostnameIfNeeded()
add the hostname of the current system. This is very useful for locating faults on a cluster.

Since:
Axis1.2

addHostname

public void addHostname(java.lang.String hostname)
add the hostname string. If one already exists, remove it.

Since:
Axis1.2

removeHostname

public void removeHostname()
strip out the hostname on a message. This is useful for security reasons.