Class SOAPBody

All Implemented Interfaces:
Serializable, Cloneable, Node, SOAPBody, SOAPElement, Element, Node, NodeList

public class SOAPBody extends MessageElement implements SOAPBody
Holder for body elements.
Author:
Glyn Normington (glyn@apache.org)
See Also:
  • Constructor Details

  • Method Details

    • setParentElement

      public void setParentElement(SOAPElement parent) throws SOAPException
      Description copied from class: NodeImpl
      Sets the parent of this Node object to the given SOAPElement object.
      Specified by:
      setParentElement in interface Node
      Overrides:
      setParentElement in class NodeImpl
      Parameters:
      parent - 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:
    • disableFormatting

      public void disableFormatting()
    • setEncodingStyle

      public void setEncodingStyle(String encodingStyle) throws SOAPException
      Description copied from class: MessageElement
      Sets the encoding style for this SOAPElement object to one specified. The semantics of a null value, as above in getEncodingStyle() are to just use the parent's value, but null here means set to "".
      Specified by:
      setEncodingStyle in interface SOAPElement
      Overrides:
      setEncodingStyle in class MessageElement
      Parameters:
      encodingStyle - a String giving the encoding style
      Throws:
      SOAPException
      See Also:
    • outputImpl

      protected void outputImpl(SerializationContext context) throws Exception
      Description copied from class: MessageElement
      override point -output to a serialization context.
      Overrides:
      outputImpl in class MessageElement
      Parameters:
      context - destination.
      Throws:
      Exception - if something went wrong.
    • 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
    • addFault

      public SOAPFault addFault(Name name, String s, Locale locale) throws SOAPException
      Description copied from interface: SOAPBody
      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:
      name - 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
      s - 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 name, String s) throws SOAPException
      Description copied from interface: SOAPBody
      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:
      name - 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
      s - 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
      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
    • addFault

      public SOAPFault addFault() throws SOAPException
      Description copied from interface: SOAPBody
      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
    • 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
    • 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
    • addChild

      public void addChild(MessageElement element) throws SOAPException
      Description copied from class: MessageElement
      Note that this method will log a error and no-op if there is a value (set using setObjectValue) in the MessageElement.
      Overrides:
      addChild in class MessageElement
      Throws:
      SOAPException
    • addChildElement

      public SOAPElement addChildElement(SOAPElement element) throws SOAPException
      Description copied from class: MessageElement
      The added child must be an instance of MessageElement rather than an abitrary SOAPElement otherwise a (wrapped) ClassCastException will be thrown.
      Specified by:
      addChildElement in interface SOAPElement
      Overrides:
      addChildElement in class MessageElement
      Parameters:
      element - the SOAPElement to be added as a new child
      Returns:
      an instance representing the new SOAP element that was actually added to the tree.
      Throws:
      SOAPException - if there was an error in adding this element as a child
      See Also:
    • addChildElement

      public SOAPElement addChildElement(Name name) throws SOAPException
      Description copied from class: MessageElement
      add the child element
      Specified by:
      addChildElement in interface SOAPElement
      Overrides:
      addChildElement in class MessageElement
      Parameters:
      name - uri, prefix and local name of the element to add
      Returns:
      the child element
      Throws:
      SOAPException - if there is an error in creating the SOAPElement object
      See Also:
    • addChildElement

      public SOAPElement addChildElement(String localName) throws SOAPException
      Description copied from class: MessageElement
      add a child element in the message element's own namespace
      Specified by:
      addChildElement in interface SOAPElement
      Overrides:
      addChildElement in class MessageElement
      Parameters:
      localName - a String giving the local name for the element
      Returns:
      the child element
      Throws:
      SOAPException - if there is an error in creating the SOAPElement object
      See Also:
    • addChildElement

      public SOAPElement addChildElement(String localName, String prefix) throws SOAPException
      Description copied from class: MessageElement
      add a child element
      Specified by:
      addChildElement in interface SOAPElement
      Overrides:
      addChildElement in class MessageElement
      Parameters:
      localName - a String giving the local name for the new element
      prefix - a String giving the namespace prefix for the new element
      Returns:
      the child element
      Throws:
      SOAPException - if there is an error in creating the SOAPElement object
      See Also:
    • addChildElement

      public SOAPElement addChildElement(String localName, String prefix, String uri) throws SOAPException
      Description copied from class: MessageElement
      add a child element
      Specified by:
      addChildElement in interface SOAPElement
      Overrides:
      addChildElement in class MessageElement
      Parameters:
      localName - a String giving the local name for the new element
      prefix - a String giving the namespace prefix for the new element
      uri - a String giving the URI of the namespace to which the new element belongs
      Returns:
      the child element
      Throws:
      SOAPException - if there is an error in creating the SOAPElement object
      See Also:
    • setSAAJEncodingCompliance

      public void setSAAJEncodingCompliance(boolean comply)