You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by ch...@apache.org on 2006/02/01 11:36:10 UTC

svn commit: r374036 [6/15] - in /webservices/commons/trunk/axiom: src/org/apache/ws/ src/org/apache/ws/commons/ src/org/apache/ws/commons/attachments/ src/org/apache/ws/commons/attachments/utils/ src/org/apache/ws/commons/om/ src/org/apache/ws/commons/...

Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/xpath/DocumentNavigator.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/xpath/DocumentNavigator.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/xpath/DocumentNavigator.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/om/xpath/DocumentNavigator.java Wed Feb  1 02:33:37 2006
@@ -0,0 +1,738 @@
+package org.apache.ws.commons.om.xpath;
+
+import org.apache.ws.commons.om.OMAttribute;
+import org.apache.ws.commons.om.OMComment;
+import org.apache.ws.commons.om.OMContainer;
+import org.apache.ws.commons.om.OMDocument;
+import org.apache.ws.commons.om.OMElement;
+import org.apache.ws.commons.om.OMNamespace;
+import org.apache.ws.commons.om.OMNode;
+import org.apache.ws.commons.om.OMProcessingInstruction;
+import org.apache.ws.commons.om.OMText;
+import org.apache.ws.commons.om.impl.llom.OMNamespaceImpl;
+import org.apache.ws.commons.om.impl.llom.builder.StAXOMBuilder;
+import org.jaxen.BaseXPath;
+import org.jaxen.DefaultNavigator;
+import org.jaxen.FunctionCallException;
+import org.jaxen.JaxenConstants;
+import org.jaxen.UnsupportedAxisException;
+import org.jaxen.XPath;
+import org.jaxen.saxpath.SAXPathException;
+import org.jaxen.util.SingleObjectIterator;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+import java.io.FileInputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+
+public class DocumentNavigator extends DefaultNavigator {
+	
+    private static final long serialVersionUID = 7325116153349780805L;
+
+	/**
+     * Returns a parsed form of the given xpath string, which will be suitable
+     * for queries on documents that use the same navigator as this one.
+     *
+     * @param xpath the XPath expression
+     * @return Returns a new XPath expression object.
+     * @throws SAXPathException if the string is not a syntactically
+     *                          correct XPath expression
+     * @see XPath
+     */
+    public XPath parseXPath(String xpath) throws SAXPathException {
+        return new BaseXPath(xpath, this);
+    }
+
+    /**
+     * Retrieves the namespace URI of the given element node.
+     *
+     * @param object the context element node
+     * @return Returns the namespace URI of the element node.
+     */
+    public String getElementNamespaceUri(Object object) {
+        OMElement attr = (OMElement) object;
+        return attr.getQName().getNamespaceURI();
+    }
+
+    /**
+     * Retrieves the name of the given element node.
+     *
+     * @param object the context element node
+     * @return Returns the name of the element node.
+     */
+    public String getElementName(Object object) {
+        OMElement attr = (OMElement) object;
+        return attr.getQName().getLocalPart();
+    }
+
+    /**
+     * Retrieves the QName of the given element node.
+     *
+     * @param object the context element node
+     * @return Returns the QName of the element node.
+     */
+    public String getElementQName(Object object) {
+        OMElement attr = (OMElement) object;
+        String prefix = null;
+        if (attr.getNamespace() != null) {
+            prefix = attr.getNamespace().getPrefix();
+        }
+        if (prefix == null || "".equals(prefix)) {
+            return attr.getQName().getLocalPart();
+        }
+        return prefix + ":" + attr.getNamespace().getName();
+    }
+
+    /**
+     * Retrieves the namespace URI of the given attribute node.
+     *
+     * @param object the context attribute node
+     * @return Returns the namespace URI of the attribute node.
+     */
+    public String getAttributeNamespaceUri(Object object) {
+        OMAttribute attr = (OMAttribute) object;
+        return attr.getQName().getNamespaceURI();
+    }
+
+    /**
+     * Retrieves the name of the given attribute node.
+     *
+     * @param object the context attribute node
+     * @return Returns the name of the attribute node.
+     */
+    public String getAttributeName(Object object) {
+        OMAttribute attr = (OMAttribute) object;
+        return attr.getQName().getLocalPart();
+    }
+
+    /**
+     * Retrieves the QName of the given attribute node.
+     *
+     * @param object the context attribute node
+     * @return Returns the qualified name of the attribute node.
+     */
+    public String getAttributeQName(Object object) {
+        OMAttribute attr = (OMAttribute) object;
+        String prefix = attr.getNamespace().getPrefix();
+        if (prefix == null || "".equals(prefix)) {
+            return attr.getQName().getLocalPart();
+        }
+        return prefix + ":" + attr.getNamespace().getName();
+    }
+
+    /**
+     * Returns whether the given object is a document node. A document node
+     * is the node that is selected by the xpath expression <code>/</code>.
+     *
+     * @param object the object to test
+     * @return Returns <code>true</code> if the object is a document node,
+     *         else <code>false</code> .
+     */
+    public boolean isDocument(Object object) {
+        return object instanceof OMDocument;
+    }
+
+    /**
+     * Returns whether the given object is an element node.
+     *
+     * @param object the object to test
+     * @return Returns <code>true</code> if the object is an element node,
+     *         else <code>false</code> .
+     */
+    public boolean isElement(Object object) {
+        return object instanceof OMElement;
+    }
+
+    /**
+     * Returns whether the given object is an attribute node.
+     *
+     * @param object the object to test
+     * @return Returns <code>true</code> if the object is an attribute node,
+     *         else <code>false</code> .
+     */
+    public boolean isAttribute(Object object) {
+        return object instanceof OMAttribute;
+    }
+
+    /**
+     * Returns whether the given object is a namespace node.
+     *
+     * @param object the object to test
+     * @return Returns <code>true</code> if the object is a namespace node,
+     *         else <code>false</code> .
+     */
+    public boolean isNamespace(Object object) {
+        return object instanceof OMNamespace;
+    }
+
+    /**
+     * Returns whether the given object is a comment node.
+     *
+     * @param object the object to test
+     * @return Returns <code>true</code> if the object is a comment node,
+     *         else <code>false</code> .
+     */
+    public boolean isComment(Object object) {
+        return (object instanceof OMComment);
+    }
+
+    /**
+     * Returns whether the given object is a text node.
+     *
+     * @param object the object to test
+     * @return Returns <code>true</code> if the object is a text node,
+     *         else <code>false</code> .
+     */
+    public boolean isText(Object object) {
+        return (object instanceof OMText);
+    }
+
+    /**
+     * Returns whether the given object is a processing-instruction node.
+     *
+     * @param object the object to test
+     * @return Returns <code>true</code> if the object is a processing-instruction node,
+     *         else <code>false</code> .
+     */
+    public boolean isProcessingInstruction(Object object) {
+        return (object instanceof OMProcessingInstruction);
+    }
+
+    /**
+     * Retrieves the string-value of a comment node.
+     * This may be the empty string if the comment is empty,
+     * but must not be null.
+     *
+     * @param object the comment node
+     * @return Returns the string-value of the node.
+     */
+    public String getCommentStringValue(Object object) {
+        return ((OMComment) object).getValue();
+    }
+
+    /**
+     * Retrieves the string-value of an element node.
+     * This may be the empty string if the element is empty,
+     * but must not be null.
+     *
+     * @param object the comment node.
+     * @return Returns the string-value of the node.
+     */
+    public String getElementStringValue(Object object) {
+        if (isElement(object)) {
+            return getStringValue((OMElement) object, new StringBuffer())
+                    .toString();
+        }
+        return null;
+    }
+
+    private StringBuffer getStringValue(OMNode node, StringBuffer buffer) {
+        if (isText(node)) {
+            buffer.append(((OMText) node).getText());
+        } else if (node instanceof OMElement) {
+            Iterator children = ((OMElement) node).getChildren();
+            while (children.hasNext()) {
+                getStringValue((OMNode) children.next(), buffer);
+            }
+        }
+        return buffer;
+    }
+
+    /**
+     * Retrieves the string-value of an attribute node.
+     * This should be the XML 1.0 normalized attribute value.
+     * This may be the empty string but must not be null.
+     *
+     * @param object the attribute node
+     * @return Returns the string-value of the node.
+     */
+    public String getAttributeStringValue(Object object) {
+        return ((OMAttribute) object).getAttributeValue();
+    }
+
+    /**
+     * Retrieves the string-value of a namespace node.
+     * This is generally the namespace URI.
+     * This may be the empty string but must not be null.
+     *
+     * @param object the namespace node
+     * @return Returns the string-value of the node.
+     */
+    public String getNamespaceStringValue(Object object) {
+        return ((OMNamespace) object).getName();
+    }
+
+    /**
+     * Retrieve the string-value of a text node.
+     * This must not be null and should not be the empty string.
+     * The XPath data model does not allow empty text nodes.
+     *
+     * @param object the text node
+     * @return Returns the string-value of the node.
+     */
+    public String getTextStringValue(Object object) {
+        return ((OMText) object).getText();
+    }
+
+    /**
+     * Retrieves the namespace prefix of a namespace node.
+     *
+     * @param object the namespace node
+     * @return Returns the prefix associated with the node.
+     */
+    public String getNamespacePrefix(Object object) {
+        return ((OMNamespace) object).getPrefix();
+    }
+
+    /**
+     * Retrieves an <code>Iterator</code> matching the <code>child</code>
+     * XPath axis.
+     *
+     * @param contextNode the original context node
+     * @return Returns an Iterator capable of traversing the axis, not null.
+     * @throws UnsupportedAxisException if the semantics of the child axis are
+     *                                  not supported by this object model
+     */
+    public Iterator getChildAxisIterator(Object contextNode) throws UnsupportedAxisException {
+        if (contextNode instanceof OMContainer) {
+            return ((OMContainer) contextNode).getChildren();
+        }
+        return JaxenConstants.EMPTY_ITERATOR;
+    }
+
+    public Iterator getDescendantAxisIterator(Object object) throws UnsupportedAxisException {
+        //TODO: Fix this better?
+        return super.getDescendantAxisIterator(object);
+    }
+
+    /**
+     * Retrieves an <code>Iterator</code> matching the <code>attribute</code>
+     * XPath axis.
+     *
+     * @param contextNode the original context node
+     * @return Returns an Iterator capable of traversing the axis, not null.
+     * @throws UnsupportedAxisException if the semantics of the attribute axis are
+     *                                  not supported by this object model
+     */
+    public Iterator getAttributeAxisIterator(Object contextNode) throws UnsupportedAxisException {
+        if (isElement(contextNode)) {
+            ArrayList attributes = new ArrayList();
+            Iterator i = ((OMElement) contextNode).getAllAttributes();
+            while (i != null && i.hasNext()) {
+                attributes.add(
+                        new OMAttributeEx((OMAttribute) i.next(),
+                                (OMContainer) contextNode));
+            }
+            return attributes.iterator();
+        }
+        return JaxenConstants.EMPTY_ITERATOR;
+    }
+
+    /**
+     * Retrieves an <code>Iterator</code> matching the <code>namespace</code>
+     * XPath axis.
+     *
+     * @param contextNode the original context node
+     * @return Returns an Iterator capable of traversing the axis, not null.
+     * @throws UnsupportedAxisException if the semantics of the namespace axis are
+     *                                  not supported by this object model
+     */
+    public Iterator getNamespaceAxisIterator(Object contextNode) throws UnsupportedAxisException {
+        if (!(contextNode instanceof OMContainer &&
+                contextNode instanceof OMElement)) {
+            return JaxenConstants.EMPTY_ITERATOR;
+        }
+        List nsList = new ArrayList();
+        HashSet prefixes = new HashSet();
+        for (OMContainer context = (OMContainer) contextNode;
+             context != null && !(context instanceof OMDocument);
+             context = ((OMElement) context).getParent()) {
+            OMElement element = (OMElement) context;
+            ArrayList declaredNS = new ArrayList();
+            Iterator i = element.getAllDeclaredNamespaces();
+            while (i != null && i.hasNext()) {
+                declaredNS.add(i.next());
+            }
+            declaredNS.add(element.getNamespace());
+            for (Iterator iter = element.getAllAttributes();
+                 iter != null && iter.hasNext();) {
+                OMAttribute attr = (OMAttribute) iter.next();
+                declaredNS.add(attr.getNamespace());
+            }
+            for (Iterator iter = declaredNS.iterator();
+                 iter != null && iter.hasNext();) {
+                OMNamespace namespace = (OMNamespace) iter.next();
+                if (namespace != null) {
+                    String prefix = namespace.getPrefix();
+                    if (prefix != null && !prefixes.contains(prefix)) {
+                        prefixes.add(prefix);
+                        nsList.add(new OMNamespaceEx(namespace, context));
+                    }
+                }
+            }
+        }
+        nsList.add(
+                new OMNamespaceEx(
+                        new OMNamespaceImpl(
+                                "http://www.w3.org/XML/1998/namespace", "xml"),
+                        (OMContainer) contextNode));
+        return nsList.iterator();
+    }
+
+    /**
+     * Retrieves an <code>Iterator</code> matching the <code>self</code> xpath
+     * axis.
+     *
+     * @param contextNode the original context node
+     * @return Returns an Iterator capable of traversing the axis, not null.
+     * @throws UnsupportedAxisException if the semantics of the self axis are
+     *                                  not supported by this object model
+     */
+    public Iterator getSelfAxisIterator(Object contextNode) throws UnsupportedAxisException {
+        //TODO: Fix this better?
+        return super.getSelfAxisIterator(contextNode);
+    }
+
+    /**
+     * Retrieves an <code>Iterator</code> matching the
+     * <code>descendant-or-self</code> XPath axis.
+     *
+     * @param contextNode the original context node
+     * @return Returns an Iterator capable of traversing the axis, not null.
+     * @throws UnsupportedAxisException if the semantics of the descendant-or-self axis are
+     *                                  not supported by this object model
+     */
+    public Iterator getDescendantOrSelfAxisIterator(Object contextNode) throws UnsupportedAxisException {
+        //TODO: Fix this better?
+        return super.getDescendantOrSelfAxisIterator(contextNode);
+    }
+
+    /**
+     * Retrieves an <code>Iterator</code> matching the
+     * <code>ancestor-or-self</code> XPath axis.
+     *
+     * @param contextNode the original context node
+     * @return Returns an Iterator capable of traversing the axis, not null.
+     * @throws UnsupportedAxisException if the semantics of the ancestor-or-self axis are
+     *                                  not supported by this object model
+     */
+    public Iterator getAncestorOrSelfAxisIterator(Object contextNode) throws UnsupportedAxisException {
+        //TODO: Fix this better?
+        return super.getAncestorOrSelfAxisIterator(contextNode);
+    }
+
+    /**
+     * Retrieves an <code>Iterator</code> matching the <code>parent</code> XPath axis.
+     *
+     * @param contextNode the original context node
+     * @return Returns an Iterator capable of traversing the axis, not null.
+     * @throws UnsupportedAxisException if the semantics of the parent axis are
+     *                                  not supported by this object model
+     */
+    public Iterator getParentAxisIterator(Object contextNode) throws UnsupportedAxisException {
+        if (contextNode instanceof OMNode) {
+            return new SingleObjectIterator(((OMNode) contextNode).getParent());
+        } else if (contextNode instanceof OMNamespaceEx) {
+            return new SingleObjectIterator(
+                    ((OMNamespaceEx) contextNode).getParent());
+        } else if (contextNode instanceof OMAttributeEx) {
+            return new SingleObjectIterator(
+                    ((OMAttributeEx) contextNode).getParent());
+        }
+        return JaxenConstants.EMPTY_ITERATOR;
+    }
+
+    /**
+     * Retrieves an <code>Iterator</code> matching the <code>ancestor</code>
+     * XPath axis.
+     *
+     * @param contextNode the original context node
+     * @return Returns an Iterator capable of traversing the axis, not null.
+     * @throws UnsupportedAxisException if the semantics of the ancestor axis are
+     *                                  not supported by this object model
+     */
+    public Iterator getAncestorAxisIterator(Object contextNode) throws UnsupportedAxisException {
+        //TODO: Fix this better?
+        return super.getAncestorAxisIterator(contextNode);
+    }
+
+    /**
+     * Retrieves an <code>Iterator</code> matching the
+     * <code>following-sibling</code> XPath axis.
+     *
+     * @param contextNode the original context node
+     * @return Returns an Iterator capable of traversing the axis, not null.
+     * @throws UnsupportedAxisException if the semantics of the following-sibling axis are
+     *                                  not supported by this object model
+     */
+    public Iterator getFollowingSiblingAxisIterator(Object contextNode) throws UnsupportedAxisException {
+        ArrayList list = new ArrayList();
+        if (contextNode != null && contextNode instanceof OMNode) {
+            while (contextNode != null && contextNode instanceof OMNode) {
+                contextNode = ((OMNode) contextNode).getNextOMSibling();
+                if (contextNode != null)
+                    list.add(contextNode);
+            }
+        }
+        return list.iterator();
+    }
+
+    /**
+     * Retrieves an <code>Iterator</code> matching the
+     * <code>preceding-sibling</code> XPath axis.
+     *
+     * @param contextNode the original context node
+     * @return Returns an Iterator capable of traversing the axis, not null.
+     * @throws UnsupportedAxisException if the semantics of the preceding-sibling axis are
+     *                                  not supported by this object model
+     */
+    public Iterator getPrecedingSiblingAxisIterator(Object contextNode) throws UnsupportedAxisException {
+        ArrayList list = new ArrayList();
+        if (contextNode != null && contextNode instanceof OMNode) {
+            while (contextNode != null && contextNode instanceof OMNode) {
+                contextNode = ((OMNode) contextNode).getPreviousOMSibling();
+                if (contextNode != null)
+                    list.add(contextNode);
+            }
+        }
+        return list.iterator();
+    }
+
+    /**
+     * Retrieves an <code>Iterator</code> matching the <code>following</code>
+     * XPath axis.
+     *
+     * @param contextNode the original context node
+     * @return Returns an Iterator capable of traversing the axis, not null.
+     * @throws UnsupportedAxisException if the semantics of the following axis are
+     *                                  not supported by this object model
+     */
+    public Iterator getFollowingAxisIterator(Object contextNode) throws UnsupportedAxisException {
+        //TODO: Fix this better?
+        return super.getFollowingAxisIterator(contextNode);
+    }
+
+    /**
+     * Retrieves an <code>Iterator</code> matching the <code>preceding</code> XPath axis.
+     *
+     * @param contextNode the original context node
+     * @return Returns an Iterator capable of traversing the axis, not null.
+     * @throws UnsupportedAxisException if the semantics of the preceding axis are
+     *                                  not supported by this object model
+     */
+    public Iterator getPrecedingAxisIterator(Object contextNode) throws UnsupportedAxisException {
+        //TODO: Fix this better?
+        return super.getPrecedingAxisIterator(contextNode);
+    }
+
+    /**
+     * Loads a document from the given URI.
+     *
+     * @param uri the URI of the document to load
+     * @return Returns the document.
+     * @throws FunctionCallException if the document could not be loaded
+     */
+    public Object getDocument(String uri)
+            throws FunctionCallException {
+        try {
+            XMLStreamReader parser;
+            XMLInputFactory xmlInputFactory = XMLInputFactory.newInstance();
+            xmlInputFactory.setProperty(XMLInputFactory.IS_COALESCING, Boolean.TRUE);
+            if (uri.indexOf(':') == -1) {
+                parser = xmlInputFactory.createXMLStreamReader(
+                                new FileInputStream(uri));
+            } else {
+                URL url = new URL(uri);
+                parser = xmlInputFactory.createXMLStreamReader(
+                                url.openStream());
+            }
+            StAXOMBuilder builder =
+                    new StAXOMBuilder(parser);
+            return builder.getDocumentElement().getParent();
+        } catch (Exception e) {
+            throw new FunctionCallException(e);
+        }
+    }
+
+    /**
+     * Returns the element whose ID is given by elementId.
+     * If no such element exists, returns null.
+     * Attributes with the name "ID" are not of type ID unless so defined.
+     * Implementations that do not know whether attributes are of type ID or
+     * not are expected to return null.
+     *
+     * @param contextNode a node from the document in which to look for the
+     *                    id
+     * @param elementId   id to look for
+     * @return Returns element whose ID is given by elementId, or null if no such
+     *         element exists in the document or if the implementation
+     *         does not know about attribute types.
+     */
+    public Object getElementById(Object contextNode, String elementId) {
+        //TODO: Fix this better?
+        return super.getElementById(contextNode, elementId);
+    }
+
+    /**
+     * Returns the document node that contains the given context node.
+     *
+     * @param contextNode the context node
+     * @return Returns the document of the context node.
+     * @see #isDocument(Object)
+     */
+    public Object getDocumentNode(Object contextNode) {
+        if (contextNode instanceof OMDocument) {
+            return contextNode;
+        }
+        return getDocumentNode(((OMNode) contextNode).getParent());
+    }
+
+    /**
+     * Translates a namespace prefix to a namespace URI, <b>possibly</b>
+     * considering a particular element node.
+     * <p/>
+     * Strictly speaking, prefix-to-URI translation should occur
+     * irrespective of any element in the document.  This method
+     * is provided to allow a non-conforming ease-of-use enhancement.
+     * </p>
+     *
+     * @param prefix  the prefix to translate
+     * @param element the element to consider during translation
+     * @return Returns the namespace URI associated with the prefix.
+     */
+    public String translateNamespacePrefixToUri(String prefix, Object element) {
+        //TODO: Fix this better?
+        return super.translateNamespacePrefixToUri(prefix, element);
+    }
+
+    /**
+     * Retrieves the target of a processing-instruction.
+     *
+     * @param object the context processing-instruction node
+     * @return Returns the target of the processing-instruction node.
+     */
+    public String getProcessingInstructionTarget(Object object) {
+        return ((OMProcessingInstruction)object).getTarget();
+    }
+
+    /**
+     * Retrieves the data of a processing-instruction.
+     *
+     * @param object the context processing-instruction node
+     * @return Returns the data of the processing-instruction node.
+     */
+    public String getProcessingInstructionData(Object object) {
+        return ((OMProcessingInstruction)object).getValue();
+    }
+
+    /**
+     * Returns a number that identifies the type of node that the given
+     * object represents in this navigator. See org.jaxen.pattern.Pattern
+     *
+     * @param node ????
+     * @return Returns short.
+     */
+    public short getNodeType(Object node) {
+        //TODO: Fix this better?
+        return super.getNodeType(node);
+    }
+
+    /**
+     * Returns the parent of the given context node.
+     * <p/>
+     * The parent of any node must either be a document
+     * node or an element node.
+     *
+     * @param contextNode the context node
+     * @return Returns the parent of the context node, or null if this is a document node.
+     * @throws UnsupportedAxisException if the parent axis is not
+     *                                  supported by the model
+     * @see #isDocument
+     * @see #isElement
+     */
+    public Object getParentNode(Object contextNode) throws UnsupportedAxisException {
+        if (contextNode == null ||
+                contextNode instanceof OMDocument) {
+            return null;
+        } else if (contextNode instanceof OMAttributeEx) {
+            return ((OMAttributeEx) contextNode).getParent();
+        } else if (contextNode instanceof OMNamespaceEx) {
+            return ((OMNamespaceEx) contextNode).getParent();
+        }
+        return ((OMNode) contextNode).getParent();
+    }
+
+    class OMNamespaceEx implements OMNamespace {
+        OMNamespace originalNsp = null;
+        OMContainer parent = null;
+
+        OMNamespaceEx(OMNamespace nsp, OMContainer parent) {
+            originalNsp = nsp;
+            this.parent = parent;
+        }
+
+        public boolean equals(String uri, String prefix) {
+            return originalNsp.equals(uri, prefix);
+        }
+
+        public String getPrefix() {
+            return originalNsp.getPrefix();
+        }
+
+        public String getName() {
+            return originalNsp.getName();
+        }
+
+        public OMContainer getParent() {
+            return parent;
+        }
+    }
+
+    class OMAttributeEx implements OMAttribute {
+        OMAttribute attribute = null;
+        OMContainer parent = null;
+
+        OMAttributeEx(OMAttribute attribute, OMContainer parent) {
+            this.attribute = attribute;
+            this.parent = parent;
+        }
+
+        public String getLocalName() {
+            return attribute.getLocalName();
+        }
+
+        public void setLocalName(String localName) {
+            attribute.setLocalName(localName);
+        }
+
+        public String getAttributeValue() {
+            return attribute.getAttributeValue();
+        }
+
+        public void setAttributeValue(String value) {
+            attribute.setAttributeValue(value);
+        }
+
+        public void setOMNamespace(OMNamespace omNamespace) {
+            attribute.setOMNamespace(omNamespace);
+        }
+
+        public OMNamespace getNamespace() {
+            return attribute.getNamespace();
+        }
+
+        public QName getQName() {
+            return attribute.getQName();
+        }
+
+        public OMContainer getParent() {
+            return parent;
+        }
+    }
+}
+

Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAP11Constants.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAP11Constants.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAP11Constants.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAP11Constants.java Wed Feb  1 02:33:37 2006
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.commons.soap;
+
+
+public interface SOAP11Constants extends SOAPConstants {
+    /**
+     * Eran Chinthaka (chinthaka@apache.org)
+     */
+    public static final String SOAP_ENVELOPE_NAMESPACE_URI = "http://schemas.xmlsoap.org/soap/envelope/";
+
+    /**
+     * Field ATTR_ACTOR
+     */
+    public static final String ATTR_ACTOR = "actor";
+
+    /**
+     * Field SOAP_FAULT_CODE_LOCAL_NAME
+     */
+    public static final String SOAP_FAULT_CODE_LOCAL_NAME = "faultcode";
+    /**
+     * Field SOAP_FAULT_STRING_LOCAL_NAME
+     */
+    public static final String SOAP_FAULT_STRING_LOCAL_NAME = "faultstring";
+    /**
+     * Field SOAP_FAULT_ACTOR_LOCAL_NAME
+     */
+    public static final String SOAP_FAULT_ACTOR_LOCAL_NAME = "faultactor";
+
+    public static final String SOAP_FAULT_DETAIL_LOCAL_NAME = "detail";
+
+    //SOAP 1.2 Content Type
+    public static final String SOAP_11_CONTENT_TYPE = "text/xml";
+
+     // -------- SOAP Fault Codes ------------------------------
+    public static final String FAULT_CODE_SENDER = "Client";
+    public static final String FAULT_CODE_RECEIVER = "Server";
+
+    public static final String SOAP_ACTOR_NEXT = "http://schemas.xmlsoap.org/soap/actor/next";
+}

Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAP12Constants.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAP12Constants.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAP12Constants.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAP12Constants.java Wed Feb  1 02:33:37 2006
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.commons.soap;
+
+
+public interface SOAP12Constants extends SOAPConstants {
+    /**
+     * Eran Chinthaka (chinthaka@apache.org)
+     */
+
+    public String SOAP_ENVELOPE_NAMESPACE_URI =
+            "http://www.w3.org/2003/05/soap-envelope";
+
+    public static final String SOAP_ROLE = "role";
+    public static final String SOAP_RELAY = "relay";
+
+    // SOAP Fault Code
+    public static final String SOAP_FAULT_CODE_LOCAL_NAME = "Code";
+    public static final String SOAP_FAULT_SUB_CODE_LOCAL_NAME = "Subcode";
+    public static final String SOAP_FAULT_VALUE_LOCAL_NAME = "Value";
+
+    // SOAP Fault Codes
+    public static final String SOAP_FAULT_VALUE_VERSION_MISMATCH = "VersionMismatch";
+    public static final String SOAP_FAULT_VALUE_MUST_UNDERSTAND = "MustUnderstand";
+    public static final String SOAP_FAULT_VALUE_DATA_ENCODING_UKNOWN = "DataEncodingUnknown";
+    public static final String SOAP_FAULT_VALUE_SENDER = "Sender";
+    public static final String SOAP_FAULT_VALUE_RECEIVER = "Receiver";
+
+    // SOAP Fault Reason
+    public static final String SOAP_FAULT_REASON_LOCAL_NAME = "Reason";
+    public static final String SOAP_FAULT_TEXT_LOCAL_NAME = "Text";
+    public static final String SOAP_FAULT_TEXT_LANG_ATTR_LOCAL_NAME = "lang";
+    public static final String SOAP_FAULT_TEXT_LANG_ATTR_NS_URI = "http://www.w3.org/XML/1998/namespace";
+    public static final String SOAP_FAULT_TEXT_LANG_ATTR_NS_PREFIX = "xml";
+
+    // SOAP Fault Node
+    public static final String SOAP_FAULT_NODE_LOCAL_NAME = "Node";
+
+    // SOAP Fault Detail
+    public static final String SOAP_FAULT_DETAIL_LOCAL_NAME = "Detail";
+
+    // SOAP Fault Role
+    public static final String SOAP_FAULT_ROLE_LOCAL_NAME = "Role";
+
+    //SOAP 1.2 Content Type
+    public static final String SOAP_12_CONTENT_TYPE = "application/soap+xml";
+
+    // -------- SOAP Fault Codes ------------------------------
+    public static final String FAULT_CODE_SENDER = "Sender";
+    public static final String FAULT_CODE_RECEIVER = "Receiver";
+
+    public static final String SOAP_ROLE_NEXT = "http://www.w3.org/2003/05/soap-envelope/role/next";
+    public static final String SOAP_ROLE_NONE = "http://www.w3.org/2003/05/soap-envelope/role/next";
+    public static final String SOAP_ROLE_ULTIMATE_RECEIVER = "http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver";
+    
+}

Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPBody.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPBody.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPBody.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPBody.java Wed Feb  1 02:33:37 2006
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.commons.soap;
+
+import org.apache.ws.commons.om.OMElement;
+import org.apache.ws.commons.om.OMException;
+
+/**
+ * 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.
+ * <P>
+ * B <code>SOAPBody</code> object contains <code>OMBodyBlock</code>
+ * objects, which have the content for the SOAP body.
+ * B <code>SOAPFault</code> object, which carries status and/or
+ * error information, is an example of a <code>OMBodyBlock</code> object.
+ */
+public interface SOAPBody extends OMElement {
+    /**
+     * Creates a new <code>SOAPFault</code> object and adds it to
+     * this <code>SOAPBody</code> object.
+     *
+     * @param e
+     * @return the new <code>SOAPFault</code> object
+     * @throws org.apache.ws.commons.om.OMException
+     *          if there is a SOAP error
+     * @throws org.apache.ws.commons.om.OMException
+     *
+     */
+    public abstract SOAPFault addFault(Exception e) throws OMException;
+
+    /**
+     * Indicates whether a <code>SOAPFault</code> object exists in
+     * this <code>SOAPBody</code> object.
+     *
+     * @return <code>true</code> if a <code>SOAPFault</code> object exists in
+     *         this <code>SOAPBody</code> object; <code>false</code>
+     *         otherwise
+     */
+    public abstract boolean hasFault();
+
+    /**
+     * Returns the <code>SOAPFault</code> object in this <code>SOAPBody</code>
+     * object.
+     *
+     * @return the <code>SOAPFault</code> object in this <code>SOAPBody</code>
+     *         object
+     */
+    public abstract SOAPFault getFault();
+
+    /**
+     * @param soapFault
+     * @throws OMException
+     */
+    public abstract void addFault(SOAPFault soapFault) throws OMException;
+
+
+}

Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPConstants.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPConstants.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPConstants.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPConstants.java Wed Feb  1 02:33:37 2006
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.commons.soap;
+
+public interface SOAPConstants {
+    /**
+     * Eran Chinthaka (chinthaka@apache.org)
+     */
+    /**
+     * Field SOAP_DEFAULT_NAMESPACE_PREFIX
+     */
+    public static final String SOAP_DEFAULT_NAMESPACE_PREFIX = "soapenv";
+    /**
+     * Field SOAPENVELOPE_LOCAL_NAME
+     */
+    public static final String SOAPENVELOPE_LOCAL_NAME = "Envelope";
+
+    /**
+     * Field HEADER_LOCAL_NAME
+     */
+    public static final String HEADER_LOCAL_NAME = "Header";
+
+    /**
+     * Field BODY_LOCAL_NAME
+     */
+    public static final String BODY_LOCAL_NAME = "Body";
+    /**
+     * Field BODY_NAMESPACE_PREFIX
+     */
+    public static final String BODY_NAMESPACE_PREFIX =
+            SOAP_DEFAULT_NAMESPACE_PREFIX;
+    /**
+     * Field BODY_FAULT_LOCAL_NAME
+     */
+    public static final String BODY_FAULT_LOCAL_NAME = "Fault";
+
+    /**
+     * Field ATTR_MUSTUNDERSTAND
+     */
+    public static final String ATTR_MUSTUNDERSTAND = "mustUnderstand";
+    public static final String ATTR_MUSTUNDERSTAND_TRUE = "true";
+    public static final String ATTR_MUSTUNDERSTAND_FALSE = "false";
+    public static final String ATTR_MUSTUNDERSTAND_0 = "0";
+    public static final String ATTR_MUSTUNDERSTAND_1 = "1";
+    /**
+     * Field SOAPFAULT_LOCAL_NAME
+     */
+    public static final String SOAPFAULT_LOCAL_NAME = "Fault";
+    /**
+     * Field SOAPFAULT_DETAIL_LOCAL_NAME
+     */
+    public static final String SOAPFAULT_DETAIL_LOCAL_NAME = "detail";
+
+    /**
+     * Field SOAPFAULT_NAMESPACE_PREFIX
+     */
+    public static final String SOAPFAULT_NAMESPACE_PREFIX =
+            SOAP_DEFAULT_NAMESPACE_PREFIX;
+
+    public static final String SOAP_FAULT_DETAIL_EXCEPTION_ENTRY = "Exception";
+
+    // -------- SOAP Fault Codes ------------------------------
+    public static final String FAULT_CODE_VERSION_MISMATCH = "env:VersionMismatch";
+    public static final String FAULT_CODE_MUST_UNDERSTAND  = "env:MustUnderstand";
+    public static final String FAULT_CODE_DATA_ENCODING_UNKNOWN = "env:DataEncodingUnknown";
+
+    // Followings are different in SOAP 1.1 and 1.2 specifications
+    public static final String FAULT_CODE_SENDER = "";
+    public static final String FAULT_CODE_RECEIVER = "";
+
+}

Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPEnvelope.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPEnvelope.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPEnvelope.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPEnvelope.java Wed Feb  1 02:33:37 2006
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.commons.soap;
+
+import org.apache.ws.commons.om.OMElement;
+import org.apache.ws.commons.om.OMException;
+
+/**
+ * Interface SOAPEnvelope
+ */
+public interface SOAPEnvelope extends OMElement {
+    /**
+     * Returns the <CODE>SOAPHeader</CODE> object for this <CODE>
+     * SOAPEnvelope</CODE> object.
+     * <P> This SOAPHeader will just be a container for all the headers in the
+     * <CODE>OMMessage</CODE>
+     * </P>
+     *
+     * @return the <CODE>SOAPHeader</CODE> object or <CODE>
+     *         null</CODE> if there is none
+     * @throws org.apache.ws.commons.om.OMException
+     *          if there is a problem
+     *          obtaining the <CODE>SOAPHeader</CODE> object
+     */
+    public abstract SOAPHeader getHeader() throws OMException;
+
+    /**
+     * Returns the <CODE>SOAPBody</CODE> object associated with
+     * this <CODE>SOAPEnvelope</CODE> object.
+     * <P> This SOAPBody will just be a container for all the BodyElements in the
+     * <CODE>OMMessage</CODE>
+     * </P>
+     *
+     * @return the <CODE>SOAPBody</CODE> object for this <CODE>
+     *         SOAPEnvelope</CODE> object or <CODE>null</CODE> if there
+     *         is none
+     * @throws OMException if there is a problem
+     *                     obtaining the <CODE>SOAPBody</CODE> object
+     */
+    public abstract SOAPBody getBody() throws OMException;
+}

Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPFactory.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPFactory.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPFactory.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPFactory.java Wed Feb  1 02:33:37 2006
@@ -0,0 +1,328 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.commons.soap;
+
+import org.apache.ws.commons.om.OMFactory;
+import org.apache.ws.commons.om.OMNamespace;
+import org.apache.ws.commons.om.OMXMLParserWrapper;
+
+
+public interface SOAPFactory extends OMFactory {
+    
+    public String getSoapVersionURI();
+    
+    /**
+     * Eran Chinthaka (chinthaka@apache.org)
+     */
+
+    public SOAPMessage createSOAPMessage(OMXMLParserWrapper builder);
+    public SOAPMessage createSOAPMessage(SOAPEnvelope envelope, OMXMLParserWrapper parserWrapper);
+
+    /**
+     * @param builder
+     * @return Returns SOAPEnvelope.
+     */
+    public SOAPEnvelope createSOAPEnvelope(OMXMLParserWrapper builder);
+
+    /**
+     * @return Returns SOAPEnvelope.
+     */
+    public SOAPEnvelope createSOAPEnvelope() throws SOAPProcessingException;
+
+    /**
+     * @param envelope
+     * @return Returns SOAPHeader.
+     */
+    public SOAPHeader createSOAPHeader(SOAPEnvelope envelope) throws SOAPProcessingException;
+
+    /**
+     * @param envelope
+     * @param builder
+     * @return Returns SOAPHeader.
+     */
+    public SOAPHeader createSOAPHeader(SOAPEnvelope envelope,
+                                       OMXMLParserWrapper builder);
+
+    /**
+     * @param localName
+     * @param ns
+     * @return Returns SOAPHeaderBlock.
+     */
+    public SOAPHeaderBlock createSOAPHeaderBlock(String localName,
+                                                 OMNamespace ns,
+                                                 SOAPHeader parent) throws SOAPProcessingException;
+
+    /**
+     * @param localName
+     * @param ns
+     * @param parent
+     * @param builder
+     * @return Returns SOAPHeaderBlock.
+     */
+    public SOAPHeaderBlock createSOAPHeaderBlock(String localName,
+                                                 OMNamespace ns,
+                                                 SOAPHeader parent,
+                                                 OMXMLParserWrapper builder) throws SOAPProcessingException;
+
+    /**
+     * @param parent
+     * @param e
+     * @return Returns SOAPFault.
+     */
+    public SOAPFault createSOAPFault(SOAPBody parent, Exception e) throws SOAPProcessingException;
+
+    public SOAPFault createSOAPFault(SOAPBody parent) throws SOAPProcessingException;
+
+    /**
+     * @param parent
+     * @param builder
+     * @return Returns SOAPFault.
+     */
+    public SOAPFault createSOAPFault(SOAPBody parent,
+                                     OMXMLParserWrapper builder);
+
+    /**
+     * @param envelope
+     * @return Returns SOAPBody.
+     */
+    public SOAPBody createSOAPBody(SOAPEnvelope envelope) throws SOAPProcessingException;
+
+    /**
+     * @param envelope
+     * @param builder
+     * @return Returns SOAPBody.
+     */
+    public SOAPBody createSOAPBody(SOAPEnvelope envelope,
+                                   OMXMLParserWrapper builder);
+
+    /* ========================
+       =  SOAPFaultCode       =
+       ======================== */
+
+    /**
+     * Code eii under SOAPFault (parent)
+     *
+     * @param parent
+     * @return Returns SOAPFaultCode.
+     */
+    public SOAPFaultCode createSOAPFaultCode(SOAPFault parent) throws SOAPProcessingException;
+
+    /**
+     * Code eii under SOAPFault (parent)
+     *
+     * @param parent
+     * @param builder
+     * @return Returns SOAPFaultCode.
+     */
+    public SOAPFaultCode createSOAPFaultCode(SOAPFault parent,
+                                             OMXMLParserWrapper builder);
+
+
+    /*========================
+      =  SOAPFaultCodeValue  =
+      ======================== */
+    /**
+     * Value eii under Code (parent)
+     *
+     * @param parent
+     * @return Returns SOAPFaultValue.
+     */
+    public SOAPFaultValue createSOAPFaultValue(SOAPFaultCode parent) throws SOAPProcessingException;
+
+    /**
+     * Value eii under Code (parent)
+     *
+     * @param parent
+     * @param builder
+     * @return Returns SOAPFaultValue.
+     */
+    public SOAPFaultValue createSOAPFaultValue(SOAPFaultCode parent,
+                                               OMXMLParserWrapper builder);
+
+    /*========================
+      =  SOAPFaultSubCode    =
+      ======================== */
+
+    /**
+     * SubCode eii under Value (parent)
+     *
+     * @param parent
+     * @return Returns SOAPFaultValue.
+     */
+
+    //added
+    public SOAPFaultValue createSOAPFaultValue(SOAPFaultSubCode parent) throws SOAPProcessingException;
+
+    //added
+    public SOAPFaultValue createSOAPFaultValue(SOAPFaultSubCode parent,
+                                               OMXMLParserWrapper builder);
+
+    //changed
+    public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultCode parent) throws SOAPProcessingException;
+
+    /**
+     * SubCode eii under Value (parent)
+     *
+     * @param parent
+     * @param builder
+     * @return Returns SOAPFaultSubCode.
+     */
+    //changed
+    public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultCode parent,
+                                                   OMXMLParserWrapper builder);
+
+    /**
+     * SubCode eii under SubCode (parent)
+     *
+     * @param parent
+     * @return Returns SOAPFaultSubCode.
+     */
+    public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultSubCode parent) throws SOAPProcessingException;
+
+    /**
+     * SubCode eii under SubCode (parent)
+     *
+     * @param parent
+     * @param builder
+     * @return Returns SOAPFaultSubCode.
+     */
+    public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultSubCode parent,
+                                                   OMXMLParserWrapper builder);
+
+
+    /*========================
+      =  SOAPFaultReason     =
+      ======================== */
+
+    /**
+     * Reason eii under SOAPFault (parent)
+     *
+     * @param parent
+     * @return Returns SOAPFaultReason.
+     */
+    public SOAPFaultReason createSOAPFaultReason(SOAPFault parent) throws SOAPProcessingException;
+
+    /**
+     * Reason eii under SOAPFault (parent)
+     *
+     * @param parent
+     * @param builder
+     * @return Returns SOAPFaultReason.
+     */
+    public SOAPFaultReason createSOAPFaultReason(SOAPFault parent,
+                                                 OMXMLParserWrapper builder);
+
+    /*========================
+      =  SOAPFaultReasonText     =
+      ======================== */
+
+    /**
+     * SubCode eii under SubCode (parent)
+     *
+     * @param parent
+     * @return Returns SOAPFaultText.
+     */
+    public SOAPFaultText createSOAPFaultText(SOAPFaultReason parent) throws SOAPProcessingException;
+
+    /**
+     * SubCode eii under SubCode (parent)
+     *
+     * @param parent
+     * @param builder
+     * @return Returns SOAPFaultText.
+     */
+    public SOAPFaultText createSOAPFaultText(SOAPFaultReason parent,
+                                             OMXMLParserWrapper builder);
+
+
+    /*========================
+      =  SOAPFaultNode       =
+      ======================== */
+
+    /**
+     * Node eii under SOAPFault (parent)
+     *
+     * @param parent
+     * @return Returns SOAPFaultNode.
+     */
+    public SOAPFaultNode createSOAPFaultNode(SOAPFault parent) throws SOAPProcessingException;
+
+    /**
+     * Node eii under SOAPFault (parent)
+     *
+     * @param parent
+     * @param builder
+     * @return Returns SOAPFaultNode.
+     */
+    public SOAPFaultNode createSOAPFaultNode(SOAPFault parent,
+                                             OMXMLParserWrapper builder);
+
+    /*========================
+      =  SOAPFaultRole       =
+      ======================== */
+
+    /**
+     * Role eii under SOAPFault (parent)
+     *
+     * @param parent
+     * @return Returns SOAPFaultRole.
+     */
+    public SOAPFaultRole createSOAPFaultRole(SOAPFault parent) throws SOAPProcessingException;
+
+    /**
+     * Role eii under SOAPFault (parent)
+     *
+     * @param parent
+     * @param builder
+     * @return Returns SOAPFaultRole.
+     */
+    public SOAPFaultRole createSOAPFaultRole(SOAPFault parent,
+                                             OMXMLParserWrapper builder);
+
+    /*========================
+      =  SOAPFaultDetail     =
+      ======================== */
+
+    /**
+     * Detail eii under SOAPFault (parent)
+     *
+     * @param parent
+     * @return Returns SOAPFaultDetail.
+     */
+    public SOAPFaultDetail createSOAPFaultDetail(SOAPFault parent) throws SOAPProcessingException;
+
+    /**
+     * Role eii under SOAPFault (parent)
+     *
+     * @param parent
+     * @param builder
+     * @return Returns SOAPFaultDetail.
+     */
+    public SOAPFaultDetail createSOAPFaultDetail(SOAPFault parent,
+                                                 OMXMLParserWrapper builder);
+
+
+    /**
+     * Method getDefaultEnvelope
+     *
+     * @return Returns SOAPEnvelope.
+     */
+    public SOAPEnvelope getDefaultEnvelope() throws SOAPProcessingException;
+
+    public SOAPEnvelope getDefaultFaultEnvelope() throws SOAPProcessingException;
+    
+}

Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPFault.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPFault.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPFault.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPFault.java Wed Feb  1 02:33:37 2006
@@ -0,0 +1,107 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.commons.soap;
+
+import org.apache.ws.commons.om.OMElement;
+import org.apache.ws.commons.om.OMException;
+
+
+/**
+ * An element in the <CODE>SOAPBody</CODE> object that contains
+ * error and/or status information. This information may relate to
+ * errors in the <CODE>OMMessage</CODE> object or to problems
+ * that are not related to the content in the message itself.
+ * Problems not related to the message itself are generally errors
+ * in processing, such as the inability to communicate with an
+ * upstream server.
+ * <P>
+ * The <CODE>SOAPFault</CODE> interface provides methods for
+ * retrieving the information contained in a <CODE>
+ * SOAPFault</CODE> object and for setting the fault code, the
+ * fault actor, and a string describing the fault. B fault code is
+ * one of the codes defined in the SOAP 1.1 specification that
+ * describe the fault. An actor is an intermediate recipient to
+ * whom a message was routed. The message path may include one or
+ * more actors, or, if no actors are specified, the message goes
+ * only to the default actor, which is the final intended
+ * recipient.
+ */
+public interface SOAPFault extends OMElement {
+
+    /**
+     * SOAPFaultCode is a mandatory item in a Fault, in SOAP 1.2 specification
+     *
+     * @param soapFaultCode
+     */
+    public void setCode(SOAPFaultCode soapFaultCode) throws SOAPProcessingException;
+
+    public SOAPFaultCode getCode();
+
+    /**
+     * SOAPFaultReason is a mandatory item in a Fault, in SOAP 1.2 specification
+     *
+     * @param reason
+     */
+    public void setReason(SOAPFaultReason reason) throws SOAPProcessingException;
+
+    public SOAPFaultReason getReason();
+
+    /**
+     * SOAPFaultNode is an optional item in a Fault, in SOAP 1.2 specification
+     *
+     * @param node
+     */
+    public void setNode(SOAPFaultNode node) throws SOAPProcessingException;
+
+    public SOAPFaultNode getNode();
+
+    /**
+     * SOAPFaultRoleImpl is an optional item in a Fault, in SOAP 1.2 specification
+     *
+     * @param role
+     */
+    public void setRole(SOAPFaultRole role) throws SOAPProcessingException;
+
+    public SOAPFaultRole getRole();
+
+    /**
+     * SOAPFaultRoleImpl is an optional item in a Fault, in SOAP 1.2 specification
+     *
+     * @param detail
+     */
+    public void setDetail(SOAPFaultDetail detail) throws SOAPProcessingException;
+
+    public SOAPFaultDetail getDetail();
+
+    /**
+     * Returns Exception if there is one in the SOAP fault.
+     * <p/>
+     * If the exception is like;
+     * <SOAPFault>
+     * <Detail>
+     * <Exception> stack trace goes here </Exception>
+     * </Detail>
+     * </SOAPFault>
+     *
+     * @return Returns Exception.
+     * @throws org.apache.ws.commons.om.OMException
+     *
+     */
+    public Exception getException() throws OMException;
+
+    public void setException(Exception e) throws OMException;
+}

Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPFaultCode.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPFaultCode.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPFaultCode.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPFaultCode.java Wed Feb  1 02:33:37 2006
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.commons.soap;
+
+import org.apache.ws.commons.om.OMElement;
+
+public interface SOAPFaultCode extends OMElement {
+    /**
+     * Eran Chinthaka (chinthaka@apache.org)
+     */
+
+    /**
+     * @param value
+     */
+    public void setValue(SOAPFaultValue value) throws SOAPProcessingException;
+
+    /**
+     * @return Returns SOAPFaultValue.
+     */
+    public SOAPFaultValue getValue();
+
+    /**
+     * @param value
+     */
+    public void setSubCode(SOAPFaultSubCode value) throws SOAPProcessingException;
+
+    /**
+     * @return Returns SOAPFaultSubCode.
+     */
+    public SOAPFaultSubCode getSubCode();
+
+}

Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPFaultDetail.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPFaultDetail.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPFaultDetail.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPFaultDetail.java Wed Feb  1 02:33:37 2006
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.commons.soap;
+
+import org.apache.ws.commons.om.OMElement;
+
+import java.util.Iterator;
+
+
+/**
+ * The Detail element information item is intended for carrying application
+ * specific error information related to the SOAP Body .
+ * <p/>
+ * The Detail element information item has:
+ * A [local name] of Detail .
+ * A [namespace name] of http://www.w3.org/2003/05/soap-envelope .
+ * Zero or more attribute information items in its [attributes] property.
+ * Zero or more child element information items in its [children] property.
+ */
+public interface SOAPFaultDetail extends OMElement {
+    /**
+     * Eran Chinthaka (chinthaka@apache.org)
+     */
+    public void addDetailEntry(OMElement detailElement);
+
+    public Iterator getAllDetailEntries();
+
+}

Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPFaultNode.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPFaultNode.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPFaultNode.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPFaultNode.java Wed Feb  1 02:33:37 2006
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.commons.soap;
+
+import org.apache.ws.commons.om.OMElement;
+
+public interface SOAPFaultNode extends OMElement {
+    /**
+     * Eran Chinthaka (chinthaka@apache.org)
+     */
+
+    /**
+     * each SOAP node is identified by a URI. The value of the Node element
+     * information item is the URI that identifies the SOAP node that generated
+     * the fault. SOAP nodes that do not act as the ultimate SOAP receiver MUST
+     * include this element information item. An ultimate SOAP receiver MAY
+     * include this element information item to indicate explicitly that it
+     * generated the fault.
+     *
+     * @param uri
+     */
+    public void setNodeValue(String uri);
+
+    public String getNodeValue();
+}

Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPFaultReason.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPFaultReason.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPFaultReason.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPFaultReason.java Wed Feb  1 02:33:37 2006
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.commons.soap;
+
+import org.apache.ws.commons.om.OMElement;
+
+public interface SOAPFaultReason extends OMElement {
+    /**
+     * Eran Chinthaka (chinthaka@apache.org)
+     */
+
+    public void setSOAPText(SOAPFaultText soapFaultText) throws SOAPProcessingException;
+
+    public SOAPFaultText getSOAPText();
+}

Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPFaultRole.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPFaultRole.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPFaultRole.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPFaultRole.java Wed Feb  1 02:33:37 2006
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.commons.soap;
+
+import org.apache.ws.commons.om.OMElement;
+
+
+/**
+ * The Role element information item identifies the role the node was operating
+ * in at the point the fault occurred.
+ * <p/>
+ * The Role element information item has:
+ * A [local name] of Role .
+ * A [namespace name] of http://www.w3.org/2003/05/soap-envelope .
+ */
+public interface SOAPFaultRole extends OMElement {
+    /**
+     * Eran Chinthaka (chinthaka@apache.org)
+     */
+    
+    /**
+     * The value of the Role element information item MUST be one of the roles
+     * assumed by the node during processing of the message
+     *
+     * @param uri
+     */
+    public void setRoleValue(String uri);
+
+    public String getRoleValue();
+}

Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPFaultSubCode.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPFaultSubCode.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPFaultSubCode.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPFaultSubCode.java Wed Feb  1 02:33:37 2006
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.commons.soap;
+
+import org.apache.ws.commons.om.OMElement;
+
+public interface SOAPFaultSubCode extends OMElement {
+    /**
+     * Eran Chinthaka (chinthaka@apache.org)
+     */
+
+    /**
+     * Fault SubCode contain only one mandatory Value child. This value child contains a QName
+     *
+     * @param soapFaultSubCodeValue
+     */
+    public void setValue(SOAPFaultValue soapFaultSubCodeValue) throws SOAPProcessingException;
+
+    public SOAPFaultValue getValue();
+
+
+    /**
+     * Fault SubCode can contain an optional SubCode
+     *
+     * @param subCode
+     */
+    public void setSubCode(SOAPFaultSubCode subCode) throws SOAPProcessingException;
+
+    public SOAPFaultSubCode getSubCode();
+}

Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPFaultText.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPFaultText.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPFaultText.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPFaultText.java Wed Feb  1 02:33:37 2006
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.commons.soap;
+
+import org.apache.ws.commons.om.OMElement;
+
+public interface SOAPFaultText extends OMElement {
+    /**
+     * Eran Chinthaka (chinthaka@apache.org)
+     */
+
+    /**
+     * lang is a mandatory attribute within the SOAPFaultText which must have
+     * SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_URI as the namespace URI and
+     * SOAP12constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_PREFIX or a capitalization thereof as the prefix
+     *
+     * @param lang
+     */
+    public void setLang(String lang);
+
+    public String getLang();
+
+
+}

Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPFaultValue.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPFaultValue.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPFaultValue.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPFaultValue.java Wed Feb  1 02:33:37 2006
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.commons.soap;
+
+import org.apache.ws.commons.om.OMElement;
+
+public interface SOAPFaultValue extends OMElement {
+    /**
+     * Eran Chinthaka (chinthaka@apache.org)
+     */
+}

Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPHeader.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPHeader.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPHeader.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPHeader.java Wed Feb  1 02:33:37 2006
@@ -0,0 +1,128 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.commons.soap;
+
+import org.apache.ws.commons.om.OMElement;
+import org.apache.ws.commons.om.OMException;
+import org.apache.ws.commons.om.OMNamespace;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+/**
+ * Interface SOAPHeader
+ */
+public interface SOAPHeader extends OMElement {
+    /**
+     * Creates a new <CODE>SOAPHeaderBlock</CODE> object initialized with the
+     * specified name and adds it to this <CODE>SOAPHeader</CODE> object.
+     *
+     * @param localName
+     * @param ns
+     * @return the new <CODE>SOAPHeaderBlock</CODE> object that was inserted
+     *         into this <CODE>SOAPHeader</CODE> object
+     * @throws org.apache.ws.commons.om.OMException
+     *             if a SOAP error occurs
+     */
+    public abstract SOAPHeaderBlock addHeaderBlock(String localName,
+            OMNamespace ns) throws OMException;
+
+    /**
+     * Returns a list of all the <CODE>SOAPHeaderBlock</CODE> objects in this
+     * <CODE>SOAPHeader</CODE> object that have the the specified role. An
+     * role is a global attribute that indicates the intermediate parties to
+     * whom the message should be sent. An role receives the message and then
+     * sends it to the next role. The default role is the ultimate intended
+     * recipient for the message, so if no role attribute is included in a
+     * <CODE>SOAPHeader</CODE> object, the message is sent to its ultimate
+     * destination.
+     *
+     * @param role
+     *            a <CODE>String</CODE> giving the URI of the role for which
+     *            to search
+     * @return Returns an <CODE>Iterator</CODE> object over all the <CODE>
+     *         SOAPHeaderBlock</CODE> objects that contain the specified role
+     * @see #extractHeaderBlocks(java.lang.String)
+     *      extractHeaderBlocks(java.lang.String)
+     */
+    public abstract Iterator examineHeaderBlocks(String role);
+
+    /**
+     * Returns a list of all the <CODE>SOAPHeaderBlock</CODE> objects in this
+     * <CODE>SOAPHeader</CODE> object that have the the specified role and
+     * detaches them from this <CODE>SOAPHeader</CODE> object.
+     * <P>
+     * This method allows an role to process only the parts of the <CODE>
+     * SOAPHeader</CODE> object that apply to it and to remove them before
+     * passing the message on to the next role.
+     *
+     * @param role
+     *            a <CODE>String</CODE> giving the URI of the role for which
+     *            to search
+     * @return Returns an <CODE>Iterator</CODE> object over all the <CODE>
+     *         SOAPHeaderBlock</CODE> objects that contain the specified role
+     * @see #examineHeaderBlocks(java.lang.String)
+     *      examineHeaderBlocks(java.lang.String)
+     */
+    public abstract Iterator extractHeaderBlocks(String role);
+
+    /**
+     * Returns an <code>Iterator</code> over all the
+     * <code>SOAPHeaderBlock</code> objects in this <code>SOAPHeader</code>
+     * object that have the specified role and that have a MustUnderstand
+     * attribute whose value is equivalent to <code>true</code>.
+     *
+     * @param role
+     *            a <code>String</code> giving the URI of the role for which
+     *            to search
+     * @return Returns an <code>Iterator</code> object over all the
+     *         <code>SOAPHeaderBlock</code> objects that contain the specified
+     *         role and are marked as MustUnderstand.
+     */
+    public abstract Iterator examineMustUnderstandHeaderBlocks(String role);
+
+    /**
+     * Returns an <code>Iterator</code> over all the
+     * <code>SOAPHeaderBlock</code> objects in this <code>SOAPHeader</code>
+     * object.
+     *
+     * @return an <code>Iterator</code> object over all the
+     *         <code>SOAPHeaderBlock</code> objects contained by this
+     *         <code>SOAPHeader</code>. If there are no header blocks then an
+     *         empty iterator is returned.
+     */
+    public abstract Iterator examineAllHeaderBlocks();
+
+    /**
+     * Returns an <code>Iterator</code> over all the
+     * <code>SOAPHeaderBlock</code> objects in this <code>SOAPHeader </code>
+     * object and detaches them from this <code>SOAPHeader</code> object.
+     *
+     * @return Returns an <code>Iterator</code> object over all the
+     *         <code>SOAPHeaderBlock</code> objects contained by this
+     *         <code>SOAPHeader</code>
+     */
+    public abstract Iterator extractAllHeaderBlocks();
+
+    /**
+     * Return all the Headers that has the Namespace URI to given NS URI.
+     *
+     * @param nsURI
+     * @return Returns ArrayList.
+     */
+    public ArrayList getHeaderBlocksWithNSURI(String nsURI);
+}

Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPHeaderBlock.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPHeaderBlock.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPHeaderBlock.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPHeaderBlock.java Wed Feb  1 02:33:37 2006
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.commons.soap;
+
+import org.apache.ws.commons.om.OMElement;
+
+/**
+ * <P>An object representing the contents in the SOAP header part of the SOAP
+ * envelope. The immediate children of a <CODE> SOAPHeader</CODE> object can be
+ * represented only as <CODE> SOAPHeaderBlock</CODE> objects.</P> <P>B
+ * <CODE>SOAPHeaderBlock</CODE> object can have other <CODE>OMElement</CODE>
+ * objects as its children.</P>
+ */
+public interface SOAPHeaderBlock extends OMElement {
+    /**
+     * Sets the actor associated with this <CODE> SOAPHeaderBlock</CODE> object
+     * to the specified actor.
+     *
+     * @param roleURI a <CODE>String</CODE> giving the URI of the actor to set
+     * @throws java.lang.IllegalArgumentException
+     *          if there is a problem in setting the actor.
+     * @see #getRole() getRole()
+     */
+    public abstract void setRole(String roleURI);
+
+    /**
+     * Returns the uri of the actor associated with this <CODE>
+     * SOAPHeaderBlock</CODE> object.
+     *
+     * @return a <CODE>String</CODE> giving the URI of the actor
+     * @see #setRole(java.lang.String) setRole(java.lang.String)
+     */
+    public abstract String getRole();
+
+    /**
+     * Sets the mustUnderstand attribute for this <CODE> SOAPHeaderBlock</CODE>
+     * object to be on or off. <P>If the mustUnderstand attribute is on, the
+     * actor who receives the <CODE>SOAPHeaderBlock</CODE> must process it
+     * correctly. This ensures, for example, that if the <CODE>
+     * SOAPHeaderBlock</CODE> object modifies the message, that the message is
+     * being modified correctly.</P>
+     *
+     * @param mustUnderstand <CODE>true</CODE> to set the mustUnderstand
+     *                       attribute on; <CODE>false</CODE> to turn if off
+     * @throws java.lang.IllegalArgumentException
+     *          if there is a problem in setting the actor.
+     * @see #getMustUnderstand() getMustUnderstand()
+     */
+    public abstract void setMustUnderstand(boolean mustUnderstand);
+
+    public abstract void setMustUnderstand(String mustUnderstand) throws SOAPProcessingException;
+
+    /**
+     * Returns whether the mustUnderstand attribute for this
+     * <CODE>SOAPHeaderBlock</CODE> object is turned on.
+     *
+     * @return <CODE>true</CODE> if the mustUnderstand attribute of this
+     *         <CODE>SOAPHeaderBlock</CODE> object is turned on;
+     *         <CODE>false</CODE> otherwise
+     */
+    public abstract boolean getMustUnderstand() throws SOAPProcessingException;
+
+
+    public abstract boolean isProcessed();
+
+    /**
+     * We need to know whether all the mustUnderstand headers have been
+     * processed by the node. This will done by a specific validation handler at
+     * the end of the execution chain. For this all the handlers who process a
+     * particular header block must explicitly say that he processesd the header
+     * by calling setProcessed()
+     */
+    public abstract void setProcessed();
+
+}

Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPMessage.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPMessage.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPMessage.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPMessage.java Wed Feb  1 02:33:37 2006
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.commons.soap;
+
+import org.apache.ws.commons.om.OMDocument;
+
+public interface SOAPMessage extends OMDocument {
+
+    public SOAPEnvelope getSOAPEnvelope() throws SOAPProcessingException;
+    public void setSOAPEnvelope(SOAPEnvelope envelope) throws SOAPProcessingException;
+
+}

Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPProcessingException.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPProcessingException.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPProcessingException.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/SOAPProcessingException.java Wed Feb  1 02:33:37 2006
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.commons.soap;
+
+import org.apache.ws.commons.om.OMException;
+
+public class SOAPProcessingException extends OMException {
+
+    private String soapFaultCode;
+
+    /**
+     * Eran Chinthaka (chinthaka@apache.org)
+     */
+    public SOAPProcessingException(String message) {
+        super(message);
+    }
+
+    public SOAPProcessingException(Throwable cause) {
+        super(cause);
+    }
+
+    /**
+     *
+     * @param messageText - this will appear as the Text in the Reason information item of SOAP Fault
+     * @param faultCode - this will appear as the Value in the Code information item of SOAP Fault
+     * @param cause - this will appear under the Detail information item of SOAP Fault
+     */
+    public SOAPProcessingException(String messageText, String faultCode, Throwable cause) {
+        super(messageText, cause);
+        this.soapFaultCode = faultCode;
+    }
+
+    /**
+     *
+     * @param messageText - this will appear as the Text in the Reason information item of SOAP Fault
+     * @param faultCode - this will appear as the Value in the Code information item of SOAP Fault
+     */
+    public SOAPProcessingException(String messageText, String faultCode) {
+        super(messageText);
+        this.soapFaultCode = faultCode;
+    }
+
+    public String getFaultCode() {
+        return soapFaultCode;
+    }
+
+    public void setFaultCode(String soapFaultCode) {
+        this.soapFaultCode = soapFaultCode;
+    }
+}