Class SOAPHeader

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

public class SOAPHeader extends MessageElement implements SOAPHeader
Holder for header 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:
    • addHeaderElement

      public SOAPHeaderElement addHeaderElement(Name name) throws SOAPException
      Description copied from interface: SOAPHeader
      Creates a new SOAPHeaderElement object initialized with the specified name and adds it to this SOAPHeader object.
      Specified by:
      addHeaderElement in interface SOAPHeader
      Parameters:
      name - a Name object with the name of the new SOAPHeaderElement object
      Returns:
      the new SOAPHeaderElement object that was inserted into this SOAPHeader object
      Throws:
      SOAPException - if a SOAP error occurs
    • examineHeaderElements

      public Iterator examineHeaderElements(String actor)
      Description copied from interface: SOAPHeader
      Returns a list of all the SOAPHeaderElement objects in this SOAPHeader object that have the the specified actor. An actor is a global attribute that indicates the intermediate parties to whom the message should be sent. An actor receives the message and then sends it to the next actor. The default actor is the ultimate intended recipient for the message, so if no actor attribute is included in a SOAPHeader object, the message is sent to its ultimate destination.
      Specified by:
      examineHeaderElements in interface SOAPHeader
      Parameters:
      actor - a String giving the URI of the actor for which to search
      Returns:
      an Iterator object over all the SOAPHeaderElement objects that contain the specified actor
      See Also:
    • extractHeaderElements

      public Iterator extractHeaderElements(String actor)
      Description copied from interface: SOAPHeader
      Returns a list of all the SOAPHeaderElement objects in this SOAPHeader object that have the the specified actor and detaches them from this SOAPHeader object.

      This method allows an actor to process only the parts of the SOAPHeader object that apply to it and to remove them before passing the message on to the next actor.

      Specified by:
      extractHeaderElements in interface SOAPHeader
      Parameters:
      actor - a String giving the URI of the actor for which to search
      Returns:
      an Iterator object over all the SOAPHeaderElement objects that contain the specified actor
      See Also:
    • examineMustUnderstandHeaderElements

      public Iterator examineMustUnderstandHeaderElements(String actor)
      Description copied from interface: SOAPHeader
      Returns an Iterator over all the SOAPHeaderElement objects in this SOAPHeader object that have the specified actor and that have a MustUnderstand attribute whose value is equivalent to true.
      Specified by:
      examineMustUnderstandHeaderElements in interface SOAPHeader
      Parameters:
      actor - a String giving the URI of the actor for which to search
      Returns:
      an Iterator object over all the SOAPHeaderElement objects that contain the specified actor and are marked as MustUnderstand
    • examineAllHeaderElements

      public Iterator examineAllHeaderElements()
      Description copied from interface: SOAPHeader
      Returns an Iterator over all the SOAPHeaderElement objects in this SOAPHeader object.
      Specified by:
      examineAllHeaderElements in interface SOAPHeader
      Returns:
      an Iterator object over all the SOAPHeaderElement objects contained by this SOAPHeader
    • extractAllHeaderElements

      public Iterator extractAllHeaderElements()
      Description copied from interface: SOAPHeader
      Returns an Iterator over all the SOAPHeaderElement objects in this SOAPHeader object and detaches them from this SOAPHeader object.
      Specified by:
      extractAllHeaderElements in interface SOAPHeader
      Returns:
      an Iterator object over all the SOAPHeaderElement objects contained by this SOAPHeader
    • 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.
    • 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:
    • appendChild

      public Node appendChild(Node newChild) throws DOMException
      Description copied from class: NodeImpl
      Adds the node newChild to the end of the list of children of this node. If the newChild is already in the tree, it is first removed.
      Specified by:
      appendChild in interface Node
      Overrides:
      appendChild in class NodeImpl
      Parameters:
      newChild - The node to add.If it is a DocumentFragment object, the entire contents of the document fragment are moved into the child list of this node
      Returns:
      The node added.
      Throws:
      DOMException - HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of the newChild node, or if the node to append is one of this node's ancestors or this node itself.
      WRONG_DOCUMENT_ERR: Raised if newChild was created from a different document than the one that created this node.
      NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly or if the previous parent of the node being inserted is readonly.