Class BodyImpl
- java.lang.Object
-
- com.sun.xml.messaging.saaj.soap.impl.ElementImpl
-
- com.sun.xml.messaging.saaj.soap.impl.BodyImpl
-
- All Implemented Interfaces:
Node,SOAPBody,SOAPBodyElement,SOAPElement,Element,Node
- Direct Known Subclasses:
Body1_1Impl,Body1_2Impl
public abstract class BodyImpl extends ElementImpl implements SOAPBody
The implementation of SOAP-ENV:BODY or the SOAPBody abstraction.- Author:
- Anil Vijendran (anil@sun.com)
-
-
Field Summary
-
Fields inherited from class com.sun.xml.messaging.saaj.soap.impl.ElementImpl
DSIG_NS, elementQName, WSU_NS, XENC_NS
-
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
Constructors Modifier Constructor Description protectedBodyImpl(SOAPDocumentImpl ownerDoc, NameImpl bodyName)protectedBodyImpl(SOAPDocumentImpl ownerDoc, Element domElement)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description SOAPBodyElementaddBodyElement(Name name)Creates a newSOAPBodyElementobject with the specified name and adds it to thisSOAPBodyobject.SOAPBodyElementaddBodyElement(QName qname)Creates a newSOAPBodyElementobject with the specified QName and adds it to thisSOAPBodyobject.SOAPBodyElementaddDocument(Document document)Adds the root node of the DOMDocumentto thisSOAPBodyobject.protected SOAPElementaddElement(Name name)protected SOAPElementaddElement(QName name)SOAPFaultaddFault()Creates a newSOAPFaultobject and adds it to thisSOAPBodyobject.SOAPFaultaddFault(Name faultCode, String faultString)Creates a newSOAPFaultobject and adds it to thisSOAPBodyobject.SOAPFaultaddFault(Name faultCode, String faultString, Locale locale)Creates a newSOAPFaultobject and adds it to thisSOAPBodyobject.SOAPFaultaddFault(QName faultCode, String faultString)Creates a newSOAPFaultobject and adds it to thisSOAPBodyobject.SOAPFaultaddFault(QName faultCode, String faultString, Locale locale)Creates a newSOAPFaultobject and adds it to thisSOAPBodyobject.protected SOAPElementconvertToSoapElement(Element element)protected abstract SOAPBodyElementcreateBodyElement(Name name)protected abstract SOAPBodyElementcreateBodyElement(QName name)protected abstract SOAPFaultcreateFaultElement()DocumentextractContentAsDocument()Creates a new DOMDocumentand sets the first child of thisSOAPBodyas it's document element.protected SOAPElementfindFault()NodeListgetChildNodes()protected abstract QNamegetDefaultFaultCode()SOAPFaultgetFault()Returns theSOAPFaultobject in thisSOAPBodyobject.protected abstract NameImplgetFaultName(String name)NodegetFirstChild()NodegetFirstChildNoMaterialize()NodegetLastChild()booleanhasChildNodes()booleanhasFault()Indicates whether aSOAPFaultobject exists in thisSOAPBodyobject.protected abstract booleanisFault(SOAPElement child)booleanisLazy()SOAPElementsetElementQName(QName newName)Changes the name of thisElementtonewNameif possible.voidsetParentElement(SOAPElement element)Sets the parent of thisNodeobject to the givenSOAPElementobject.-
Methods inherited from class com.sun.xml.messaging.saaj.soap.impl.ElementImpl
addAttribute, addAttribute, addCDATA, addChildElement, addChildElement, addChildElement, addChildElement, addChildElement, addChildElement, addNamespaceDeclaration, addNode, addText, addTextNode, appendChild, cloneNode, compareDocumentPosition, convertToSoapText, createElement, createElement, createQName, detachNode, doGetNamespacePrefixes, ensureNamespaceIsDeclared, findAndConvertChildElement, findChild, findEncodingStyleAttributeName, getAllAttributes, getAllAttributesAsQNames, getAllAttributesFrom, getAttribute, getAttributeNode, getAttributeNodeNS, getAttributeNS, getAttributes, getAttributeValue, getAttributeValue, getAttributeValueFrom, getBaseURI, getChildElementNodes, getChildElements, getChildElements, getChildElements, getChildElementsFrom, getDomElement, getElementName, getElementQName, getElementsByTagName, getElementsByTagNameNS, getEncodingStyle, getFeature, getLocalName, getLocalPart, getNamespaceAttr, getNamespaceAttrFrom, getNamespaceContextNodes, getNamespaceContextNodes, getNamespacePrefix, getNamespacePrefixes, getNamespaceURI, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentElement, getParentNode, getPrefix, getPrefix, getPreviousSibling, getQualifiedName, getSchemaTypeInfo, getSoapDocument, getSOAPNamespace, getTagName, getTextContent, getUserData, getValue, getValueNode, getValueNodeStrict, getVisibleNamespacePrefixes, hasAttribute, hasAttributeNS, hasAttributes, importElement, insertBefore, isDefaultNamespace, isEqualNode, isNamespaceQualified, isNamespaceQualified, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, recycleNode, removeAttribute, removeAttribute, removeAttribute, removeAttributeNode, removeAttributeNS, removeChild, removeContents, removeNamespaceDeclaration, replaceChild, replaceElementWithSOAPElement, setAttribute, setAttributeNode, setAttributeNodeNS, setAttributeNS, setEncodingStyle, setEncodingStyleNamespace, setIdAttribute, setIdAttributeNode, setIdAttributeNS, setNodeValue, setPrefix, setTextContent, setUserData, setValue, tryToFindEncodingStyleAttributeName
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
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, setValue
-
Methods inherited from interface org.w3c.dom.Node
appendChild, cloneNode, compareDocumentPosition, getAttributes, getBaseURI, getFeature, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasAttributes, 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, setEncodingStyle
-
-
-
-
Constructor Detail
-
BodyImpl
protected BodyImpl(SOAPDocumentImpl ownerDoc, NameImpl bodyName)
-
BodyImpl
protected BodyImpl(SOAPDocumentImpl ownerDoc, Element domElement)
-
-
Method Detail
-
isFault
protected abstract boolean isFault(SOAPElement child)
-
createBodyElement
protected abstract SOAPBodyElement createBodyElement(Name name)
-
createBodyElement
protected abstract SOAPBodyElement createBodyElement(QName name)
-
createFaultElement
protected abstract SOAPFault createFaultElement()
-
getDefaultFaultCode
protected abstract QName getDefaultFaultCode()
-
addFault
public SOAPFault addFault() throws SOAPException
Description copied from interface:SOAPBodyCreates a newSOAPFaultobject and adds it to thisSOAPBodyobject. The newSOAPFaultwill have default values set for the mandatory child elements. The type of theSOAPFaultwill be a SOAP 1.1 or a SOAP 1.2SOAPFaultdepending on theprotocolspecified while creating theMessageFactoryinstance.A
SOAPBodymay contain at most oneSOAPFaultchild element.- Specified by:
addFaultin interfaceSOAPBody- Returns:
- the new
SOAPFaultobject - Throws:
SOAPException- if there is a SOAP error
-
addFault
public SOAPFault addFault(Name faultCode, String faultString, Locale locale) throws SOAPException
Description copied from interface:SOAPBodyCreates a newSOAPFaultobject and adds it to thisSOAPBodyobject. The type of theSOAPFaultwill be a SOAP 1.1 or a SOAP 1.2SOAPFaultdepending on theprotocolspecified while creating theMessageFactoryinstance.For SOAP 1.2 the
faultCodeparameter is the value of the Fault/Code/Value element and thefaultStringparameter is the value of the Fault/Reason/Text element. For SOAP 1.1 thefaultCodeparameter is the value of thefaultcodeelement and thefaultStringparameter is the value of thefaultstringelement.A
SOAPBodymay contain at most oneSOAPFaultchild element.- Specified by:
addFaultin interfaceSOAPBody- Parameters:
faultCode- aNameobject giving the fault code to be set; must be one of the fault codes defined in the Version of SOAP specification in usefaultString- aStringgiving an explanation of the faultlocale- aLocaleobject indicating the native language of thefaultString- Returns:
- the new
SOAPFaultobject - Throws:
SOAPException- if there is a SOAP error- See Also:
SOAPFault.setFaultCode(jakarta.xml.soap.Name),SOAPFault.setFaultString(java.lang.String)
-
addFault
public SOAPFault addFault(QName faultCode, String faultString, Locale locale) throws SOAPException
Description copied from interface:SOAPBodyCreates a newSOAPFaultobject and adds it to thisSOAPBodyobject. The type of theSOAPFaultwill be a SOAP 1.1 or a SOAP 1.2SOAPFaultdepending on theprotocolspecified while creating theMessageFactoryinstance.For SOAP 1.2 the
faultCodeparameter is the value of the Fault/Code/Value element and thefaultStringparameter is the value of the Fault/Reason/Text element. For SOAP 1.1 thefaultCodeparameter is the value of thefaultcodeelement and thefaultStringparameter is the value of thefaultstringelement.A
SOAPBodymay contain at most oneSOAPFaultchild element.- Specified by:
addFaultin interfaceSOAPBody- Parameters:
faultCode- aQNameobject giving the fault code to be set; must be one of the fault codes defined in the version of SOAP specification in use.faultString- aStringgiving an explanation of the faultlocale- aLocaleobject indicating the native language of thefaultString- Returns:
- the new
SOAPFaultobject - Throws:
SOAPException- if there is a SOAP error- See Also:
SOAPFault.setFaultCode(jakarta.xml.soap.Name),SOAPFault.setFaultString(java.lang.String),SOAPBody.addFault(Name faultCode, String faultString, Locale locale)
-
addFault
public SOAPFault addFault(Name faultCode, String faultString) throws SOAPException
Description copied from interface:SOAPBodyCreates a newSOAPFaultobject and adds it to thisSOAPBodyobject. The type of theSOAPFaultwill be a SOAP 1.1 or a SOAP 1.2SOAPFaultdepending on theprotocolspecified while creating theMessageFactoryinstance.For SOAP 1.2 the
faultCodeparameter is the value of the Fault/Code/Value element and thefaultStringparameter is the value of the Fault/Reason/Text element. For SOAP 1.1 thefaultCodeparameter is the value of the faultcode element and thefaultStringparameter is the value of the faultstring element.In case of a SOAP 1.2 fault, the default value for the mandatory
xml:langattribute on the Fault/Reason/Text element will be set tojava.util.Locale.getDefault()A
SOAPBodymay contain at most oneSOAPFaultchild element.- Specified by:
addFaultin interfaceSOAPBody- Parameters:
faultCode- aNameobject giving the fault code to be set; must be one of the fault codes defined in the version of SOAP specification in usefaultString- aStringgiving an explanation of the fault- Returns:
- the new
SOAPFaultobject - Throws:
SOAPException- if there is a SOAP error- See Also:
SOAPFault.setFaultCode(jakarta.xml.soap.Name),SOAPFault.setFaultString(java.lang.String)
-
addFault
public SOAPFault addFault(QName faultCode, String faultString) throws SOAPException
Description copied from interface:SOAPBodyCreates a newSOAPFaultobject and adds it to thisSOAPBodyobject. The type of theSOAPFaultwill be a SOAP 1.1 or a SOAP 1.2SOAPFaultdepending on theprotocolspecified while creating theMessageFactoryinstance.For SOAP 1.2 the
faultCodeparameter is the value of the Fault/Code/Value element and thefaultStringparameter is the value of the Fault/Reason/Text element. For SOAP 1.1 thefaultCodeparameter is the value of the faultcode element and thefaultStringparameter is the value of the faultstring element.In case of a SOAP 1.2 fault, the default value for the mandatory
xml:langattribute on the Fault/Reason/Text element will be set tojava.util.Locale.getDefault()A
SOAPBodymay contain at most oneSOAPFaultchild element- Specified by:
addFaultin interfaceSOAPBody- Parameters:
faultCode- aQNameobject giving the fault code to be set; must be one of the fault codes defined in the version of SOAP specification in usefaultString- aStringgiving an explanation of the fault- Returns:
- the new
SOAPFaultobject - Throws:
SOAPException- if there is a SOAP error- See Also:
SOAPFault.setFaultCode(jakarta.xml.soap.Name),SOAPFault.setFaultString(java.lang.String),SOAPBody.addFault(Name faultCode, String faultString)
-
findFault
protected SOAPElement findFault()
-
hasFault
public boolean hasFault()
Description copied from interface:SOAPBodyIndicates whether aSOAPFaultobject exists in thisSOAPBodyobject.
-
getFault
public SOAPFault getFault()
Description copied from interface:SOAPBodyReturns theSOAPFaultobject in thisSOAPBodyobject.
-
addBodyElement
public SOAPBodyElement addBodyElement(Name name) throws SOAPException
Description copied from interface:SOAPBodyCreates a newSOAPBodyElementobject with the specified name and adds it to thisSOAPBodyobject.- Specified by:
addBodyElementin interfaceSOAPBody- Parameters:
name- aNameobject with the name for the newSOAPBodyElementobject- Returns:
- the new
SOAPBodyElementobject - Throws:
SOAPException- if a SOAP error occurs- See Also:
SOAPBody.addBodyElement(javax.xml.namespace.QName)
-
addBodyElement
public SOAPBodyElement addBodyElement(QName qname) throws SOAPException
Description copied from interface:SOAPBodyCreates a newSOAPBodyElementobject with the specified QName and adds it to thisSOAPBodyobject.- Specified by:
addBodyElementin interfaceSOAPBody- Parameters:
qname- aQNameobject with the qname for the newSOAPBodyElementobject- Returns:
- the new
SOAPBodyElementobject - Throws:
SOAPException- if a SOAP error occurs- See Also:
SOAPBody.addBodyElement(Name)
-
setParentElement
public void setParentElement(SOAPElement element) throws SOAPException
Description copied from interface:NodeSets the parent of thisNodeobject to the givenSOAPElementobject.- Specified by:
setParentElementin interfaceNode- Overrides:
setParentElementin classElementImpl- Parameters:
element- theSOAPElementobject to be set as the parent of thisNodeobject- Throws:
SOAPException- if there is a problem in setting the parent to the given element- See Also:
Node.getParentElement()
-
addElement
protected SOAPElement addElement(Name name) throws SOAPException
- Overrides:
addElementin classElementImpl- Throws:
SOAPException
-
addElement
protected SOAPElement addElement(QName name) throws SOAPException
- Overrides:
addElementin classElementImpl- Throws:
SOAPException
-
addDocument
public SOAPBodyElement addDocument(Document document) throws SOAPException
Description copied from interface:SOAPBodyAdds the root node of the DOMDocumentto thisSOAPBodyobject.Calling this method invalidates the
documentparameter. The client application should discard all references to thisDocumentand its contents upon callingaddDocument. The behavior of an application that continues to use such references is undefined.- Specified by:
addDocumentin interfaceSOAPBody- Parameters:
document- theDocumentobject whose root node will be added to thisSOAPBody.- Returns:
- the
SOAPBodyElementthat represents the root node that was added. - Throws:
SOAPException- if theDocumentcannot be added
-
convertToSoapElement
protected SOAPElement convertToSoapElement(Element element)
- Overrides:
convertToSoapElementin classElementImpl
-
setElementQName
public SOAPElement setElementQName(QName newName) throws SOAPException
Description copied from interface:SOAPElementChanges the name of thisElementtonewNameif possible. SOAP Defined elements such as SOAPEnvelope, SOAPHeader, SOAPBody etc. cannot have their names changed using this method. Any attempt to do so will result in a SOAPException being thrown.Callers should not rely on the element instance being renamed as is. Implementations could end up copying the content of the
SOAPElementto a renamed instance.- Specified by:
setElementQNamein interfaceSOAPElement- Overrides:
setElementQNamein classElementImpl- Parameters:
newName- the new name for theElement.- Returns:
- The renamed Node
- Throws:
SOAPException- if changing the name of thisElementis not allowed.
-
extractContentAsDocument
public Document extractContentAsDocument() throws SOAPException
Description copied from interface:SOAPBodyCreates a new DOMDocumentand sets the first child of thisSOAPBodyas it's document element. The childSOAPElementis removed as part of the process.- Specified by:
extractContentAsDocumentin interfaceSOAPBody- Returns:
- the
Documentrepresentation of theSOAPBodycontent. - Throws:
SOAPException- if there is not exactly one childSOAPElementof theSOAPBody.
-
hasChildNodes
public boolean hasChildNodes()
- Specified by:
hasChildNodesin interfaceNode- Overrides:
hasChildNodesin classElementImpl
-
getChildNodes
public NodeList getChildNodes()
- Specified by:
getChildNodesin interfaceNode- Overrides:
getChildNodesin classElementImpl
-
getFirstChild
public Node getFirstChild()
- Specified by:
getFirstChildin interfaceNode- Overrides:
getFirstChildin classElementImpl
-
getFirstChildNoMaterialize
public Node getFirstChildNoMaterialize()
-
getLastChild
public Node getLastChild()
- Specified by:
getLastChildin interfaceNode- Overrides:
getLastChildin classElementImpl
-
isLazy
public boolean isLazy()
-
-