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.
  • Field Details

  • Constructor Details

  • Method Details

    • getHeaderName

      protected abstract NameImpl getHeaderName(String prefix)
    • getBodyName

      protected abstract NameImpl getBodyName(String prefix)
    • addHeader

      public SOAPHeader addHeader() throws SOAPException
      Description copied from interface: SOAPEnvelope
      Creates a SOAPHeader object and sets it as the SOAPHeader object for this SOAPEnvelope object.

      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:
      addHeader in interface SOAPEnvelope
      Returns:
      the new SOAPHeader object
      Throws:
      SOAPException - if this SOAPEnvelope object already contains a valid SOAPHeader object
    • 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: SOAPEnvelope
      Returns the SOAPHeader object for this SOAPEnvelope object.

      A new SOAPMessage object is by default created with a SOAPEnvelope object that contains an empty SOAPHeader object. As a result, the method getHeader will always return a SOAPHeader object unless the header has been removed and a new one has not been added.

      Specified by:
      getHeader in interface SOAPEnvelope
      Returns:
      the SOAPHeader object or null if there is none
      Throws:
      SOAPException - if there is a problem obtaining the SOAPHeader object
    • lookForBody

      protected void lookForBody() throws SOAPException
      Throws:
      SOAPException
    • addBody

      public SOAPBody addBody() throws SOAPException
      Description copied from interface: SOAPEnvelope
      Creates a SOAPBody object and sets it as the SOAPBody object for this SOAPEnvelope object.

      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:
      addBody in interface SOAPEnvelope
      Returns:
      the new SOAPBody object
      Throws:
      SOAPException - if this SOAPEnvelope object already contains a valid SOAPBody object
    • addBody

      public SOAPBody addBody(String prefix) throws SOAPException
      Throws:
      SOAPException
    • addElement

      protected SOAPElement addElement(Name name) throws SOAPException
      Overrides:
      addElement in class ElementImpl
      Throws:
      SOAPException
    • addElement

      protected SOAPElement addElement(QName name) throws SOAPException
      Overrides:
      addElement in class ElementImpl
      Throws:
      SOAPException
    • getBody

      public SOAPBody getBody() throws SOAPException
      Description copied from interface: SOAPEnvelope
      Returns the SOAPBody object associated with this SOAPEnvelope object.

      A new SOAPMessage object is by default created with a SOAPEnvelope object that contains an empty SOAPBody object. As a result, the method getBody will always return a SOAPBody object unless the body has been removed and a new one has not been added.

      Specified by:
      getBody in interface SOAPEnvelope
      Returns:
      the SOAPBody object for this SOAPEnvelope object or null if there is none
      Throws:
      SOAPException - if there is a problem obtaining the SOAPBody object
    • getContent

      public Source getContent()
      Description copied from interface: Envelope
      Get the content as a JAXP Source.
      Specified by:
      getContent in interface Envelope
      Returns:
      source
    • createName

      public Name createName(String localName, String prefix, String uri) throws SOAPException
      Description copied from interface: SOAPEnvelope
      Creates a new Name object initialized with the given local name, namespace prefix, and namespace URI.

      This factory method creates Name objects for use in the SOAP/XML document.

      Specified by:
      createName in interface SOAPEnvelope
      Parameters:
      localName - a String giving the local name
      prefix - a String giving the prefix of the namespace
      uri - a String giving the URI of the namespace
      Returns:
      a Name object 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: SOAPEnvelope
      Creates a new Name object initialized with the given local name and namespace prefix.

      This factory method creates Name objects for use in the SOAP/XML document.

      Specified by:
      createName in interface SOAPEnvelope
      Parameters:
      localName - a String giving the local name
      uri - a String giving the URI of the namespace
      Returns:
      a Name object 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: SOAPEnvelope
      Creates a new Name object initialized with the given local name.

      This factory method creates Name objects for use in the SOAP/XML document.

      Specified by:
      createName in interface SOAPEnvelope
      Parameters:
      localName - a String giving the local name
      Returns:
      a Name object 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: Envelope
      Output the content.
      Specified by:
      output in interface Envelope
      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:
      output in interface Envelope
      Parameters:
      out - output stream
      isFastInfoset - 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: SOAPElement
      Changes the name of this Element to newName if 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 SOAPElement to a renamed instance.

      Specified by:
      setElementQName in interface SOAPElement
      Overrides:
      setElementQName in class ElementImpl
      Parameters:
      newName - the new name for the Element.
      Returns:
      The renamed Node
      Throws:
      SOAPException - if changing the name of this Element is not allowed.
    • setStaxBridge

      public void setStaxBridge(StaxBridge bridge) throws SOAPException
      Specified by:
      setStaxBridge in interface Envelope
      Throws:
      SOAPException
    • getStaxBridge

      public StaxBridge getStaxBridge() throws SOAPException
      Specified by:
      getStaxBridge in interface Envelope
      Throws:
      SOAPException
    • getPayloadReader

      public XMLStreamReader getPayloadReader() throws SOAPException
      Specified by:
      getPayloadReader in interface LazyEnvelope
      Throws:
      SOAPException
    • writeTo

      public void writeTo(XMLStreamWriter writer) throws XMLStreamException, SOAPException
      Specified by:
      writeTo in interface LazyEnvelope
      Throws:
      XMLStreamException
      SOAPException
    • getPayloadQName

      public QName getPayloadQName() throws SOAPException
      Description copied from interface: LazyEnvelope
      Retrieve payload qname without materializing its contents
      Specified by:
      getPayloadQName in interface LazyEnvelope
      Returns:
      QName
      Throws:
      SOAPException - in case of an error
    • getPayloadAttributeValue

      public String getPayloadAttributeValue(String localName) throws SOAPException
      Description copied from interface: LazyEnvelope
      Retrieve payload attribute value without materializing its contents
      Specified by:
      getPayloadAttributeValue in interface LazyEnvelope
      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: LazyEnvelope
      Retrieve payload attribute value without materializing its contents
      Specified by:
      getPayloadAttributeValue in interface LazyEnvelope
      Parameters:
      qName - QName
      Returns:
      payload attribute value
      Throws:
      SOAPException - in case of an error
    • isLazy

      public boolean isLazy()
      Specified by:
      isLazy in interface LazyEnvelope