Interface SOAPFault
- All Superinterfaces:
Element,Node,Node,SOAPBodyElement,SOAPElement
public interface SOAPFault extends SOAPBodyElement
SOAPBody object that contains
error and/or status information. This information may relate to
errors in the SOAPMessage object or to problems
that are not related to the content in the message itself.
Problems not related to the message itself are generally errors
in processing, such as the inability to communicate with an
upstream server.
The SOAPFault interface provides methods for
retrieving the information contained in a
SOAPFault object and for setting the fault code, the
fault actor, and a string describing the fault. A fault code is
one of the codes defined in the SOAP 1.1 specification that
describe the fault. An actor is an intermediate recipient to
whom a message was routed. The message path may include one or
more actors, or, if no actors are specified, the message goes
only to the default actor, which is the final intended
recipient.
-
Field Summary
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE -
Method Summary
Modifier and Type Method Description DetailaddDetail()Creates aDetailobject and sets it as theDetailobject for thisSOAPFaultobject.DetailgetDetail()Returns the detail element for thisSOAPFaultobject.StringgetFaultActor()Gets the fault actor for thisSOAPFaultobject.StringgetFaultCode()Gets the fault code for thisSOAPFaultobject.NamegetFaultCodeAsName()Gets the mandatory SOAP 1.1 fault code for thisSOAPFaultobject as a SAAJNameobject.StringgetFaultString()Gets the fault string for thisSOAPFaultobject.LocalegetFaultStringLocale()Returns the optional detail element for thisSOAPFaultobject.voidsetFaultActor(String faultActor)Sets thisSOAPFaultobject with the given fault actor.voidsetFaultCode(String faultCode)Sets thisSOAPFaultobject with the given fault code.voidsetFaultCode(Name name)Sets thisSOAPFaultobject with the given fault code.voidsetFaultString(String faultString)Sets the fault string for thisSOAPFaultobject to the given string.voidsetFaultString(String faultString, Locale locale)Sets the fault string for thisSOAPFaultobject to the given string and localized to the given locale.Methods inherited from interface org.w3c.dom.Element
getAttribute, getAttributeNode, getAttributeNodeNS, getAttributeNS, getElementsByTagName, getElementsByTagNameNS, getSchemaTypeInfo, getTagName, hasAttribute, hasAttributeNS, removeAttribute, removeAttributeNode, removeAttributeNS, setAttribute, setAttributeNode, setAttributeNodeNS, setAttributeNS, setIdAttribute, setIdAttributeNode, setIdAttributeNSMethods inherited from interface org.apache.xmlbeans.impl.soap.Node
detachNode, getParentElement, getValue, recycleNode, setParentElement, setValueMethods inherited from interface org.w3c.dom.Node
appendChild, cloneNode, compareDocumentPosition, getAttributes, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setPrefix, setTextContent, setUserDataMethods inherited from interface org.apache.xmlbeans.impl.soap.SOAPElement
addAttribute, addChildElement, addChildElement, addChildElement, addChildElement, addChildElement, addNamespaceDeclaration, addTextNode, getAllAttributes, getAttributeValue, getChildElements, getChildElements, getElementName, getEncodingStyle, getNamespacePrefixes, getNamespaceURI, getVisibleNamespacePrefixes, removeAttribute, removeContents, removeNamespaceDeclaration, setEncodingStyle
-
Method Details
-
setFaultCode
Sets thisSOAPFaultobject with the given fault code.Fault codes, which given information about the fault, are defined in the SOAP 1.1 specification.
- Parameters:
faultCode- aStringgiving 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 thefaultCodeto the underlying XML tree.- See Also:
getFaultCode()
-
getFaultCode
String getFaultCode()Gets the fault code for thisSOAPFaultobject.- Returns:
- a
Stringwith the fault code - See Also:
setFaultCode(java.lang.String)
-
setFaultActor
Sets thisSOAPFaultobject with the given fault actor.The fault actor is the recipient in the message path who caused the fault to happen.
- Parameters:
faultActor- aStringidentifying the actor that caused thisSOAPFaultobject- Throws:
SOAPException- if there was an error in adding thefaultActorto the underlying XML tree.- See Also:
getFaultActor()
-
getFaultActor
String getFaultActor()Gets the fault actor for thisSOAPFaultobject.- Returns:
- a
Stringgiving the actor in the message path that caused thisSOAPFaultobject - See Also:
setFaultActor(java.lang.String)
-
setFaultString
Sets the fault string for thisSOAPFaultobject to the given string.- Parameters:
faultString- aStringgiving an explanation of the fault- Throws:
SOAPException- if there was an error in adding thefaultStringto the underlying XML tree.- See Also:
getFaultString()
-
getFaultString
String getFaultString()Gets the fault string for thisSOAPFaultobject.- Returns:
- a
Stringgiving an explanation of the fault
-
getDetail
Detail getDetail()Returns the detail element for thisSOAPFaultobject.A
Detailobject carries application-specific error information related toSOAPBodyElementobjects.- Returns:
- a
Detailobject with application-specific error information
-
addDetail
Creates aDetailobject and sets it as theDetailobject for thisSOAPFaultobject.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.
- Returns:
- the new
Detailobject - Throws:
SOAPException- if thisSOAPFaultobject already contains a validDetailobject
-
setFaultCode
Sets thisSOAPFaultobject 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 typeQName. 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).- Parameters:
name- aNameobject giving the fault code to be set. It must be namespace qualified.- Throws:
SOAPException- if there was an error in adding thefaultcodeelement to the underlying XML tree
-
getFaultCodeAsName
Name getFaultCodeAsName()Gets the mandatory SOAP 1.1 fault code for thisSOAPFaultobject as a SAAJNameobject. 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 SAAJNameobject. This method should be used instead of thegetFaultCode()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.
- Returns:
- a
Namerepresenting the faultcode
-
setFaultString
Sets the fault string for thisSOAPFaultobject to the given string and localized to the given locale.- Parameters:
faultString- aStringgiving an explanation of the faultlocale- aLocaleobject indicating the native language of thefaultString- Throws:
SOAPException- if there was an error in adding thefaultStringto the underlying XML tree
-
getFaultStringLocale
Locale getFaultStringLocale()Returns the optional detail element for thisSOAPFaultobject.- Returns:
- a
Localeobject indicating the native language of the fault string ornullif no locale was specified
-