Class SOAPFault

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, Node, SOAPBodyElement, SOAPElement, SOAPFault, org.w3c.dom.Element, org.w3c.dom.Node, org.w3c.dom.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:
    Serialized Form
    • Field Detail

      • prefix

        protected java.lang.String prefix
      • detail

        protected Detail detail
    • Constructor Detail

      • SOAPFault

        public SOAPFault​(java.lang.String namespace,
                         java.lang.String localName,
                         java.lang.String prefix,
                         org.xml.sax.Attributes attrs,
                         DeserializationContext context)
                  throws AxisFault
        Throws:
        AxisFault
      • SOAPFault

        public SOAPFault​(AxisFault fault)
    • Method Detail

      • outputImpl

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

        public void setFault​(AxisFault fault)
      • setFaultCode

        public void setFaultCode​(java.lang.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()
      • setFaultActor

        public void setFaultActor​(java.lang.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()
      • getFaultActor

        public java.lang.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:
        setFaultActor(java.lang.String)
      • setFaultString

        public void setFaultString​(java.lang.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()
      • getFaultString

        public java.lang.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​(java.lang.String faultString,
                                   java.util.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 java.util.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