is new.
public interface SOAPFault
An element in the 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.
Depending on the protocol specified while creating the MessageFactory instance, a SOAPFault has sub-elements as defined in the SOAP 1.1/SOAP 1.2 specification.
| 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 | |
|---|---|
| Detail |
addDetail
() Creates an optional Detail object and sets it as the Detail object for this SOAPFault object. |
| void |
addFaultReasonText
(
String
text,
Locale
locale) Appends or replaces a Reason Text item containing the specified text message and an xml:lang derived from locale. |
| void |
appendFaultSubcode
(
QName
subcode) Adds a Subcode to the end of the sequence of Subcodes contained by this SOAPFault. |
| Detail |
getDetail
() Returns the optional detail element for this SOAPFault object. |
| String |
getFaultActor
() Gets the fault actor for this SOAPFault object. |
| String |
getFaultCode
() Gets the fault code for this SOAPFault object. |
| Name |
getFaultCodeAsName
() Gets the mandatory SOAP 1.1 fault code for this SOAPFault object as a SAAJ Name object. |
| QName |
getFaultCodeAsQName
() Gets the fault code for this SOAPFault object as a QName object. |
| String |
getFaultNode
() Returns the optional Node element value for this SOAPFault object. |
| Iterator |
getFaultReasonLocales
() Returns an Iterator over a distinct sequence of Locales for which there are associated Reason Text items. |
| String |
getFaultReasonText
(
Locale
locale) Returns the Reason Text associated with the given Locale. |
| Iterator |
getFaultReasonTexts
() Returns an Iterator over a sequence of String objects containing all of the Reason Text items for this SOAPFault. |
| String |
getFaultRole
() Returns the optional Role element value for this SOAPFault object. |
| String |
getFaultString
() Gets the fault string for this SOAPFault object. |
| Locale |
getFaultStringLocale
() Gets the locale of the fault string for this SOAPFault object. |
| Iterator |
getFaultSubcodes
() Gets the
Subcodes
as an iterator over QNames.
|
| boolean |
hasDetail
() Returns true if this SOAPFault has a Detail subelement and false otherwise. |
| void |
removeAllFaultSubcodes
() Removes any Subcodes that may be contained by this SOAPFault. |
| void |
setFaultActor
(
String
faultActor) Sets this SOAPFault object with the given fault actor. |
| void |
setFaultCode
(
Name
faultCodeQName) Sets this SOAPFault object with the given fault code. |
| void |
setFaultCode
(
QName
faultCodeQName) Sets this SOAPFault object with the given fault code. |
| void |
setFaultCode
(
String
faultCode) Sets this SOAPFault object with the give fault code. |
| void |
setFaultNode
(
String
uri) Creates or replaces any existing Node element value for this SOAPFault object. |
| void |
setFaultRole
(
String
uri) Creates or replaces any existing Role element value for this SOAPFault object. |
| void |
setFaultString
(
String
faultString) Sets the fault string for this SOAPFault object to the given string. |
| void |
setFaultString
(
String
faultString,
Locale
locale) Sets the fault string for this SOAPFault object to the given string and localized to the given locale. |
| Methods inherited from interface javax.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
|
| Methods inherited from interface javax.xml.soap. Node |
|---|
| detachNode , getParentElement , getValue , recycleNode , setParentElement , setValue |
| 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 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 |
| Method Detail |
|---|
void setFaultCode(Name faultCodeQName)
throws SOAPException
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.
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)
.
SAAJ 1.2
void setFaultCode(QName faultCodeQName)
throws SOAPException
SAAJ 1.3
void setFaultCode(String faultCode)
throws SOAPException
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.
Name getFaultCodeAsName()
SAAJ 1.2
QName getFaultCodeAsQName()
SAAJ 1.3
Iterator getFaultSubcodes()
SAAJ 1.3
void removeAllFaultSubcodes()
SAAJ 1.3
void appendFaultSubcode(QName subcode)
throws SOAPException
SAAJ 1.3
String getFaultCode()
void setFaultActor(String faultActor)
throws SOAPException
The fault actor is the recipient in the message path who caused the fault to happen.
If this SOAPFault supports SOAP 1.2 then this call is equivalent to setFaultRole(String)
String getFaultActor()
If this SOAPFault supports SOAP 1.2 then this call is equivalent to getFaultRole()
void setFaultString(String faultString)
throws SOAPException
If this SOAPFault is part of a message that supports SOAP 1.2 then this call is equivalent to:
addFaultReasonText(faultString, Locale.getDefault());
void setFaultString(String faultString,
Locale locale)
throws SOAPException
If this SOAPFault is part of a message that supports SOAP 1.2 then this call is equivalent to:
addFaultReasonText(faultString, locale);
SAAJ 1.2
String getFaultString()
If this SOAPFault is 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;
Locale getFaultStringLocale()
If this SOAPFault is 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;
SAAJ 1.2
boolean hasDetail()
SAAJ 1.3
Detail getDetail()
A Detail object carries application-specific error information, the scope of the error information is restricted to faults in the SOAPBodyElement objects if this is a SOAP 1.1 Fault.
Detail addDetail()
throws SOAPException
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.
Iterator getFaultReasonLocales()
throws SOAPException
SAAJ 1.3
Iterator getFaultReasonTexts()
throws SOAPException
SAAJ 1.3
String getFaultReasonText(Locale locale)
throws SOAPException
SAAJ 1.3
void addFaultReasonText(String text,
Locale locale)
throws SOAPException
Code sample:
SOAPFault fault = ...;
fault.addFaultReasonText("Version Mismatch", Locale.ENGLISH);
SAAJ 1.3
String getFaultNode()
SAAJ 1.3
void setFaultNode(String uri)
throws SOAPException
SAAJ 1.3
String getFaultRole()
SAAJ 1.3
void setFaultRole(String uri)
throws SOAPException
SAAJ 1.3