org.apache.axis2.saaj
Class SOAPBodyImpl

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.SOAPBodyImpl
All Implemented Interfaces:
Cloneable, SOAPBody, SOAPElement, Element, Node, NodeList

public class SOAPBodyImpl
extends SOAPElementImpl
implements SOAPBody


Field Summary
 
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, HAS_PARENT, 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
 
Constructor Summary
SOAPBodyImpl(org.apache.axiom.soap.SOAPBody omSOAPBody)
           
 
Method Summary
 SOAPElement addAttribute(QName qname, String value)
           
 SOAPBodyElement addBodyElement(Name name)
          Creates a new SOAPBodyElement object with the specified name and adds it to this SOAPBody object.
 SOAPBodyElement addBodyElement(QName qname)
          Creates a new SOAPBodyElement object with the specified name and adds it to this SOAPBody object.
 SOAPElement addChildElement(QName qname)
           
 SOAPElement addChildElement(SOAPElement soapElement)
           
 SOAPElement addChildElement(String localName)
           
 SOAPElement addChildElement(String localName, String prefix)
           
 SOAPElement addChildElement(String localName, String prefix, String uri)
           
 SOAPBodyElement addDocument(Document document)
          Adds the root node of the DOM Document to this SOAPBody object.
 SOAPFault addFault()
          Creates a new SOAPFault object and adds it to this SOAPBody object.
 SOAPFault addFault(Name faultCode, String faultString)
          Creates a new SOAPFault object and adds it to this SOAPBody object.
 SOAPFault addFault(Name faultCode, String faultString, Locale locale)
          Creates a new SOAPFault object and adds it to this SOAPBody object.
 SOAPFault addFault(QName faultcode, String faultString)
           
 SOAPFault addFault(QName faultCode, String faultString, Locale locale)
          Creates a new SOAPFault object and adds it to this SOAPBody object.
 SOAPElement addTextNode(String text)
          Creates a new Text object initialized with the given String and adds it to this SOAPElement object.
protected  Element appendElement(org.apache.axiom.om.impl.dom.ElementImpl child)
           
 QName createQName(String localName, String prefix)
          Creates a QName whose namespace URI is the one associated with the parameter, prefix, in the context of this SOAPElement.
 org.apache.axiom.om.OMNode detach()
           
 void detachNode()
          Removes this Node object from the tree.
 Document extractContentAsDocument()
          Creates a new DOM org.w3c.dom.Document and sets the first child of this SOAPBody as its document element.
 Iterator getAllAttributesAsQNames()
           
 String getAttributeValue(QName qname)
           
 Iterator getChildElements()
          Returns an iterator over all the immediate content of this element.
 Iterator getChildElements(Name name)
           
 Iterator getChildElements(QName qname)
           
 QName getElementQName()
           
 SOAPFault getFault()
          Returns the SOAPFault object in this SOAPBody object.
 boolean hasFault()
          Indicates whether a SOAPFault object exists in this SOAPBody object.
 boolean removeAttribute(QName qname)
           
 SOAPElement setElementQName(QName qname)
           
 
Methods inherited from class org.apache.axis2.saaj.SOAPElementImpl
addAttribute, addChildElement, addNamespaceDeclaration, appendChild, appendText, clone, copyContents, 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, getTextContent, getValue, getVisibleNamespacePrefixes, hasAttribute, hasAttributeNS, hasChildNodes, internalSerialize, removeAttribute, removeAttribute, removeAttributeNode, removeAttributeNS, removeChild, removeContents, removeNamespaceDeclaration, setAttribute, setAttributeNode, setAttributeNodeNS, setAttributeNS, setEncodingStyle, setParent, setParentElement, 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
cloneNode, compareDocumentPosition, getBaseURI, getFeature, getLength, getNodeValue, getOMFactory, getUserData, hasAttributes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, item, lookupNamespaceURI, lookupPrefix, normalize, replaceChild, setNodeValue, setPrefix, setTextContent, setUserData
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.xml.soap.SOAPElement
addAttribute, addChildElement, addNamespaceDeclaration, getAllAttributes, getAttributeValue, getElementName, getEncodingStyle, getNamespacePrefixes, getNamespaceURI, getVisibleNamespacePrefixes, removeAttribute, removeContents, removeNamespaceDeclaration, setEncodingStyle
 
Methods inherited from interface javax.xml.soap.Node
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
 

Constructor Detail

SOAPBodyImpl

public SOAPBodyImpl(org.apache.axiom.soap.SOAPBody omSOAPBody)
Parameters:
omSOAPBody -
Method Detail

addChildElement

public SOAPElement addChildElement(String localName)
                            throws SOAPException
Specified by:
addChildElement in interface SOAPElement
Overrides:
addChildElement in class SOAPElementImpl
Throws:
SOAPException

addChildElement

public SOAPElement addChildElement(String localName,
                                   String prefix)
                            throws SOAPException
Specified by:
addChildElement in interface SOAPElement
Overrides:
addChildElement in class SOAPElementImpl
Throws:
SOAPException

appendElement

protected Element appendElement(org.apache.axiom.om.impl.dom.ElementImpl child)
                         throws SOAPException
Overrides:
appendElement in class SOAPElementImpl
Throws:
SOAPException

addChildElement

public SOAPElement addChildElement(SOAPElement soapElement)
                            throws SOAPException
Specified by:
addChildElement in interface SOAPElement
Overrides:
addChildElement in class SOAPElementImpl
Throws:
SOAPException

addChildElement

public SOAPElement addChildElement(String localName,
                                   String prefix,
                                   String uri)
                            throws SOAPException
Specified by:
addChildElement in interface SOAPElement
Overrides:
addChildElement in class SOAPElementImpl
Throws:
SOAPException

addFault

public SOAPFault addFault()
                   throws SOAPException
Creates a new SOAPFault object and adds it to this SOAPBody object.

Specified by:
addFault in interface SOAPBody
Returns:
the new SOAPFault object
Throws:
SOAPException - if there is a SOAP error

hasFault

public boolean hasFault()
Indicates whether a SOAPFault object exists in this SOAPBody object.

Specified by:
hasFault in interface SOAPBody
Returns:
true if a SOAPFault object exists in this SOAPBody object; false otherwise

getFault

public SOAPFault getFault()
Returns the SOAPFault object in this SOAPBody object.

Specified by:
getFault in interface SOAPBody
Returns:
the SOAPFault object in this SOAPBody object

addBodyElement

public SOAPBodyElement addBodyElement(Name name)
                               throws SOAPException
Creates a new SOAPBodyElement object with the specified name and adds it to this SOAPBody object.

Specified by:
addBodyElement in interface SOAPBody
Parameters:
name - a Name object with the name for the new SOAPBodyElement object
Returns:
the new SOAPBodyElement object
Throws:
SOAPException - if a SOAP error occurs

addFault

public SOAPFault addFault(Name faultCode,
                          String faultString,
                          Locale locale)
                   throws SOAPException
Creates a new SOAPFault object and adds it to this SOAPBody object. The new SOAPFault will have a faultcode element that is set to the faultCode parameter and a faultstring set to faultstring and localized to locale.

Specified by:
addFault in interface SOAPBody
Parameters:
faultCode - a Name object giving the fault code to be set; must be one of the fault codes defined in the SOAP 1.1 specification and of type QName
faultString - a String giving an explanation of the fault
locale - a Locale object indicating the native language of the faultString
Returns:
the new SOAPFault object
Throws:
SOAPException - if there is a SOAP error

addFault

public SOAPFault addFault(Name faultCode,
                          String faultString)
                   throws SOAPException
Creates a new SOAPFault object and adds it to this SOAPBody object. The new SOAPFault will have a faultcode element that is set to the faultCode parameter and a faultstring set to faultstring.

Specified by:
addFault in interface SOAPBody
Parameters:
faultCode - a Name object giving the fault code to be set; must be one of the fault codes defined in the SOAP 1.1 specification and of type QName
faultString - a String giving an explanation of the fault
Returns:
the new SOAPFault object
Throws:
SOAPException - if there is a SOAP error

addDocument

public SOAPBodyElement addDocument(Document document)
                            throws SOAPException
Adds the root node of the DOM Document to this SOAPBody object.

Calling this method invalidates the document parameter. The client application should discard all references to this Document and its contents upon calling addDocument. The behavior of an application that continues to use such references is undefined.

Specified by:
addDocument in interface SOAPBody
Parameters:
document - the Document object whose root node will be added to this SOAPBody
Returns:
the SOAPBodyElement that represents the root node that was added
Throws:
SOAPException - if the Document cannot be added

addBodyElement

public SOAPBodyElement addBodyElement(QName qname)
                               throws SOAPException
Creates a new SOAPBodyElement object with the specified name and adds it to this SOAPBody object.

Specified by:
addBodyElement in interface SOAPBody
Parameters:
qname - a QName object with the name for the new SOAPBodyElement object
Returns:
the new SOAPBodyElement object
Throws:
SOAPException - if a SOAP error occurs

addFault

public SOAPFault addFault(QName faultcode,
                          String faultString)
                   throws SOAPException
Specified by:
addFault in interface SOAPBody
Throws:
SOAPException

addFault

public SOAPFault addFault(QName faultCode,
                          String faultString,
                          Locale locale)
                   throws SOAPException
Creates a new SOAPFault object and adds it to this SOAPBody object. The new SOAPFault will have a faultcode element that is set to the faultCode parameter and a faultstring set to faultstring and localized to locale.

Specified by:
addFault in interface SOAPBody
Parameters:
faultCode - a QName object giving the fault code to be
faultString - a String giving an explanation of the fault
locale - a Locale object indicating the native language of the faultString
Returns:
the new SOAPFault object
Throws:
SOAPException - if there is a SOAP error

extractContentAsDocument

public Document extractContentAsDocument()
                                  throws SOAPException
Creates a new DOM org.w3c.dom.Document and sets the first child of this SOAPBody as its document element. The child SOAPElement is removed as part of the process.

Specified by:
extractContentAsDocument in interface SOAPBody
Returns:
The org.w3c.dom.Document representation of the SOAPBody content.
Throws:
SOAPException - - if there is not exactly one child SOAPElement of the SOAPBody.

detachNode

public void detachNode()
Description copied from class: NodeImplEx
Removes this Node object from the tree. Once removed, this node can be garbage collected if there are no application references to it.

Overrides:
detachNode in class SOAPElementImpl

detach

public org.apache.axiom.om.OMNode detach()
Overrides:
detach in class SOAPElementImpl

getChildElements

public Iterator getChildElements(Name name)
Specified by:
getChildElements in interface SOAPElement
Overrides:
getChildElements in class SOAPElementImpl

addAttribute

public SOAPElement addAttribute(QName qname,
                                String value)
                         throws SOAPException
Specified by:
addAttribute in interface SOAPElement
Overrides:
addAttribute in class SOAPElementImpl
Throws:
SOAPException

addChildElement

public SOAPElement addChildElement(QName qname)
                            throws SOAPException
Specified by:
addChildElement in interface SOAPElement
Overrides:
addChildElement in class SOAPElementImpl
Throws:
SOAPException

createQName

public QName createQName(String localName,
                         String prefix)
                  throws SOAPException
Description copied from class: SOAPElementImpl
Creates a QName whose namespace URI is the one associated with the parameter, prefix, in the context of this SOAPElement. The remaining elements of the new QName are taken directly from the parameters, localName and prefix.

Specified by:
createQName in interface SOAPElement
Overrides:
createQName in class SOAPElementImpl
Parameters:
localName - - a String containing the local part of the name. prefix - a String containing the prefix for the name.
Returns:
a QName with the specified localName and prefix, and with a namespace that is associated with the prefix in the context of this SOAPElement. This namespace will be the same as the one that would be returned by getNamespaceURI(String) if it were given prefix as its parameter.
Throws:
SOAPException - - if the QName cannot be created.

getAllAttributesAsQNames

public Iterator getAllAttributesAsQNames()
Specified by:
getAllAttributesAsQNames in interface SOAPElement
Overrides:
getAllAttributesAsQNames in class SOAPElementImpl

getAttributeValue

public String getAttributeValue(QName qname)
Specified by:
getAttributeValue in interface SOAPElement
Overrides:
getAttributeValue in class SOAPElementImpl

getChildElements

public Iterator getChildElements(QName qname)
Specified by:
getChildElements in interface SOAPElement
Overrides:
getChildElements in class SOAPElementImpl

getElementQName

public QName getElementQName()
Specified by:
getElementQName in interface SOAPElement
Overrides:
getElementQName in class SOAPElementImpl

removeAttribute

public boolean removeAttribute(QName qname)
Specified by:
removeAttribute in interface SOAPElement
Overrides:
removeAttribute in class SOAPElementImpl

setElementQName

public SOAPElement setElementQName(QName qname)
                            throws SOAPException
Specified by:
setElementQName in interface SOAPElement
Overrides:
setElementQName in class SOAPElementImpl
Throws:
SOAPException

getChildElements

public 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

addTextNode

public SOAPElement addTextNode(String text)
                        throws SOAPException
Description copied from class: SOAPElementImpl
Creates a new Text object initialized with the given String and adds it to this SOAPElement object.

Specified by:
addTextNode in interface SOAPElement
Overrides:
addTextNode in class SOAPElementImpl
Parameters:
text - a String object with the textual content to be added
Returns:
the SOAPElement object into which the new Text object was inserted
Throws:
SOAPException - if there is an error in creating the new Text object


Copyright © 2004-2012 The Apache Software Foundation. All Rights Reserved.