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

  • Method Details

    • getFaultName

      protected abstract NameImpl getFaultName(String name)
    • 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: SOAPBody
      Creates a new SOAPFault object and adds it to this SOAPBody object. The new SOAPFault will have default values set for the mandatory child elements. The type of the SOAPFault will be a SOAP 1.1 or a SOAP 1.2 SOAPFault depending on the protocol specified while creating the MessageFactory instance.

      A SOAPBody may contain at most one SOAPFault child element.

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

      public SOAPFault addFault(Name faultCode, String faultString, Locale locale) throws SOAPException
      Description copied from interface: SOAPBody
      Creates a new SOAPFault object and adds it to this SOAPBody object. The type of the SOAPFault will be a SOAP 1.1 or a SOAP 1.2 SOAPFault depending on the protocol specified while creating the MessageFactory instance.

      For SOAP 1.2 the faultCode parameter is the value of the Fault/Code/Value element and the faultString parameter is the value of the Fault/Reason/Text element. For SOAP 1.1 the faultCode parameter is the value of the faultcode element and the faultString parameter is the value of the faultstring element.

      A SOAPBody may contain at most one SOAPFault child element.

      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 Version of SOAP specification in use
      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
      See Also:
    • addFault

      public SOAPFault addFault(QName faultCode, String faultString, Locale locale) throws SOAPException
      Description copied from interface: SOAPBody
      Creates a new SOAPFault object and adds it to this SOAPBody object. The type of the SOAPFault will be a SOAP 1.1 or a SOAP 1.2 SOAPFault depending on the protocol specified while creating the MessageFactory instance.

      For SOAP 1.2 the faultCode parameter is the value of the Fault/Code/Value element and the faultString parameter is the value of the Fault/Reason/Text element. For SOAP 1.1 the faultCode parameter is the value of the faultcode element and the faultString parameter is the value of the faultstring element.

      A SOAPBody may contain at most one SOAPFault child element.

      Specified by:
      addFault in interface SOAPBody
      Parameters:
      faultCode - a QName object giving the fault code to be set; must be one of the fault codes defined in the version of SOAP specification in use.
      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
      See Also:
    • addFault

      public SOAPFault addFault(Name faultCode, String faultString) throws SOAPException
      Description copied from interface: SOAPBody
      Creates a new SOAPFault object and adds it to this SOAPBody object. The type of the SOAPFault will be a SOAP 1.1 or a SOAP 1.2 SOAPFault depending on the protocol specified while creating the MessageFactory instance.

      For SOAP 1.2 the faultCode parameter is the value of the Fault/Code/Value element and the faultString parameter is the value of the Fault/Reason/Text element. For SOAP 1.1 the faultCode parameter is the value of the faultcode element and the faultString parameter is the value of the faultstring element.

      In case of a SOAP 1.2 fault, the default value for the mandatory xml:lang attribute on the Fault/Reason/Text element will be set to java.util.Locale.getDefault()

      A SOAPBody may contain at most one SOAPFault child element.

      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 version of SOAP specification in use
      faultString - a String giving an explanation of the fault
      Returns:
      the new SOAPFault object
      Throws:
      SOAPException - if there is a SOAP error
      See Also:
    • addFault

      public SOAPFault addFault(QName faultCode, String faultString) throws SOAPException
      Description copied from interface: SOAPBody
      Creates a new SOAPFault object and adds it to this SOAPBody object. The type of the SOAPFault will be a SOAP 1.1 or a SOAP 1.2 SOAPFault depending on the protocol specified while creating the MessageFactory instance.

      For SOAP 1.2 the faultCode parameter is the value of the Fault/Code/Value element and the faultString parameter is the value of the Fault/Reason/Text element. For SOAP 1.1 the faultCode parameter is the value of the faultcode element and the faultString parameter is the value of the faultstring element.

      In case of a SOAP 1.2 fault, the default value for the mandatory xml:lang attribute on the Fault/Reason/Text element will be set to java.util.Locale.getDefault()

      A SOAPBody may contain at most one SOAPFault child element

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

      protected SOAPElement findFault()
    • hasFault

      public boolean hasFault()
      Description copied from interface: SOAPBody
      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()
      Description copied from interface: SOAPBody
      Returns the SOAPFault object in this SOAPBody object.
      Specified by:
      getFault in interface SOAPBody
      Returns:
      the SOAPFault object in this SOAPBody object if present, null otherwise.
    • addBodyElement

      public SOAPBodyElement addBodyElement(Name name) throws SOAPException
      Description copied from interface: SOAPBody
      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
      See Also:
    • addBodyElement

      public SOAPBodyElement addBodyElement(QName qname) throws SOAPException
      Description copied from interface: SOAPBody
      Creates a new SOAPBodyElement object with the specified QName and adds it to this SOAPBody object.
      Specified by:
      addBodyElement in interface SOAPBody
      Parameters:
      qname - a QName object with the qname for the new SOAPBodyElement object
      Returns:
      the new SOAPBodyElement object
      Throws:
      SOAPException - if a SOAP error occurs
      See Also:
    • setParentElement

      public void setParentElement(SOAPElement element) throws SOAPException
      Description copied from interface: Node
      Sets the parent of this Node object to the given SOAPElement object.
      Specified by:
      setParentElement in interface Node
      Overrides:
      setParentElement in class ElementImpl
      Parameters:
      element - the SOAPElement object to be set as the parent of this Node object
      Throws:
      SOAPException - if there is a problem in setting the parent to the given element
      See Also:
    • 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
    • addDocument

      public SOAPBodyElement addDocument(Document document) throws SOAPException
      Description copied from interface: SOAPBody
      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
    • convertToSoapElement

      protected SOAPElement convertToSoapElement(Element element)
      Overrides:
      convertToSoapElement in class ElementImpl
    • 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.
    • extractContentAsDocument

      public Document extractContentAsDocument() throws SOAPException
      Description copied from interface: SOAPBody
      Creates a new DOM Document and sets the first child of this SOAPBody as it's document element. The child SOAPElement is removed as part of the process.
      Specified by:
      extractContentAsDocument in interface SOAPBody
      Returns:
      the Document representation of the SOAPBody content.
      Throws:
      SOAPException - if there is not exactly one child SOAPElement of the SOAPBody.
    • hasChildNodes

      public boolean hasChildNodes()
      Specified by:
      hasChildNodes in interface Node
      Overrides:
      hasChildNodes in class ElementImpl
    • getChildNodes

      public NodeList getChildNodes()
      Specified by:
      getChildNodes in interface Node
      Overrides:
      getChildNodes in class ElementImpl
    • getFirstChild

      public Node getFirstChild()
      Specified by:
      getFirstChild in interface Node
      Overrides:
      getFirstChild in class ElementImpl
    • getFirstChildNoMaterialize

      public Node getFirstChildNoMaterialize()
    • getLastChild

      public Node getLastChild()
      Specified by:
      getLastChild in interface Node
      Overrides:
      getLastChild in class ElementImpl
    • isLazy

      public boolean isLazy()