org.apache.axis.message

Class SOAPHeader

Implemented Interfaces:
Cloneable, org.w3c.dom.Element, Node, org.w3c.dom.NodeList, Serializable, SOAPElement, SOAPHeader

public class SOAPHeader
extends MessageElement
implements SOAPHeader

Holder for header elements.
Author:
Glyn Normington (glyn@apache.org)

Nested Class Summary

Nested classes/interfaces inherited from class org.apache.axis.message.MessageElement

MessageElement.QNameAttr

Field Summary

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

_isRoot, context, encodingStyle, endEventIndex, fixupDeserializer, href, id, log, message, namespaces, qNameAttrs, recorder, startContentsIndex, startEventIndex, typeQName

Fields inherited from class org.apache.axis.message.NodeImpl

_isDirty, attributes, children, document, log, name, namespaceURI, parent, prefix, textRep

Constructor Summary

SOAPHeader(String namespace, String localPart, String prefix, Attributes attributes, DeserializationContext context, SOAPConstants soapConsts)

Method Summary

void
addChild(MessageElement element)
Note that this method will log a error and no-op if there is a value (set using setObjectValue) in the MessageElement.
SOAPElement
addChildElement(String localName)
Creates a new SOAPElement object initialized with the given String object and adds the new element to this SOAPElement object.
SOAPElement
addChildElement(String localName, 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(String localName, String prefix, 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.
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)
Add a SOAPElement as a child of this SOAPElement instance.
SOAPHeaderElement
addHeaderElement(Name name)
Creates a new SOAPHeaderElement object initialized with the specified name and adds it to this SOAPHeader object.
Node
appendChild(Node newChild)
Iterator
examineAllHeaderElements()
Returns an Iterator over all the SOAPHeaderElement objects in this SOAPHeader object.
Iterator
examineHeaderElements(String actor)
Returns a list of all the SOAPHeaderElement objects in this SOAPHeader object that have the the specified actor.
Iterator
examineMustUnderstandHeaderElements(String actor)
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.
Iterator
extractAllHeaderElements()
Returns an Iterator over all the SOAPHeaderElement objects in this SOAPHeader object and detaches them from this SOAPHeader object.
Iterator
extractHeaderElements(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.
protected void
outputImpl(SerializationContext context)
override point -output to a serialization context.
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, addChild, addChildElement, addChildElement, addChildElement, addChildElement, addChildElement, addMapping, addNamespaceDeclaration, addTextNode, childDeepCloned, cloneNode, cloning, detachAllChildren, equals, findElement, getAllAttributes, getAsDOM, getAsDocument, getAsString, getAttribute, getAttributeNS, getAttributeNode, getAttributeNodeNS, getAttributeValue, getAttributeValue, getAttributesEx, getChildElement, getChildElements, getChildElements, getChildElements, getChildren, getCompleteAttributes, getDeserializationContext, getElementName, getElementsByTagName, getElementsByTagNameNS, getElementsNS, getEncodingStyle, getEnvelope, getFixupDeserializer, getHref, getID, getLength, getName, getNamespacePrefixes, getNamespaceURI, getObjectValue, getObjectValue, getOwnerDocument, getPrefix, getQName, getRealElement, getRecorder, getTagName, getType, getValue, getValueAsType, getValueAsType, getValueDOM, getVisibleNamespacePrefixes, hasAttribute, hasAttributeNS, isRoot, item, output, outputImpl, publishContents, publishToHandler, removeAttribute, removeAttribute, removeAttributeNS, removeAttributeNode, removeContents, removeNamespaceDeclaration, setAllAttributes, setAttribute, setAttribute, setAttributeNS, setAttributeNode, setAttributeNodeNS, setContentsIndex, setEncodingStyle, setEndIndex, setEnvelope, setFixupDeserializer, setNSMappings, setName, setNamespaceURI, setObjectValue, setQName, setRecorder, setType, setValue, toString

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

appendChild, cloneNode, compareDocumentPosition, convertAttrSAXtoDOM, detachNode, getAttributes, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParent, getParentElement, getParentNode, getPrefix, getPreviousSibling, getSchemaTypeInfo, getTextContent, getUserData, getValue, hasAttributes, hasChildNodes, initializeChildren, insertBefore, isDefaultNamespace, isDirty, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, makeAttributesEditable, normalize, output, recycleNode, removeChild, replaceChild, reset, setDirty, setDirty, setIdAttribute, setIdAttributeNS, setIdAttributeNode, setNodeValue, setOwnerDocument, setParent, setParentElement, setPrefix, setTextContent, setUserData, setValue

Constructor Details

SOAPHeader

public SOAPHeader(String namespace,
                  String localPart,
                  String prefix,
                  Attributes attributes,
                  DeserializationContext context,
                  SOAPConstants soapConsts)
            throws AxisFault

Method Details

addChild

public void addChild(MessageElement element)
            throws SOAPException
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 interface MessageElement

addChildElement

public SOAPElement addChildElement(String localName)
            throws SOAPException
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 interface 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(String localName,
                                   String prefix)
            throws SOAPException
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 interface 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(String localName,
                                   String prefix,
                                   String uri)
            throws SOAPException
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 interface 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

addChildElement

public SOAPElement addChildElement(Name name)
            throws SOAPException
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 interface 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(SOAPElement element)
            throws SOAPException
Add a SOAPElement as a child of this SOAPElement instance. The SOAPElement is expected to be created by a SOAPElementFactory. Callers should not rely on the element instance being added as is into the XML tree. Implementations could end up copying the content of the SOAPElement passed into an instance of a different SOAPElement implementation. For instance if addChildElement() is called on a SOAPHeader, element will be copied into an instance of a SOAPHeaderElement.

The fragment rooted in element is either added as a whole or not at all, if there was an error.

The fragment rooted in element cannot contain elements named "Envelope", "Header" or "Body" and in the SOAP namespace. Any namespace prefixes present in the fragment should be fully resolved using appropriate namespace declarations within the fragment itself.

Specified by:
addChildElement in interface SOAPElement
Overrides:
addChildElement in interface 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

addHeaderElement

public SOAPHeaderElement addHeaderElement(Name name)
            throws SOAPException
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

appendChild

public Node appendChild(Node newChild)
            throws DOMException
Overrides:
appendChild in interface NodeImpl

examineAllHeaderElements

public Iterator examineAllHeaderElements()
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

examineHeaderElements

public Iterator examineHeaderElements(String actor)
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)

examineMustUnderstandHeaderElements

public Iterator examineMustUnderstandHeaderElements(String actor)
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

extractAllHeaderElements

public Iterator extractAllHeaderElements()
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

extractHeaderElements

public Iterator extractHeaderElements(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.

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 Exception
override point -output to a serialization context.
Overrides:
outputImpl in interface MessageElement
Parameters:

setParentElement

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

Copyright B) 2005 Apache Web Services Project. All Rights Reserved.