## org.apache.axis.message
Class SOAPHeader

    java.lang.Object
      |
      +--org.apache.axis.message.MessageElement
            |
            +--org.apache.axis.message.SOAPHeader

All Implemented Interfaces:
  Node, java.io.Serializable, SOAPElement, SOAPHeader

public class SOAPHeader
extends MessageElement
implements SOAPHeader

Holder for header elements.

Author:
  Glyn Normington (glyn@apache.org)
See Also:
  Serialized Form

Nested Class Summary

Nested classes inherited from class org.apache.axis.message.MessageElement
`MessageElement.QNameAttr`

Field Summary

Fields inherited from class org.apache.axis.message.MessageElement
`_isDirty, _isRoot, attributes, context, elementRep, encodingStyle, endEventIndex, href, id, log, message, name, namespaces, namespaceURI, parent, prefix, qNameAttrs, recorder, startContentsIndex, startEventIndex, textRep, typeQName`

Constructor Summary
`SOAPHeader(java.lang.String namespace, java.lang.String localPart, java.lang.String prefix, org.xml.sax.Attributes attributes, DeserializationContext context, SOAPConstants soapConsts)`

Method Summary
`void` `addChild(MessageElement el)` Note that this method will log a error and no-op if there is a value (set using setObjectValue) in the MessageElement.
`SOAPElement` `addChildElement(Name name)` Creates a new `SOAPElement` object initialized with the given `Name` object and adds the new element to this `SOAPElement` object.
`SOAPElement` `addChildElement(SOAPElement element)` we have to override this to enforce that SOAPHeader immediate children are exclusively of type SOAPHeaderElement (otherwise we'll get mysterious ClassCastExceptions down the road...
`SOAPElement` `addChildElement(java.lang.String localName)` Creates a new `SOAPElement` object initialized with the given `String` object and adds the new element to this `SOAPElement` object.
`SOAPElement` `addChildElement(java.lang.String localName, java.lang.String prefix)` Creates a new `SOAPElement` object initialized with the specified local name and prefix and adds the new element to this `SOAPElement` object.
`SOAPElement` `addChildElement(java.lang.String localName, java.lang.String prefix, java.lang.String uri)` Creates a new `SOAPElement` object initialized with the specified local name, prefix, and URI and adds the new element to this `SOAPElement` object.
`SOAPHeaderElement` `addHeaderElement(Name name)` Creates a new `SOAPHeaderElement` object initialized with the specified name and adds it to this `SOAPHeader` object.
`void` `detachNode()` Removes this `Node` object from the tree.
`java.util.Iterator` `examineHeaderElements(java.lang.String actor)` Returns a list of all the `SOAPHeaderElement` objects in this `SOAPHeader` object that have the the specified actor.
`java.util.Iterator` `extractHeaderElements(java.lang.String actor)` 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.
`java.util.Iterator` `getChildElements()` Returns an iterator over all the immediate content of this element.
`java.util.Iterator` `getChildElements(Name name)` Returns an iterator over all the child elements with the specified name.
`protected void` `outputImpl(SerializationContext context)` Subclasses can override
`void` `removeChild(MessageElement child)` Remove a child element.
`void` `setParentElement(SOAPElement parent)` Sets the parent of this `Node` object to the given `SOAPElement` object.

Methods inherited from class org.apache.axis.message.MessageElement

`addAttribute, addAttribute, addAttribute, addAttribute, addMapping, addNamespaceDeclaration, addTextNode, getAllAttributes, getAsDocument, getAsDOM, getAttributes, getAttributeValue, getAttributeValue, getChildren, getCompleteAttributes, getElementName, getEncodingStyle, getEnvelope, getFixupDeserializer, getHref, getID, getName, getNamespacePrefixes, getNamespaceURI, getNamespaceURI, getObjectValue, getParentElement, getPrefix, getPrefix, getQName, getRealElement, getRecorder, getType, getValue, getValueAsType, isDirty, isRoot, makeAttributesEditable, output, publishContents, publishToHandler, recycleNode, removeAttribute, removeNamespaceDeclaration, setAttribute, setContentsIndex, setDirty, setEncodingStyle, setEndIndex, setEnvelope, setFixupDeserializer, setName, setNamespaceURI, setNSMappings, setObjectValue, setPrefix, setQName, setRecorder, setType, toString`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface javax.xml.soap.SOAPElement
`addAttribute, addNamespaceDeclaration, addTextNode, getAllAttributes, getAttributeValue, getElementName, getEncodingStyle, getNamespacePrefixes, getNamespaceURI, removeAttribute, removeNamespaceDeclaration, setEncodingStyle`

Methods inherited from interface javax.xml.soap.Node
`getParentElement, getValue, recycleNode`

Constructor Detail

### SOAPHeader

    public SOAPHeader(java.lang.String namespace,
                      java.lang.String localPart,
                      java.lang.String prefix,
                      org.xml.sax.Attributes attributes,
                      DeserializationContext context,
                      SOAPConstants soapConsts)
               throws AxisFault

Method Detail

### setParentElement

    public void setParentElement(SOAPElement parent)
                          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 `MessageElement`
  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:
    `getParentElement()`

### detachNode

    public void detachNode()

  Description copied from interface: `Node`
  Removes this `Node` object from the tree. Once removed, this node can be garbage collected if there are no application references to it.

  Specified by:
    `detachNode` in interface `Node`
  Overrides:
    `detachNode` in class `MessageElement`

### 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 java.util.Iterator examineHeaderElements(java.lang.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(java.lang.String)`

### extractHeaderElements

    public java.util.Iterator extractHeaderElements(java.lang.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:
    `examineHeaderElements(java.lang.String)`

### outputImpl

    protected void outputImpl(SerializationContext context)
                       throws java.lang.Exception

  Description copied from class: `MessageElement`
  Subclasses can override

  Overrides:
    `outputImpl` in class `MessageElement`
    `java.lang.Exception`

### addChild

    public void addChild(MessageElement el)
                  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`
    `SOAPException`

### getChildElements

    public java.util.Iterator getChildElements()

  Description copied from interface: `SOAPElement`
  Returns an iterator over all the immediate content of this element. This includes `Text` objects as well as `SOAPElement` objects.

  Specified by:
    `getChildElements` in interface `SOAPElement`
  Overrides:
    `getChildElements` in class `MessageElement`
  Returns:
    an iterator with the content of this `SOAPElement` object

### getChildElements

    public java.util.Iterator getChildElements(Name name)

  Description copied from interface: `SOAPElement`
  Returns an iterator over all the child elements with the specified name.

  Specified by:
    `getChildElements` in interface `SOAPElement`
  Overrides:
    `getChildElements` in class `MessageElement`
  Parameters:
    `name` - a `Name` object with the name of the child elements to be returned
  Returns:
    an `Iterator` object over all the elements in this `SOAPElement` object with the specified name

### removeChild

    public void removeChild(MessageElement child)

  Description copied from class: `MessageElement`
  Remove a child element.

  Overrides:
    `removeChild` in class `MessageElement`

### addChildElement

    public SOAPElement addChildElement(SOAPElement element)
                                throws SOAPException

  we have to override this to enforce that SOAPHeader immediate children are exclusively of type SOAPHeaderElement (otherwise we'll get mysterious ClassCastExceptions down the road... )

  Specified by:
    `addChildElement` in interface `SOAPElement`
  Overrides:
    `addChildElement` in class `MessageElement`
  Parameters:
    `element` - child element
  Returns:
    soap element
  Throws:
    `SOAPException`

### addChildElement

    public SOAPElement addChildElement(Name name)
                                throws SOAPException

  Description copied from interface: `SOAPElement`
  Creates a new `SOAPElement` object initialized with the given `Name` object and adds the new element to this `SOAPElement` object.

  Specified by:
    `addChildElement` in interface `SOAPElement`
  Overrides:
    `addChildElement` in class `MessageElement`
  Parameters:
    `name` - a `Name` object with the XML name for the new element
  Returns:
    the new `SOAPElement` object that was created
  Throws:
    `SOAPException` - if there is an error in creating the `SOAPElement` object

### addChildElement

    public SOAPElement addChildElement(java.lang.String localName)
                                throws SOAPException

  Description copied from interface: `SOAPElement`
  Creates a new `SOAPElement` object initialized with the given `String` object and adds the new element to this `SOAPElement` object.

  Specified by:
    `addChildElement` in interface `SOAPElement`
  Overrides:
    `addChildElement` in class `MessageElement`
  Parameters:
    `localName` - a `String` giving the local name for the element
  Returns:
    the new `SOAPElement` object that was created
  Throws:
    `SOAPException` - if there is an error in creating the `SOAPElement` object

### addChildElement

    public SOAPElement addChildElement(java.lang.String localName,
                                       java.lang.String prefix)
                                throws SOAPException

  Description copied from interface: `SOAPElement`
  Creates a new `SOAPElement` object initialized with the specified local name and prefix and adds the new element to this `SOAPElement` object.

  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 new `SOAPElement` object that was created
  Throws:
    `SOAPException` - if there is an error in creating the `SOAPElement` object

### addChildElement

    public SOAPElement addChildElement(java.lang.String localName,
                                       java.lang.String prefix,
                                       java.lang.String uri)
                                throws SOAPException

  Description copied from interface: `SOAPElement`
  Creates a new `SOAPElement` object initialized with the specified local name, prefix, and URI and adds the new element to this `SOAPElement` object.

  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 new `SOAPElement` object that was created
  Throws:
    `SOAPException` - if there is an error in creating the `SOAPElement` object

Copyright © 2003 Apache Web Services Project. All Rights Reserved.