Interface SOAPFault
-
- All Superinterfaces:
Element,Node,Node,SOAPBodyElement,SOAPElement
public interface SOAPFault extends SOAPBodyElement
An element in theSOAPBodyobject that contains error and/or status information. This information may relate to errors in theSOAPMessageobject 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.Depending on the
protocolspecified while creating theMessageFactoryinstance, aSOAPFaulthas sub-elements as defined in the SOAP 1.1/SOAP 1.2 specification.- Since:
- 1.6
-
-
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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description DetailaddDetail()Creates an optionalDetailobject and sets it as theDetailobject for thisSOAPFaultobject.voidaddFaultReasonText(String text, Locale locale)Appends or replaces a Reason Text item containing the specified text message and an xml:lang derived fromlocale.voidappendFaultSubcode(QName subcode)Adds a Subcode to the end of the sequence of Subcodes contained by thisSOAPFault.DetailgetDetail()Returns the optional 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.QNamegetFaultCodeAsQName()Gets the fault code for thisSOAPFaultobject as aQNameobject.StringgetFaultNode()Returns the optional Node element value for thisSOAPFaultobject.Iterator<Locale>getFaultReasonLocales()Returns anIteratorover a distinct sequence ofLocales for which there are associated Reason Text items.StringgetFaultReasonText(Locale locale)Returns the Reason Text associated with the givenLocale.Iterator<String>getFaultReasonTexts()Returns anIteratorover a sequence ofStringobjects containing all of the Reason Text items for thisSOAPFault.StringgetFaultRole()Returns the optional Role element value for thisSOAPFaultobject.StringgetFaultString()Gets the fault string for thisSOAPFaultobject.LocalegetFaultStringLocale()Gets the locale of the fault string for thisSOAPFaultobject.Iterator<QName>getFaultSubcodes()Gets the Subcodes for thisSOAPFaultas an iterator overQNames.booleanhasDetail()Returns true if thisSOAPFaulthas aDetailsubelement and false otherwise.voidremoveAllFaultSubcodes()Removes any Subcodes that may be contained by thisSOAPFault.voidsetFaultActor(String faultActor)Sets thisSOAPFaultobject with the given fault actor.voidsetFaultCode(Name faultCodeQName)Sets thisSOAPFaultobject with the given fault code.voidsetFaultCode(String faultCode)Sets thisSOAPFaultobject with the give fault code.voidsetFaultCode(QName faultCodeQName)Sets thisSOAPFaultobject with the given fault code.voidsetFaultNode(String uri)Creates or replaces any existing Node element value for thisSOAPFaultobject.voidsetFaultRole(String uri)Creates or replaces any existing Role element value for thisSOAPFaultobject.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, setIdAttributeNS
-
Methods inherited from interface jakarta.xml.soap.Node
detachNode, getParentElement, getValue, recycleNode, setParentElement, setValue
-
Methods 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, setUserData
-
Methods inherited from interface jakarta.xml.soap.SOAPElement
addAttribute, addAttribute, addChildElement, addChildElement, addChildElement, addChildElement, addChildElement, addChildElement, addNamespaceDeclaration, addTextNode, createQName, getAllAttributes, getAllAttributesAsQNames, getAttributeValue, getAttributeValue, getChildElements, getChildElements, getChildElements, getElementName, getElementQName, getEncodingStyle, getNamespacePrefixes, getNamespaceURI, getVisibleNamespacePrefixes, removeAttribute, removeAttribute, removeContents, removeNamespaceDeclaration, setElementQName, setEncodingStyle
-
-
-
-
Method Detail
-
setFaultCode
void setFaultCode(Name faultCodeQName) throws SOAPException
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 type
Name. This method provides a convenient way to set a fault code. For example,
It is preferable to use this method overSOAPEnvelope 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);setFaultCode(String).- Parameters:
faultCodeQName- aNameobject 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.- Since:
- 1.6, SAAJ 1.2
- See Also:
getFaultCodeAsName()
-
setFaultCode
void setFaultCode(QName faultCodeQName) throws SOAPException
Sets thisSOAPFaultobject with the given fault code. It is preferable to use this method oversetFaultCode(Name).- Parameters:
faultCodeQName- aQNameobject 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.- Since:
- 1.6, SAAJ 1.3
- See Also:
getFaultCodeAsQName(),setFaultCode(Name),getFaultCodeAsQName()
-
setFaultCode
void setFaultCode(String faultCode) throws SOAPException
Sets thisSOAPFaultobject with the give fault code.Fault codes, which given information about the fault, are defined in the SOAP 1.1 specification. This element is mandatory in SOAP 1.1. Because the fault code is required to be a QName it is preferable to use the
setFaultCode(Name)form of this method.- Parameters:
faultCode- aStringgiving the fault code to be set. It must be of the form "prefix:localName" where the prefix has been defined in a namespace declaration.- Throws:
SOAPException- if there was an error in adding thefaultCodeto the underlying XML tree.- See Also:
setFaultCode(Name),getFaultCode(),SOAPElement.addNamespaceDeclaration(java.lang.String, java.lang.String)
-
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 SAAJ Name object. This method should be used instead of thegetFaultCodemethod since it allows applications to easily access the namespace name without additional parsing.- Returns:
- a
Namerepresenting the faultcode - Since:
- 1.6, SAAJ 1.2
- See Also:
setFaultCode(Name)
-
getFaultCodeAsQName
QName getFaultCodeAsQName()
Gets the fault code for thisSOAPFaultobject as aQNameobject.- Returns:
- a
QNamerepresenting the faultcode - Since:
- 1.6, SAAJ 1.3
- See Also:
setFaultCode(QName)
-
getFaultSubcodes
Iterator<QName> getFaultSubcodes()
Gets the Subcodes for thisSOAPFaultas an iterator overQNames.- Returns:
- an
Iteratorthat accesses a sequence ofQNames. ThisIteratorshould not support the optionalremovemethod. The order in which the Subcodes are returned reflects the hierarchy of Subcodes present in the fault from top to bottom. - Throws:
UnsupportedOperationException- if this message does not support the SOAP 1.2 concept of Subcode.- Since:
- 1.6, SAAJ 1.3
-
removeAllFaultSubcodes
void removeAllFaultSubcodes()
Removes any Subcodes that may be contained by thisSOAPFault. Subsequent calls togetFaultSubcodeswill return an empty iterator until a call toappendFaultSubcodeis made.- Throws:
UnsupportedOperationException- if this message does not support the SOAP 1.2 concept of Subcode.- Since:
- 1.6, SAAJ 1.3
-
appendFaultSubcode
void appendFaultSubcode(QName subcode) throws SOAPException
Adds a Subcode to the end of the sequence of Subcodes contained by thisSOAPFault. Subcodes, which were introduced in SOAP 1.2, are represented by a recursive sequence of subelements rooted in the mandatory Code subelement of a SOAP Fault.- Parameters:
subcode- a QName containing the Value of the Subcode.- Throws:
SOAPException- if there was an error in setting the SubcodeUnsupportedOperationException- if this message does not support the SOAP 1.2 concept of Subcode.- Since:
- 1.6, SAAJ 1.3
-
getFaultCode
String getFaultCode()
Gets the fault code for thisSOAPFaultobject.- Returns:
- a
Stringwith the fault code - See Also:
getFaultCodeAsName(),setFaultCode(jakarta.xml.soap.Name)
-
setFaultActor
void setFaultActor(String faultActor) throws SOAPException
Sets thisSOAPFaultobject with the given fault actor.The fault actor is the recipient in the message path who caused the fault to happen.
If this
SOAPFaultsupports SOAP 1.2 then this call is equivalent tosetFaultRole(String)- 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.If this
SOAPFaultsupports SOAP 1.2 then this call is equivalent togetFaultRole()- Returns:
- a
Stringgiving the actor in the message path that caused thisSOAPFaultobject - See Also:
setFaultActor(java.lang.String)
-
setFaultString
void setFaultString(String faultString) throws SOAPException
Sets the fault string for thisSOAPFaultobject to the given string.If this
SOAPFaultis part of a message that supports SOAP 1.2 then this call is equivalent to:addFaultReasonText(faultString, Locale.getDefault());- 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()
-
setFaultString
void setFaultString(String faultString, Locale locale) throws SOAPException
Sets the fault string for thisSOAPFaultobject to the given string and localized to the given locale.If this
SOAPFaultis part of a message that supports SOAP 1.2 then this call is equivalent to:addFaultReasonText(faultString, 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.- Since:
- 1.6, SAAJ 1.2
- See Also:
getFaultString()
-
getFaultString
String getFaultString()
Gets the fault string for thisSOAPFaultobject.If this
SOAPFaultis part of a message that supports SOAP 1.2 then this call is equivalent to:String reason = null; try { reason = (String) getFaultReasonTexts().next(); } catch (SOAPException e) {} return reason;- Returns:
- a
Stringgiving an explanation of the fault - See Also:
setFaultString(String),setFaultString(String, Locale)
-
getFaultStringLocale
Locale getFaultStringLocale()
Gets the locale of the fault string for thisSOAPFaultobject.If this
SOAPFaultis part of a message that supports SOAP 1.2 then this call is equivalent to:Locale locale = null; try { locale = (Locale) getFaultReasonLocales().next(); } catch (SOAPException e) {} return locale;- Returns:
- a
Localeobject indicating the native language of the fault string ornullif no locale was specified - Since:
- 1.6, SAAJ 1.2
- See Also:
setFaultString(String, Locale)
-
hasDetail
boolean hasDetail()
Returns true if thisSOAPFaulthas aDetailsubelement and false otherwise. Equivalent to(getDetail()!=null).- Returns:
- true if this
SOAPFaulthas aDetailsubelement and false otherwise. - Since:
- 1.6, SAAJ 1.3
-
getDetail
Detail getDetail()
Returns the optional detail element for thisSOAPFaultobject.A
Detailobject carries application-specific error information, the scope of the error information is restricted to faults in theSOAPBodyElementobjects if this is a SOAP 1.1 Fault.- Returns:
- a
Detailobject with application-specific error information if present, null otherwise
-
addDetail
Detail addDetail() throws SOAPException
Creates an optionalDetailobject 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
-
getFaultReasonLocales
Iterator<Locale> getFaultReasonLocales() throws SOAPException
Returns anIteratorover a distinct sequence ofLocales for which there are associated Reason Text items. Any of theseLocales can be used in a call togetFaultReasonTextin order to obtain a localized version of the Reason Text string.- Returns:
- an
Iteratorover a sequence ofLocaleobjects for which there are associated Reason Text items. - Throws:
SOAPException- if there was an error in retrieving the fault Reason locales.UnsupportedOperationException- if this message does not support the SOAP 1.2 concept of Fault Reason.- Since:
- 1.6, SAAJ 1.3
-
getFaultReasonTexts
Iterator<String> getFaultReasonTexts() throws SOAPException
Returns anIteratorover a sequence ofStringobjects containing all of the Reason Text items for thisSOAPFault.- Returns:
- an
Iteratorover env:Fault/env:Reason/env:Text items. - Throws:
SOAPException- if there was an error in retrieving the fault Reason texts.UnsupportedOperationException- if this message does not support the SOAP 1.2 concept of Fault Reason.- Since:
- 1.6, SAAJ 1.3
-
getFaultReasonText
String getFaultReasonText(Locale locale) throws SOAPException
Returns the Reason Text associated with the givenLocale. If more than one such Reason Text exists the first matching Text is returned- Parameters:
locale- -- theLocalefor which a localized Reason Text is desired- Returns:
- the Reason Text associated with
locale - Throws:
SOAPException- if there was an error in retrieving the fault Reason text for the specified locale .UnsupportedOperationException- if this message does not support the SOAP 1.2 concept of Fault Reason.- Since:
- 1.6, SAAJ 1.3
- See Also:
getFaultString()
-
addFaultReasonText
void addFaultReasonText(String text, Locale locale) throws SOAPException
Appends or replaces a Reason Text item containing the specified text message and an xml:lang derived fromlocale. If a Reason Text item with this xml:lang already exists its text value will be replaced withtext. Thelocaleparameter should not benullCode sample:
SOAPFault fault = ...; fault.addFaultReasonText("Version Mismatch", Locale.ENGLISH);- Parameters:
text- -- reason message stringlocale- -- Locale object representing the locale of the message- Throws:
SOAPException- if there was an error in adding the Reason text or thelocalepassed wasnull.UnsupportedOperationException- if this message does not support the SOAP 1.2 concept of Fault Reason.- Since:
- 1.6, SAAJ 1.3
-
getFaultNode
String getFaultNode()
Returns the optional Node element value for thisSOAPFaultobject. The Node element is optional in SOAP 1.2.- Returns:
- Content of the env:Fault/env:Node element as a String
or
nullif none - Throws:
UnsupportedOperationException- if this message does not support the SOAP 1.2 concept of Fault Node.- Since:
- 1.6, SAAJ 1.3
-
setFaultNode
void setFaultNode(String uri) throws SOAPException
Creates or replaces any existing Node element value for thisSOAPFaultobject. The Node element is optional in SOAP 1.2.- Parameters:
uri- the URI of the Node- Throws:
SOAPException- if there was an error in setting the Node for thisSOAPFaultobject.UnsupportedOperationException- if this message does not support the SOAP 1.2 concept of Fault Node.- Since:
- 1.6, SAAJ 1.3
-
getFaultRole
String getFaultRole()
Returns the optional Role element value for thisSOAPFaultobject. The Role element is optional in SOAP 1.2.- Returns:
- Content of the env:Fault/env:Role element as a String
or
nullif none - Throws:
UnsupportedOperationException- if this message does not support the SOAP 1.2 concept of Fault Role.- Since:
- 1.6, SAAJ 1.3
-
setFaultRole
void setFaultRole(String uri) throws SOAPException
Creates or replaces any existing Role element value for thisSOAPFaultobject. The Role element is optional in SOAP 1.2.- Parameters:
uri- the URI of the Role- Throws:
SOAPException- if there was an error in setting the Role for thisSOAPFaultobject.UnsupportedOperationException- if this message does not support the SOAP 1.2 concept of Fault Role.- Since:
- 1.6, SAAJ 1.3
-
-