Class SOAPFault

All Implemented Interfaces:
Serializable, Cloneable, Node, SOAPBodyElement, SOAPElement, SOAPFault, Element, Node, NodeList

public class SOAPFault extends SOAPBodyElement implements SOAPFault
A Fault body element.
Author:
Sam Ruby (rubys@us.ibm.com), Glen Daniels (gdaniels@apache.org), Tom Jordahl (tomj@macromedia.com)
See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • outputImpl

      public void outputImpl(SerializationContext context) throws Exception
      Description copied from class: MessageElement
      override point -output to a serialization context.
      Overrides:
      outputImpl in class MessageElement
      Parameters:
      context - destination.
      Throws:
      Exception - if something went wrong.
    • getFault

      public AxisFault getFault()
    • setFault

      public void setFault(AxisFault fault)
    • setFaultCode

      public void setFaultCode(String faultCode) throws SOAPException
      Sets this SOAPFaultException object with the given fault code.

      Fault codes, which given information about the fault, are defined in the SOAP 1.1 specification.

      Specified by:
      setFaultCode in interface SOAPFault
      Parameters:
      faultCode - a String giving the fault code to be set; must be one of the fault codes defined in the SOAP 1.1 specification
      Throws:
      SOAPException - if there was an error in adding the faultCode to the underlying XML tree.
      See Also:
    • getFaultCode

      public String getFaultCode()
      Gets the fault code for this SOAPFaultException object.
      Specified by:
      getFaultCode in interface SOAPFault
      Returns:
      a String with the fault code
      See Also:
    • setFaultActor

      public void setFaultActor(String faultActor) throws SOAPException
      Sets this SOAPFaultException object with the given fault actor.

      The fault actor is the recipient in the message path who caused the fault to happen.

      Specified by:
      setFaultActor in interface SOAPFault
      Parameters:
      faultActor - a String identifying the actor that caused this SOAPFaultException object
      Throws:
      SOAPException - if there was an error in adding the faultActor to the underlying XML tree.
      See Also:
    • getFaultActor

      public String getFaultActor()
      Gets the fault actor for this SOAPFaultException object.
      Specified by:
      getFaultActor in interface SOAPFault
      Returns:
      a String giving the actor in the message path that caused this SOAPFaultException object
      See Also:
    • setFaultString

      public void setFaultString(String faultString) throws SOAPException
      Sets the fault string for this SOAPFaultException object to the given string.
      Specified by:
      setFaultString in interface SOAPFault
      Parameters:
      faultString - a String giving an explanation of the fault
      Throws:
      SOAPException - if there was an error in adding the faultString to the underlying XML tree.
      See Also:
    • getFaultString

      public String getFaultString()
      Gets the fault string for this SOAPFaultException object.
      Specified by:
      getFaultString in interface SOAPFault
      Returns:
      a String giving an explanation of the fault
    • getDetail

      public Detail getDetail()
      Returns the detail element for this SOAPFaultException object.

      A Detail object carries application-specific error information related to SOAPBodyElement objects.

      Specified by:
      getDetail in interface SOAPFault
      Returns:
      a Detail object with application-specific error information
    • addDetail

      public Detail addDetail() throws SOAPException
      Creates a Detail object and sets it as the Detail object for this SOAPFaultException object.

      It is illegal to add a detail when the fault already contains a detail. Therefore, this method should be called only after the existing detail has been removed.

      Specified by:
      addDetail in interface SOAPFault
      Returns:
      the new Detail object
      Throws:
      SOAPException - if this SOAPFaultException object already contains a valid Detail object
    • setFaultCode

      public void setFaultCode(Name faultCodeQName) throws SOAPException
      Description copied from interface: SOAPFault
      Sets this SOAPFault object with the given fault code. Fault codes, which give information about the fault, are defined in the SOAP 1.1 specification. A fault code is mandatory and must be of type QName. This method provides a convenient way to set a fault code. For example,
           SOAPEnvelope se = ...;
           // Create a qualified name in the SOAP namespace with a localName
           // of "Client".  Note that prefix parameter is optional and is null
           // here which causes the implementation to use an appropriate prefix.
           Name qname = se.createName("Client", null,
           SOAPConstants.URI_NS_SOAP_ENVELOPE);
           SOAPFault fault = ...;
           fault.setFaultCode(qname);
      
       It is preferable to use this method over setFaultCode(String).
      Specified by:
      setFaultCode in interface SOAPFault
      Parameters:
      faultCodeQName - a Name object giving the fault code to be set. It must be namespace qualified.
      Throws:
      SOAPException - if there was an error in adding the faultcode element to the underlying XML tree
    • getFaultCodeAsName

      public Name getFaultCodeAsName()
      Description copied from interface: SOAPFault
      Gets the mandatory SOAP 1.1 fault code for this SOAPFault object as a SAAJ Name object. The SOAP 1.1 specification requires the value of the "faultcode" element to be of type QName. This method returns the content of the element as a QName in the form of a SAAJ Name object. This method should be used instead of the getFaultCode() method since it allows applications to easily access the namespace name without additional parsing.

      In the future, a QName object version of this method may also be added.

      Specified by:
      getFaultCodeAsName in interface SOAPFault
      Returns:
      a Name representing the faultcode
    • setFaultString

      public void setFaultString(String faultString, Locale locale) throws SOAPException
      Description copied from interface: SOAPFault
      Sets the fault string for this SOAPFault object to the given string and localized to the given locale.
      Specified by:
      setFaultString in interface SOAPFault
      Parameters:
      faultString - a String giving an explanation of the fault
      locale - a Locale object indicating the native language of the faultString
      Throws:
      SOAPException - if there was an error in adding the faultString to the underlying XML tree
    • getFaultStringLocale

      public Locale getFaultStringLocale()
      Description copied from interface: SOAPFault
      Returns the optional detail element for this SOAPFault object.
      Specified by:
      getFaultStringLocale in interface SOAPFault
      Returns:
      a Locale object indicating the native language of the fault string or null if no locale was specified