Package org.apache.axiom.soap

## Interface SOAPBody

- All Superinterfaces:
    `OMContainer`, `OMElement`, `OMInformationItem`, `OMNamedInformationItem`, `OMNode`, `OMSerializable`

      public interface SOAPBody
      extends OMElement

  An object that represents the contents of the SOAP body element in a SOAP message. B SOAP body element consists of XML data that affects the way the application-specific content is processed.

  B `SOAPBody` object contains `OMBodyBlock` objects, which have the content for the SOAP body. B `SOAPFault` object, which carries status and/or error information, is an example of a `OMBodyBlock` object.

- - ### Field Summary

    - ### Fields inherited from interface org.apache.axiom.om.OMNode

      `CDATA_SECTION_NODE, COMMENT_NODE, DTD_NODE, ELEMENT_NODE, ENTITY_REFERENCE_NODE, PI_NODE, SPACE_NODE, TEXT_NODE`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `SOAPFault` | `addFault​(Exception e)` | Creates a new `SOAPFault` object and adds it to this `SOAPBody` object.
    `void` | `addFault​(SOAPFault soapFault)` |
    `SOAPFault` | `getFault()` | Returns the `SOAPFault` object in this `SOAPBody` object.
    `String` | `getFirstElementLocalName()` | Retrieves the local name of the first element in the body.
    `OMNamespace` | `getFirstElementNS()` | Retrieves the OMNamespace of the first element in the body.
    `boolean` | `hasFault()` | Indicates whether a `SOAPFault` object exists in this `SOAPBody` object.

    - ### Methods inherited from interface org.apache.axiom.om.OMContainer

      `addChild, getBuilder, getChildren, getChildrenWithLocalName, getChildrenWithName, getChildrenWithNamespaceURI, getFirstChildWithName, getFirstOMChild, getSAXResult, getSAXSource, getXMLStreamReader, getXMLStreamReader, getXMLStreamReader, getXMLStreamReaderWithoutCaching, getXOPEncodedStreamReader, removeChildren, serialize, serialize, serialize, serialize, serialize, serialize, serialize, serialize, serializeAndConsume, serializeAndConsume, serializeAndConsume, serializeAndConsume`

    - ### Methods inherited from interface org.apache.axiom.om.OMElement

      `addAttribute, addAttribute, cloneOMElement, declareDefaultNamespace, declareNamespace, declareNamespace, findNamespace, findNamespaceURI, getAllAttributes, getAllDeclaredNamespaces, getAttribute, getAttributeValue, getChildElements, getDefaultNamespace, getDescendants, getFirstElement, getLineNumber, getNamespaceContext, getNamespacesInScope, getText, getTextAsQName, getTextAsStream, removeAttribute, resolveQName, setLineNumber, setNamespace, setNamespaceWithNoFindInCurrentScope, setText, setText, toString, toStringWithConsume, undeclarePrefix, writeTextTo`

    - ### Methods inherited from interface org.apache.axiom.om.OMInformationItem

      `clone, getOMFactory`

    - ### Methods inherited from interface org.apache.axiom.om.OMNamedInformationItem

      `getLocalName, getNamespace, getNamespaceURI, getPrefix, getQName, hasName, setLocalName, setNamespace`

    - ### Methods inherited from interface org.apache.axiom.om.OMNode

      `buildWithAttachments, detach, discard, getNextOMSibling, getParent, getPreviousOMSibling, getType, insertSiblingAfter, insertSiblingBefore`

    - ### Methods inherited from interface org.apache.axiom.om.OMSerializable

      `build, close, isComplete, serialize, serialize, serializeAndConsume`

- - ### Method Detail

    - #### addFault

          SOAPFault addFault​(Exception e)
                      throws OMException

      Creates a new `SOAPFault` object and adds it to this `SOAPBody` object.
      Parameters:
        `e` -
      Returns:
        the new `SOAPFault` object
      Throws:
        `OMException` - if there is a SOAP error
        `OMException`

    - #### hasFault

          boolean hasFault()

      Indicates whether a `SOAPFault` object exists in this `SOAPBody` object.
      Returns:
        `true` if a `SOAPFault` object exists in this `SOAPBody` object; `false` otherwise

    - #### getFault

          SOAPFault getFault()

      Returns the `SOAPFault` object in this `SOAPBody` object.
      Returns:
        the `SOAPFault` object in this `SOAPBody` object

    - #### addFault

          void addFault​(SOAPFault soapFault)
                 throws OMException

      Parameters:
        `soapFault` -
      Throws:
        `OMException`

    - #### getFirstElementNS

          OMNamespace getFirstElementNS()

      Retrieves the OMNamespace of the first element in the body. The implementation might build the OMElement or it may obtain this information from the builder/parser without building the OMElement. Use this method in the situations where you need to know the OMNamespace, but don't necessarily need the OMElement.
      Returns:
        the namespace of first element in the body, or `null` if the element has no namespace or the body is empty

    - #### getFirstElementLocalName

          String getFirstElementLocalName()

      Retrieves the local name of the first element in the body. The implementation might build the OMElement or it may obtain this information from the builder/parser without building the OMElement. Use this method in the situations where you need to know the name, but don't necessarily need the OMElement.
      Returns:
        local name of first element in the body, or `null` if the body is empty