Class EnvelopeImpl
- java.lang.Object
-
- com.sun.xml.messaging.saaj.soap.impl.ElementImpl
-
- com.sun.xml.messaging.saaj.soap.impl.EnvelopeImpl
-
- All Implemented Interfaces:
Envelope,LazyEnvelope,Node,SOAPBodyElement,SOAPElement,SOAPEnvelope,Element,Node
- Direct Known Subclasses:
Envelope1_1Impl,Envelope1_2Impl
public abstract class EnvelopeImpl extends ElementImpl implements LazyEnvelope
Our implementation of the SOAP envelope.- Author:
- Anil Vijendran (anil@sun.com)
-
-
Field Summary
Fields Modifier and Type Field Description protected BodyImplbodyprotected HeaderImplheader-
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 protectedEnvelopeImpl(SOAPDocumentImpl ownerDoc, NameImpl name, boolean createHeader, boolean createBody)protectedEnvelopeImpl(SOAPDocumentImpl ownerDoc, Name name)protectedEnvelopeImpl(SOAPDocumentImpl ownerDoc, QName name)protectedEnvelopeImpl(SOAPDocumentImpl ownerDoc, Element domElement)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description SOAPBodyaddBody()Creates aSOAPBodyobject and sets it as theSOAPBodyobject for thisSOAPEnvelopeobject.SOAPBodyaddBody(String prefix)protected SOAPElementaddElement(Name name)protected SOAPElementaddElement(QName name)SOAPHeaderaddHeader()Creates aSOAPHeaderobject and sets it as theSOAPHeaderobject for thisSOAPEnvelopeobject.SOAPHeaderaddHeader(String prefix)NamecreateName(String localName)Creates a newNameobject initialized with the given local name.NamecreateName(String localName, String uri)Creates a newNameobject initialized with the given local name and namespace prefix.NamecreateName(String localName, String prefix, String uri)Creates a newNameobject initialized with the given local name, namespace prefix, and namespace URI.SOAPBodygetBody()Returns theSOAPBodyobject associated with thisSOAPEnvelopeobject.protected abstract NameImplgetBodyName(String prefix)SourcegetContent()Get the content as a JAXP Source.SOAPHeadergetHeader()Returns theSOAPHeaderobject for thisSOAPEnvelopeobject.protected abstract NameImplgetHeaderName(String prefix)StringgetPayloadAttributeValue(String localName)Retrieve payload attribute value without materializing its contentsStringgetPayloadAttributeValue(QName qName)Retrieve payload attribute value without materializing its contentsQNamegetPayloadQName()Retrieve payload qname without materializing its contentsXMLStreamReadergetPayloadReader()StaxBridgegetStaxBridge()booleanisLazy()protected voidlookForBody()protected voidlookForHeader()voidoutput(OutputStream out)Output the content.voidoutput(OutputStream out, boolean isFastInfoset)Serialize to FI if boolean parameter set.voidsetCharsetEncoding(String value)SOAPElementsetElementQName(QName newName)Changes the name of thisElementtonewNameif possible.voidsetOmitXmlDecl(String value)voidsetStaxBridge(StaxBridge bridge)voidsetXmlDecl(String value)voidwriteTo(XMLStreamWriter writer)-
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, convertToSoapElement, 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, getChildNodes, getDomElement, getElementName, getElementQName, getElementsByTagName, getElementsByTagNameNS, getEncodingStyle, getFeature, getFirstChild, getLastChild, 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, hasChildNodes, 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, setParentElement, 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, 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, setEncodingStyle
-
-
-
-
Field Detail
-
header
protected HeaderImpl header
-
body
protected BodyImpl body
-
-
Constructor Detail
-
EnvelopeImpl
protected EnvelopeImpl(SOAPDocumentImpl ownerDoc, Name name)
-
EnvelopeImpl
protected EnvelopeImpl(SOAPDocumentImpl ownerDoc, QName name)
-
EnvelopeImpl
protected EnvelopeImpl(SOAPDocumentImpl ownerDoc, NameImpl name, boolean createHeader, boolean createBody) throws SOAPException
- Throws:
SOAPException
-
EnvelopeImpl
protected EnvelopeImpl(SOAPDocumentImpl ownerDoc, Element domElement)
-
-
Method Detail
-
addHeader
public SOAPHeader addHeader() throws SOAPException
Description copied from interface:SOAPEnvelopeCreates aSOAPHeaderobject and sets it as theSOAPHeaderobject for thisSOAPEnvelopeobject.It is illegal to add a header when the envelope already contains a header. Therefore, this method should be called only after the existing header has been removed.
- Specified by:
addHeaderin interfaceSOAPEnvelope- Returns:
- the new
SOAPHeaderobject - Throws:
SOAPException- if thisSOAPEnvelopeobject already contains a validSOAPHeaderobject
-
addHeader
public SOAPHeader addHeader(String prefix) throws SOAPException
- Throws:
SOAPException
-
lookForHeader
protected void lookForHeader() throws SOAPException- Throws:
SOAPException
-
getHeader
public SOAPHeader getHeader() throws SOAPException
Description copied from interface:SOAPEnvelopeReturns theSOAPHeaderobject for thisSOAPEnvelopeobject.A new
SOAPMessageobject is by default created with aSOAPEnvelopeobject that contains an emptySOAPHeaderobject. As a result, the methodgetHeaderwill always return aSOAPHeaderobject unless the header has been removed and a new one has not been added.- Specified by:
getHeaderin interfaceSOAPEnvelope- Returns:
- the
SOAPHeaderobject ornullif there is none - Throws:
SOAPException- if there is a problem obtaining theSOAPHeaderobject
-
lookForBody
protected void lookForBody() throws SOAPException- Throws:
SOAPException
-
addBody
public SOAPBody addBody() throws SOAPException
Description copied from interface:SOAPEnvelopeCreates aSOAPBodyobject and sets it as theSOAPBodyobject for thisSOAPEnvelopeobject.It is illegal to add a body when the envelope already contains a body. Therefore, this method should be called only after the existing body has been removed.
- Specified by:
addBodyin interfaceSOAPEnvelope- Returns:
- the new
SOAPBodyobject - Throws:
SOAPException- if thisSOAPEnvelopeobject already contains a validSOAPBodyobject
-
addBody
public SOAPBody addBody(String prefix) throws SOAPException
- Throws:
SOAPException
-
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
-
getBody
public SOAPBody getBody() throws SOAPException
Description copied from interface:SOAPEnvelopeReturns theSOAPBodyobject associated with thisSOAPEnvelopeobject.A new
SOAPMessageobject is by default created with aSOAPEnvelopeobject that contains an emptySOAPBodyobject. As a result, the methodgetBodywill always return aSOAPBodyobject unless the body has been removed and a new one has not been added.- Specified by:
getBodyin interfaceSOAPEnvelope- Returns:
- the
SOAPBodyobject for thisSOAPEnvelopeobject ornullif there is none - Throws:
SOAPException- if there is a problem obtaining theSOAPBodyobject
-
getContent
public Source getContent()
Description copied from interface:EnvelopeGet the content as a JAXP Source.- Specified by:
getContentin interfaceEnvelope- Returns:
- source
-
createName
public Name createName(String localName, String prefix, String uri) throws SOAPException
Description copied from interface:SOAPEnvelopeCreates a newNameobject initialized with the given local name, namespace prefix, and namespace URI.This factory method creates
Nameobjects for use in the SOAP/XML document.- Specified by:
createNamein interfaceSOAPEnvelope- Parameters:
localName- aStringgiving the local nameprefix- aStringgiving the prefix of the namespaceuri- aStringgiving the URI of the namespace- Returns:
- a
Nameobject initialized with the given local name, namespace prefix, and namespace URI - Throws:
SOAPException- if there is a SOAP error
-
createName
public Name createName(String localName, String uri) throws SOAPException
Description copied from interface:SOAPEnvelopeCreates a newNameobject initialized with the given local name and namespace prefix.This factory method creates
Nameobjects for use in the SOAP/XML document.- Specified by:
createNamein interfaceSOAPEnvelope- Parameters:
localName- aStringgiving the local nameuri- aStringgiving the URI of the namespace- Returns:
- a
Nameobject initialized with the given local name, namespace prefix, and namespace URI - Throws:
SOAPException- if there is a SOAP error
-
createName
public Name createName(String localName) throws SOAPException
Description copied from interface:SOAPEnvelopeCreates a newNameobject initialized with the given local name.This factory method creates
Nameobjects for use in the SOAP/XML document.- Specified by:
createNamein interfaceSOAPEnvelope- Parameters:
localName- aStringgiving the local name- Returns:
- a
Nameobject initialized with the given local name - Throws:
SOAPException- if there is a SOAP error
-
setOmitXmlDecl
public void setOmitXmlDecl(String value)
-
setXmlDecl
public void setXmlDecl(String value)
-
setCharsetEncoding
public void setCharsetEncoding(String value)
-
output
public void output(OutputStream out) throws IOException
Description copied from interface:EnvelopeOutput the content.- Specified by:
outputin interfaceEnvelope- Parameters:
out- output stream.- Throws:
IOException- in case of an I/O error.
-
output
public void output(OutputStream out, boolean isFastInfoset) throws IOException
Serialize to FI if boolean parameter set.- Specified by:
outputin interfaceEnvelope- Parameters:
out- output streamisFastInfoset- true if it is fast infoset.- Throws:
IOException- in case of an I/O error.
-
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.
-
setStaxBridge
public void setStaxBridge(StaxBridge bridge) throws SOAPException
- Specified by:
setStaxBridgein interfaceEnvelope- Throws:
SOAPException
-
getStaxBridge
public StaxBridge getStaxBridge() throws SOAPException
- Specified by:
getStaxBridgein interfaceEnvelope- Throws:
SOAPException
-
getPayloadReader
public XMLStreamReader getPayloadReader() throws SOAPException
- Specified by:
getPayloadReaderin interfaceLazyEnvelope- Throws:
SOAPException
-
writeTo
public void writeTo(XMLStreamWriter writer) throws XMLStreamException, SOAPException
- Specified by:
writeToin interfaceLazyEnvelope- Throws:
XMLStreamExceptionSOAPException
-
getPayloadQName
public QName getPayloadQName() throws SOAPException
Description copied from interface:LazyEnvelopeRetrieve payload qname without materializing its contents- Specified by:
getPayloadQNamein interfaceLazyEnvelope- Returns:
- QName
- Throws:
SOAPException- in case of an error
-
getPayloadAttributeValue
public String getPayloadAttributeValue(String localName) throws SOAPException
Description copied from interface:LazyEnvelopeRetrieve payload attribute value without materializing its contents- Specified by:
getPayloadAttributeValuein interfaceLazyEnvelope- Parameters:
localName- local name- Returns:
- payload attribute value
- Throws:
SOAPException- in case of an error
-
getPayloadAttributeValue
public String getPayloadAttributeValue(QName qName) throws SOAPException
Description copied from interface:LazyEnvelopeRetrieve payload attribute value without materializing its contents- Specified by:
getPayloadAttributeValuein interfaceLazyEnvelope- Parameters:
qName- QName- Returns:
- payload attribute value
- Throws:
SOAPException- in case of an error
-
isLazy
public boolean isLazy()
- Specified by:
isLazyin interfaceLazyEnvelope
-
-