org.apache.axis2.saaj
Class SOAPFaultImpl

java.lang.Object
  extended by org.apache.axiom.om.impl.dom.NodeImpl
      extended by org.apache.axis2.saaj.NodeImplEx
          extended by org.apache.axis2.saaj.SOAPElementImpl
              extended by org.apache.axis2.saaj.SOAPBodyElementImpl
                  extended by org.apache.axis2.saaj.SOAPFaultImpl
All Implemented Interfaces:
java.lang.Cloneable, SOAPBodyElement, SOAPElement, SOAPFault, org.apache.axiom.om.impl.OMNodeEx, org.apache.axiom.om.OMNode, org.w3c.dom.Element, org.w3c.dom.Node, org.w3c.dom.NodeList

public class SOAPFaultImpl
extends SOAPBodyElementImpl
implements SOAPFault


Field Summary
protected  org.apache.axiom.soap.SOAPFault fault
           
 
Fields inherited from class org.apache.axis2.saaj.SOAPElementImpl
element
 
Fields inherited from class org.apache.axis2.saaj.NodeImplEx
parentElement
 
Fields inherited from class org.apache.axiom.om.impl.dom.NodeImpl
builder, done, factory, FIRSTCHILD, flags, NORMALIZED, OWNED, ownerNode, READONLY, SPECIFIED
 
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
 
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
 
Fields inherited from interface org.apache.axiom.om.OMNode
DTD_NODE, PI_NODE, SPACE_NODE
 
Constructor Summary
SOAPFaultImpl(org.apache.axiom.soap.SOAPFault fault)
           
 
Method Summary
 Detail addDetail()
          Creates a Detail object and sets it as the Detail object for this SOAPFault object.
 void addFaultReasonText(java.lang.String text, java.util.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.
 java.util.Iterator getChildElements()
          Returns an iterator over all the immediate content of this element.
 java.util.Iterator getChildElements(Name name)
          Returns an iterator over all the child elements with the specified name.
 Detail getDetail()
          Returns the detail element for this SOAPFault object.
 java.lang.String getFaultActor()
          Gets the fault actor for this SOAPFault object.
 java.lang.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.
 java.lang.String getFaultNode()
          Returns the optional Node element value for this SOAPFault object.
 java.util.Iterator getFaultReasonLocales()
          Returns an Iterator over a distinct sequence of Locales for which there are associated Reason Text items.
 java.lang.String getFaultReasonText(java.util.Locale locale)
          Returns the Reason Text associated with the given Locale.
 java.util.Iterator getFaultReasonTexts()
          Returns an Iterator over a sequence of String objects containing all of the Reason Text items for this SOAPFault.
 java.lang.String getFaultRole()
          Returns the optional Role element value for this SOAPFault object.
 java.lang.String getFaultString()
          Gets the fault string for this SOAPFault object.
 java.util.Locale getFaultStringLocale()
          Gets the locale of the fault string for this SOAPFault object.
 java.util.Iterator getFaultSubcodes()
          Gets the Subcodes for this SOAPFault 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(java.lang.String faultActor)
          Sets this SOAPFault object with the given fault actor.The fault actor is the recipient in the message path who caused the fault to happen.
 void setFaultCode(Name faultCodeName)
          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.
 void setFaultCode(QName qname)
          Sets this SOAPFault object with the given fault code.
 void setFaultCode(java.lang.String faultCode)
          Sets this SOAPFault object with the given fault code.
 void setFaultNode(java.lang.String s)
          Creates or replaces any existing Node element value for this SOAPFault object.
 void setFaultRole(java.lang.String uri)
          Creates or replaces any existing Role element value for this SOAPFault object.
 void setFaultString(java.lang.String faultString)
          Sets the fault string for this SOAPFault object to the given string.
 void setFaultString(java.lang.String faultString, java.util.Locale locale)
          Sets the fault string for this SOAPFault object to the given string.
 
Methods inherited from class org.apache.axis2.saaj.SOAPBodyElementImpl
addAttribute, addChildElement, createQName, getAllAttributesAsQNames, getAttributeValue, getChildElements, getElementQName, removeAttribute, setElementQName, setParentElement
 
Methods inherited from class org.apache.axis2.saaj.SOAPElementImpl
addAttribute, addChildElement, addChildElement, addChildElement, addChildElement, addChildElement, addNamespaceDeclaration, addTextNode, detach, detachNode, discard, getAllAttributes, getAttribute, getAttributeNode, getAttributeNodeNS, getAttributeNS, getAttributes, getAttributeValue, getChildNodes, getElement, getElementName, getElementsByTagName, getElementsByTagNameNS, getEncodingStyle, getFirstChild, getLastChild, getLocalName, getNamespacePrefixes, getNamespaceURI, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getOwnerDocument, getParentElement, getParentNode, getPrefix, getPreviousSibling, getTagName, getValue, getVisibleNamespacePrefixes, hasAttribute, hasAttributeNS, hasChildNodes, internalSerialize, internalSerializeAndConsume, removeAttribute, removeAttribute, removeAttributeNode, removeAttributeNS, removeContents, removeNamespaceDeclaration, setAttribute, setAttributeNode, setAttributeNodeNS, setAttributeNS, setEncodingStyle, setParent, setValue, toString
 
Methods inherited from class org.apache.axis2.saaj.NodeImplEx
getParent, getSchemaTypeInfo, getType, recycleNode, setIdAttribute, setIdAttributeNode, setIdAttributeNS, setType
 
Methods inherited from class org.apache.axiom.om.impl.dom.NodeImpl
appendChild, build, buildWithAttachments, cloneNode, close, compareDocumentPosition, getBaseURI, getFeature, getLength, getNextOMSibling, getNodeValue, getOMFactory, getPreviousOMSibling, getTextContent, getUserData, hasAttributes, insertBefore, insertSiblingAfter, insertSiblingBefore, internalSerializeWithCache, isComplete, isDefaultNamespace, isEqualNode, isSameNode, isSupported, item, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, serialize, serialize, serialize, serialize, serialize, serializeAndConsume, serializeAndConsume, serializeAndConsume, serializeAndConsume, serializeAndConsume, setComplete, setNextOMSibling, setNodeValue, setOwnerDocument, setPrefix, setPreviousOMSibling, setTextContent, setUserData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.xml.soap.SOAPElement
addAttribute, addAttribute, addChildElement, addChildElement, addChildElement, addChildElement, addChildElement, addChildElement, addNamespaceDeclaration, addTextNode, createQName, getAllAttributes, getAllAttributesAsQNames, getAttributeValue, getAttributeValue, 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.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 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
 

Field Detail

fault

protected org.apache.axiom.soap.SOAPFault fault
Constructor Detail

SOAPFaultImpl

public SOAPFaultImpl(org.apache.axiom.soap.SOAPFault fault)
Parameters:
fault -
Method Detail

setFaultCode

public void setFaultCode(java.lang.String faultCode)
                  throws SOAPException
Sets this SOAPFault object with the given 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.

Specified by:
setFaultCode in interface SOAPFault
Parameters:
faultCode - - a String giving 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 the faultCode to the underlying XML tree.
See Also:
setFaultCode(Name), getFaultCode(),SOAPElement.addNamespaceDeclaration(String, String)

getFaultCode

public java.lang.String getFaultCode()
Gets the fault code for this SOAPFault object.

Specified by:
getFaultCode in interface SOAPFault
Returns:
a String with the fault code
See Also:
setFaultCode(java.lang.String)

setFaultActor

public void setFaultActor(java.lang.String faultActor)
                   throws SOAPException
Sets this SOAPFault object with the given fault actor.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)

Specified by:
setFaultActor in interface SOAPFault
Parameters:
faultActor - - a String identifying the actor that caused this SOAPFault 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()
Description copied from interface: SOAPFault
Gets the fault actor for this SOAPFault object.

Specified by:
getFaultActor in interface SOAPFault
Returns:
a String giving the actor in the message path that caused this SOAPFault object
See Also:
setFaultActor(java.lang.String)

setFaultString

public void setFaultString(java.lang.String faultString)
                    throws SOAPException
Sets the fault string for this SOAPFault 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()
Description copied from interface: SOAPFault
Gets the fault string for this SOAPFault object.

Specified by:
getFaultString in interface SOAPFault
Returns:
a String giving an explanation of the fault

getDetail

public Detail getDetail()
Description copied from interface: SOAPFault
Returns the detail element for this SOAPFault 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

setFaultCode

public void setFaultCode(Name faultCodeName)
                  throws SOAPException
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.

addDetail

public Detail addDetail()
                 throws SOAPException
Description copied from interface: SOAPFault
Creates a Detail object and sets it as the Detail object for this SOAPFault 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 SOAPFault object already contains a valid Detail object

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
Sets the fault string for this SOAPFault object to the given string. If this SOAPFault is part of a message that supports SOAP 1.2 then this call is equivalent to: addFaultReasonText(faultString, Locale.getDefault());

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.
See Also:
getFaultString()

getFaultStringLocale

public java.util.Locale getFaultStringLocale()
Gets the locale of the fault string for this SOAPFault object. 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;

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
Since:
SAAJ 1.2
See Also:
setFaultString(String, Locale)

addFaultReasonText

public void addFaultReasonText(java.lang.String text,
                               java.util.Locale locale)
                        throws SOAPException
Appends or replaces a Reason Text item containing the specified text message and an xml:lang derived from locale. If a Reason Text item with this xml:lang already exists its text value will be replaced with text. The locale parameter should not be null Code sample: SOAPFault fault = ...; fault.addFaultReasonText(Version Mismatch, Locale.ENGLISH);

Specified by:
addFaultReasonText in interface SOAPFault
Parameters:
text - - reason message string locale - Locale object representing the locale of the message
Throws:
SOAPException - - if there was an error in adding the Reason text or the locale passed was null. java.lang.UnsupportedOperationException - if this message does not support the SOAP 1.2 concept of Fault Reason.

appendFaultSubcode

public void appendFaultSubcode(QName subcode)
                        throws SOAPException
Adds a Subcode to the end of the sequence of Subcodes contained by this SOAPFault. 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.

Specified by:
appendFaultSubcode in interface SOAPFault
Parameters:
subcode - - a QName containing the Value of the Subcode.
Throws:
SOAPException - - if there was an error in setting the Subcode java.lang.UnsupportedOperationException - if this message does not support the SOAP 1.2 concept of Subcode.

getFaultCodeAsQName

public QName getFaultCodeAsQName()
Gets the fault code for this SOAPFault object as a QName object.

Specified by:
getFaultCodeAsQName in interface SOAPFault

getFaultNode

public java.lang.String getFaultNode()
Returns the optional Node element value for this SOAPFault object. The Node element is optional in SOAP 1.2.

Specified by:
getFaultNode in interface SOAPFault
Returns:
Content of the env:Fault/env:Node element as a String or null if none
Throws:
java.lang.UnsupportedOperationException - - if this message does not support the SOAP 1.2 concept of Fault Node.

getFaultReasonLocales

public java.util.Iterator getFaultReasonLocales()
                                         throws SOAPException
Returns an Iterator over a distinct sequence of Locales for which there are associated Reason Text items. Any of these Locales can be used in a call to getFaultReasonText in order to obtain a localized version of the Reason Text string.

Specified by:
getFaultReasonLocales in interface SOAPFault
Returns:
an Iterator over a sequence of Locale objects for which there are associated Reason Text items.
Throws:
SOAPException - - if there was an error in retrieving the fault Reason locales. java.lang.UnsupportedOperationException - if this message does not support the SOAP 1.2 concept of Fault Reason.
Since:
SAAJ 1.3

getFaultReasonText

public java.lang.String getFaultReasonText(java.util.Locale locale)
                                    throws SOAPException
Returns the Reason Text associated with the given Locale. If more than one such Reason Text exists the first matching Text is returned

Specified by:
getFaultReasonText in interface SOAPFault
Parameters:
locale - - the Locale for 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. java.lang.UnsupportedOperationException - if this message does not support the SOAP 1.2 concept of Fault Reason.
Since:
SAAJ 1.3

getFaultReasonTexts

public java.util.Iterator getFaultReasonTexts()
                                       throws SOAPException
Returns an Iterator over a sequence of String objects containing all of the Reason Text items for this SOAPFault.

Specified by:
getFaultReasonTexts in interface SOAPFault
Throws:
SOAPException - if there is an error in retrieving texts for Reason objects java.lang.UnsupportedOperationException - if this message does not support the SOAP 1.2 concept of Fault Reason.

getFaultRole

public java.lang.String getFaultRole()
Returns the optional Role element value for this SOAPFault object. The Role element is optional in SOAP 1.2.

Specified by:
getFaultRole in interface SOAPFault
Returns:
Content of the env:Fault/env:Role element as a String or null if none
Throws:
java.lang.UnsupportedOperationException - - if this message does not support the SOAP 1.2 concept of Fault Role.
Since:
SAAJ 1.3

getFaultSubcodes

public java.util.Iterator getFaultSubcodes()
Gets the Subcodes for this SOAPFault as an iterator over QNames.

Specified by:
getFaultSubcodes in interface SOAPFault
Returns:
an Iterator that accesses a sequence of QNames. This Iterator should not support the optional remove method. The order in which the Subcodes are returned reflects the hierarchy of Subcodes present in the fault from top to bottom.
Throws:
java.lang.UnsupportedOperationException - - if this message does not support the SOAP 1.2 concept of Subcode.

hasDetail

public boolean hasDetail()
Returns true if this SOAPFault has a Detail subelement and false otherwise.

Specified by:
hasDetail in interface SOAPFault

removeAllFaultSubcodes

public void removeAllFaultSubcodes()
Removes any Subcodes that may be contained by this SOAPFault. Subsequent calls to getFaultSubcodes will return an empty iterator until a call to appendFaultSubcode is made.

Specified by:
removeAllFaultSubcodes in interface SOAPFault
Throws:
java.lang.UnsupportedOperationException - - if this message does not support the SOAP 1.2 concept of Subcode.

setFaultCode

public void setFaultCode(QName qname)
                  throws SOAPException
Sets this SOAPFault object with the given fault code. It is preferable to use this method over setFaultCode(Name)

Specified by:
setFaultCode in interface SOAPFault
Parameters:
faultCodeQName - - a QName 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.
Since:
SAAJ 1.3
See Also:
getFaultCodeAsQName(), setFaultCode(Name), getFaultCodeAsQName()

setFaultNode

public void setFaultNode(java.lang.String s)
                  throws SOAPException
Creates or replaces any existing Node element value for this SOAPFault object. The Node element is optional in SOAP 1.2.

Specified by:
setFaultNode in interface SOAPFault
Throws:
SOAPException - - if there was an error in setting the Node for this SOAPFault object. java.lang.UnsupportedOperationException - if this message does not support the SOAP 1.2 concept of Fault Node.
Since:
SAAJ 1.3

setFaultRole

public void setFaultRole(java.lang.String uri)
                  throws SOAPException
Creates or replaces any existing Role element value for this SOAPFault object. The Role element is optional in SOAP 1.2.

Specified by:
setFaultRole in interface SOAPFault
Parameters:
uri - - the URI of the Role
Throws:
SOAPException - - if there was an error in setting the Role for this SOAPFault object java.lang.UnsupportedOperationException - if this message does not support the SOAP 1.2 concept of Fault Role.

getChildElements

public java.util.Iterator getChildElements(Name name)
Description copied from interface: SOAPElement
Returns an iterator over all the child elements with the specified name.

Specified by:
getChildElements in interface SOAPElement
Overrides:
getChildElements in class SOAPElementImpl
Parameters:
name - a Name object with the name of the child elements to be returned
Returns:
an Iterator object over all the elements in this SOAPElement object with the specified name

getChildElements

public java.util.Iterator getChildElements()
Description copied from class: SOAPElementImpl
Returns an iterator over all the immediate content of this element. This includes Text objects as well as SOAPElement objects.

Specified by:
getChildElements in interface SOAPElement
Overrides:
getChildElements in class SOAPElementImpl
Returns:
an iterator over Text and SOAPElement contained within this SOAPElement object


Copyright © 2007 Apache Web Services Project. All Rights Reserved.