You are viewing a plain text version of this content. The canonical link for it is here.
Posted to woden-dev@ws.apache.org by jk...@apache.org on 2006/10/20 18:32:52 UTC

svn commit: r466188 [1/4] - in /incubator/woden/trunk/java: src/org/apache/woden/ src/org/apache/woden/internal/ src/org/apache/woden/internal/util/ src/org/apache/woden/internal/util/dom/ src/org/apache/woden/internal/util/om/ src/org/apache/woden/int...

Author: jkaputin
Date: Fri Oct 20 09:32:50 2006
New Revision: 466188

URL: http://svn.apache.org/viewvc?view=rev&rev=466188
Log:
Manually merged the WODEN-44 branch back into Trunk.

Added:
    incubator/woden/trunk/java/src/org/apache/woden/XMLElement.java
    incubator/woden/trunk/java/src/org/apache/woden/internal/BaseXMLElement.java
    incubator/woden/trunk/java/src/org/apache/woden/internal/DOMXMLElement.java
    incubator/woden/trunk/java/src/org/apache/woden/internal/OMXMLElement.java
    incubator/woden/trunk/java/src/org/apache/woden/internal/util/QNameUtils.java
    incubator/woden/trunk/java/src/org/apache/woden/internal/util/dom/DOMQNameUtils.java
    incubator/woden/trunk/java/src/org/apache/woden/internal/util/om/OMQNameUtils.java
    incubator/woden/trunk/java/test/org/apache/woden/DOMXMLElementTest.java
    incubator/woden/trunk/java/test/org/apache/woden/OMXMLElementTest.java
Removed:
    incubator/woden/trunk/java/src/org/apache/woden/internal/util/dom/QNameUtils.java
    incubator/woden/trunk/java/src/org/apache/woden/internal/util/om/QNameUtils.java
Modified:
    incubator/woden/trunk/java/src/org/apache/woden/WSDLReader.java
    incubator/woden/trunk/java/src/org/apache/woden/internal/BaseWSDLReader.java
    incubator/woden/trunk/java/src/org/apache/woden/internal/DOMWSDLReader.java
    incubator/woden/trunk/java/src/org/apache/woden/internal/Messages.properties
    incubator/woden/trunk/java/src/org/apache/woden/internal/OMWSDLReader.java
    incubator/woden/trunk/java/src/org/apache/woden/internal/util/dom/DOMUtils.java
    incubator/woden/trunk/java/src/org/apache/woden/internal/util/om/OMUtils.java
    incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/extensions/http/HTTPHeaderDeserializer.java
    incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/extensions/soap/SOAPHeaderBlockDeserializer.java
    incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/extensions/soap/SOAPModuleDeserializer.java
    incubator/woden/trunk/java/src/org/apache/woden/internal/xml/ArgumentArrayAttrImpl.java
    incubator/woden/trunk/java/src/org/apache/woden/internal/xml/BooleanAttrImpl.java
    incubator/woden/trunk/java/src/org/apache/woden/internal/xml/HTTPAuthenicationSchemeAttrImpl.java
    incubator/woden/trunk/java/src/org/apache/woden/internal/xml/IntOrTokenAnyAttrImpl.java
    incubator/woden/trunk/java/src/org/apache/woden/internal/xml/QNameAttrImpl.java
    incubator/woden/trunk/java/src/org/apache/woden/internal/xml/QNameListAttrImpl.java
    incubator/woden/trunk/java/src/org/apache/woden/internal/xml/QNameListOrTokenAnyAttrImpl.java
    incubator/woden/trunk/java/src/org/apache/woden/internal/xml/QNameOrTokenAnyAttrImpl.java
    incubator/woden/trunk/java/src/org/apache/woden/internal/xml/StringAttrImpl.java
    incubator/woden/trunk/java/src/org/apache/woden/internal/xml/TokenAttrImpl.java
    incubator/woden/trunk/java/src/org/apache/woden/internal/xml/URIAttrImpl.java
    incubator/woden/trunk/java/src/org/apache/woden/internal/xml/XMLAttrImpl.java
    incubator/woden/trunk/java/src/org/apache/woden/wsdl20/extensions/ExtensionDeserializer.java
    incubator/woden/trunk/java/src/org/apache/woden/wsdl20/extensions/UnknownExtensionDeserializer.java
    incubator/woden/trunk/java/src/org/apache/woden/wsdl20/extensions/UnknownExtensionElement.java
    incubator/woden/trunk/java/src/org/apache/woden/xml/UnknownAttr.java
    incubator/woden/trunk/java/src/org/apache/woden/xml/XMLAttr.java
    incubator/woden/trunk/java/test/org/apache/woden/resolver/OMSimpleURIResolverTest.java
    incubator/woden/trunk/java/test/org/apache/woden/resolver/SimpleURIResolverTest.java
    incubator/woden/trunk/java/test/org/apache/woden/tests/AllWodenTestsDOM.java
    incubator/woden/trunk/java/test/org/apache/woden/tests/OMW3CTestSuiteTest.java
    incubator/woden/trunk/java/test/org/apache/woden/xml/IntOrTokenAttrTest.java
    incubator/woden/trunk/java/test/org/apache/woden/xml/TokenAttrTest.java

Modified: incubator/woden/trunk/java/src/org/apache/woden/WSDLReader.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/WSDLReader.java?view=diff&rev=466188&r1=466187&r2=466188
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/WSDLReader.java (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/WSDLReader.java Fri Oct 20 09:32:50 2006
@@ -177,6 +177,8 @@
    
     //TODO - a readWSDL method that returns a Description (eg a component)
     
+    //TODO - decide if an API method createXMLElement() is needed.
+    
     /**
      * Returns a concrete implementation of WSDLSource that is compatible with
      * the WSDLReader implementation. That is, it will accept objects representing
@@ -266,7 +268,7 @@
      * @throws IllegalArgumentException if the property name is not recognized.
      */
     public Object getProperty(String name);
-    
+
     /**
      * Sets the URI resolver to be used.
      * 

Added: incubator/woden/trunk/java/src/org/apache/woden/XMLElement.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/XMLElement.java?view=auto&rev=466188
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/XMLElement.java (added)
+++ incubator/woden/trunk/java/src/org/apache/woden/XMLElement.java Fri Oct 20 09:32:50 2006
@@ -0,0 +1,132 @@
+/**
+ * Copyright 2006 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.woden;
+
+import java.net.URI;
+
+import javax.xml.namespace.QName;
+
+/**
+ * This interface represents an XML element information item in a format to 
+ * be interpreted by the Woden implementation. 
+ * It permits different representations of an element to be used as method
+ * arguments or return values without making the Woden API dependent on 
+ * any particular XML parser or XML object model.
+ * 
+ * @author John Kaputin (jkaputin@apache.org)
+ */
+public interface XMLElement {
+
+    /**
+     * Accepts an Object representing an XML element. The implementation should 
+     * check that it is of a type appropriate for the underlying XML parser or
+     * XML Object model being used. For example, a DOM implementation might expect
+     * an org.w3c.dom.Element while an AXIOM implementation might expect 
+     * org.apache.axiom.om.OMElement.
+     * 
+     * @param elem the Object representing the XML element
+     * 
+     * @throws IllegalArgumentException if elem is not a type supported by the implementation.
+     */
+    public void setSource(Object elem);
+
+    /**
+     * Returns an Object representing an XML element, which the caller must
+     * cast to the expected type. For example, for DOM implementation we might
+     * cast it to an org.w3c.dom.Element whereas an AXIOM implementation might 
+     * cast it to an org.apache.axiom.om.OMElement.
+     * 
+     * @return an Object representing the XML element 
+     */
+    public Object getSource();
+
+
+    /* **********************************************************************
+     * Methods for Accessing the contents of the element
+     * **********************************************************************/
+
+    /* TODO This method is not yet needed but can be added if it's required.
+     * It will require the creation of XMLAttribute with the methods getLocalName,
+     * getNamespaceURI, getPrefix and getValue. Then, the parseExtensionAttributes
+     * method can be refactored into BaseWSDLReader. Will also need to consider
+     * overlap/synergy with the XMLAttr classes used for extension attributes.
+     * 
+     * @return a list of attributes associated with the XML element
+     *
+    public XMLAttribute[] getAttributes();
+    */
+
+    /**
+     * Returns the value of the specified attribute or null if it is not found.
+     *
+     * @param attrName name of attribute to look for
+     * @return the attribute value including prefix if present
+     */
+    public String getAttributeValue(String attrName);
+
+    /**
+     *
+     * @return the namespace URI of the element
+     */
+    public URI getNamespaceURI() throws WSDLException;
+
+    /**
+     *
+     * @return the local name of the element
+     */
+    public String getLocalName();
+
+    /**
+     * Return the qualified name of this element.
+     * 
+     * @return QName this element's qualified name.
+     */
+    public QName getQName();
+    /**
+     * Return the qualified name from the specified prefixed value.
+     *
+     * @param prefixedValue of the form [namespace prefix]:[local name]
+     * @return the QName corresponding to the prefix
+     * @throws WSDLException
+     */
+    public QName getQName(String prefixedValue) throws WSDLException;
+
+    /**
+     * Return the first child element of this element or null if no
+     * children are found.
+     *
+     * @return the first child element.
+     */
+    public XMLElement getFirstChildElement();
+
+    /**
+     * Return the next sibling element of this element or null if no
+     * siblings are found.
+     *
+     * @return the next sibling element.
+     */
+    public XMLElement getNextSiblingElement();
+
+    /**
+     * Return an array of the child elements of this element or
+     * an empty array if no siblings are found.
+     *
+     * @return an XMLElement array containing the child elements.
+     */
+    public XMLElement[] getChildElements();
+
+
+}

Modified: incubator/woden/trunk/java/src/org/apache/woden/internal/BaseWSDLReader.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/BaseWSDLReader.java?view=diff&rev=466188&r1=466187&r2=466188
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/internal/BaseWSDLReader.java (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/internal/BaseWSDLReader.java Fri Oct 20 09:32:50 2006
@@ -17,15 +17,54 @@
 
 import java.io.IOException;
 import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
 
 import org.apache.woden.ErrorReporter;
 import org.apache.woden.WSDLException;
 import org.apache.woden.WSDLFactory;
 import org.apache.woden.WSDLReader;
+import org.apache.woden.XMLElement;
 import org.apache.woden.internal.resolver.SimpleURIResolver;
+import org.apache.woden.internal.schema.SchemaConstants;
 import org.apache.woden.internal.util.PropertyUtils;
+import org.apache.woden.internal.util.StringUtils;
+import org.apache.woden.internal.wsdl20.Constants;
 import org.apache.woden.resolver.URIResolver;
+import org.apache.woden.schema.Schema;
+import org.apache.woden.types.NCName;
+import org.apache.woden.wsdl20.enumeration.Direction;
+import org.apache.woden.wsdl20.enumeration.MessageLabel;
+import org.apache.woden.wsdl20.extensions.ExtensionDeserializer;
+import org.apache.woden.wsdl20.extensions.ExtensionElement;
 import org.apache.woden.wsdl20.extensions.ExtensionRegistry;
+import org.apache.woden.wsdl20.xml.BindingElement;
+import org.apache.woden.wsdl20.xml.BindingFaultElement;
+import org.apache.woden.wsdl20.xml.BindingFaultReferenceElement;
+import org.apache.woden.wsdl20.xml.BindingMessageReferenceElement;
+import org.apache.woden.wsdl20.xml.BindingOperationElement;
+import org.apache.woden.wsdl20.xml.ConfigurableElement;
+import org.apache.woden.wsdl20.xml.DescriptionElement;
+import org.apache.woden.wsdl20.xml.DocumentableElement;
+import org.apache.woden.wsdl20.xml.DocumentationElement;
+import org.apache.woden.wsdl20.xml.EndpointElement;
+import org.apache.woden.wsdl20.xml.FeatureElement;
+import org.apache.woden.wsdl20.xml.ImportElement;
+import org.apache.woden.wsdl20.xml.IncludeElement;
+import org.apache.woden.wsdl20.xml.InterfaceElement;
+import org.apache.woden.wsdl20.xml.InterfaceFaultElement;
+import org.apache.woden.wsdl20.xml.InterfaceFaultReferenceElement;
+import org.apache.woden.wsdl20.xml.InterfaceMessageReferenceElement;
+import org.apache.woden.wsdl20.xml.InterfaceOperationElement;
+import org.apache.woden.wsdl20.xml.PropertyElement;
+import org.apache.woden.wsdl20.xml.ServiceElement;
+import org.apache.woden.wsdl20.xml.TypesElement;
+import org.apache.woden.wsdl20.xml.WSDLElement;
 
 
 /**
@@ -50,7 +89,6 @@
     private ExtensionRegistry fExtReg;
     private URIResolver fResolver = null;
     
-    
     protected ReaderFeatures features;
 
     protected BaseWSDLReader() throws WSDLException {
@@ -101,6 +139,10 @@
         }
     }
     
+    /* ************************************************************
+     *  API public methods
+     * ************************************************************/
+    
     /**
      * @return Returns the fErrorReporter.
      */
@@ -294,13 +336,1404 @@
                     fErrorReporter.getFormattedMessage("WSDL008", args));
         }
     }
-    
+
+    /* ************************************************************
+     *  Parsing methods - e.g. parseXXXX()
+     * ************************************************************/
+
+    /* Parse the attributes and child elements of the <description> element.
+     * As per the WSDL 2.0 spec, the child elements must be in the 
+     * following order if present:
+     * <documentation>
+     * <import> <include> or WSDL extension elements in any order
+     * <types>
+     * <interface> <binding> <service> or WSDL extension elements in any order.
+     * TODO validate that the elements are in correct order
+     */ 
+    protected DescriptionElement parseDescription(
+            String documentBaseURI, 
+            XMLElement descEl, 
+            Map wsdlModules) 
+            throws WSDLException {
+
+        if (!Constants.Q_ELEM_DESCRIPTION.equals(descEl.getQName()))
+        {
+            getErrorReporter().reportError(
+                new ErrorLocatorImpl(),  //TODO line&col nos.
+                "WSDL501", 
+                new Object[] {Constants.Q_ELEM_DESCRIPTION, descEl.getQName()},
+                ErrorReporter.SEVERITY_FATAL_ERROR);
+        }
+        
+        DescriptionElement desc = getFactory().newDescription();
+        
+        if(wsdlModules == null) 
+        {
+            //This is the initial WSDL document. No imports or includes yet.
+            //TODO this might be the place to flag the initial Desc if necessary.
+            wsdlModules = new HashMap();
+        }
+        
+        if(getExtensionRegistry() != null) 
+        {
+            desc.setExtensionRegistry(getExtensionRegistry());
+        }
+        
+        if(getErrorReporter() != null) 
+        {
+            (desc.getExtensionRegistry()).setErrorReporter(getErrorReporter());
+        }
+        
+        desc.setDocumentBaseURI(getURI(documentBaseURI));
+
+        String targetNamespace = 
+            descEl.getAttributeValue(Constants.ATTR_TARGET_NAMESPACE);
+        
+        if(targetNamespace != null)
+        {
+            desc.setTargetNamespace(getURI(targetNamespace));
+        }
+        
+        parseNamespaceDeclarations(descEl, desc);
+        
+        parseExtensionAttributes(descEl, DescriptionElement.class, desc, desc);
+        
+        //parse the child elements
+        XMLElement[] children = descEl.getChildElements();
+        XMLElement tempEl = null;
+        QName tempElQN = null;
+
+        for(int i=0; i<children.length; i++)
+        {
+            tempEl = children[i];
+            tempElQN = tempEl.getQName();
+        	
+            if (Constants.Q_ELEM_DOCUMENTATION.equals(tempElQN))
+            {
+                parseDocumentation(tempEl, desc, desc);
+            }
+            else if (Constants.Q_ELEM_IMPORT.equals(tempElQN))
+            {
+                if(documentBaseURI != null && !wsdlModules.containsKey(documentBaseURI)) 
+                {
+                    wsdlModules.put(documentBaseURI, desc);
+                }
+                parseImport(tempEl, desc, wsdlModules);
+            }
+            else if (Constants.Q_ELEM_INCLUDE.equals(tempElQN))
+            {
+                if(documentBaseURI != null && !wsdlModules.containsKey(documentBaseURI)) 
+                {
+                    wsdlModules.put(documentBaseURI, desc);
+                }
+                parseInclude(tempEl, desc, wsdlModules);
+            }
+            else if (Constants.Q_ELEM_TYPES.equals(tempElQN))
+            {
+                parseTypes(tempEl, desc);
+            }
+            else if (Constants.Q_ELEM_INTERFACE.equals(tempElQN))
+            {
+                parseInterface(tempEl, desc);
+            }
+            else if (Constants.Q_ELEM_BINDING.equals(tempElQN))
+            {
+                parseBinding(tempEl, desc);
+            }
+            else if (Constants.Q_ELEM_SERVICE.equals(tempElQN))
+            {
+                parseService(tempEl, desc);
+            }
+            else
+            {
+                desc.addExtensionElement(
+                    parseExtensionElement(DescriptionElement.class, desc, tempEl, desc) );
+            }
+        }
+        
+        parseSchemaForXMLSchema(desc);  //TODO temporary - see comments within the method
+        
+        return desc;
+    }
+
+    protected DocumentationElement parseDocumentation(
+            XMLElement docEl, 
+            DescriptionElement desc, 
+            DocumentableElement parent) 
+            throws WSDLException {
+
+        DocumentationElement documentation = parent.addDocumentationElement();
+
+        //TODO store docEl as below, or just extract any text? 
+        documentation.setContent(docEl.getSource());
+
+        //Now parse any extensibility attributes or elements
+
+        parseExtensionAttributes(docEl, DocumentationElement.class, documentation, desc);
+
+        XMLElement[] children = docEl.getChildElements();
+        XMLElement tempEl = null;
+
+        for(int i=0; i<children.length; i++)
+        {
+            tempEl = children[i];
+            documentation.addExtensionElement(
+                    parseExtensionElement(DocumentationElement.class, documentation, tempEl, desc) );
+        }
+
+        return documentation;
+    }
+
+    private ImportElement parseImport(
+            XMLElement importEl,
+            DescriptionElement desc,
+            Map wsdlModules) 
+            throws WSDLException {
+
+        ImportElement imp = desc.addImportElement();
+
+        String namespaceURI = importEl.getAttributeValue(Constants.ATTR_NAMESPACE);
+        String locationURI = importEl.getAttributeValue(Constants.ATTR_LOCATION);
+
+        parseExtensionAttributes(importEl, ImportElement.class, imp, desc);
+
+        if(namespaceURI != null) 
+        {
+            //TODO handle missing namespace attribute (REQUIRED attr)
+            imp.setNamespace(getURI(namespaceURI));
+        }
+
+        if(locationURI != null)
+        {
+            //TODO handle missing locationURI (OPTIONAL attr)
+            URI resolvedLocationURI = resolveURI(getURI(locationURI));
+            imp.setLocation(resolvedLocationURI);
+            DescriptionElement importedDesc = 
+                getWSDLFromLocation(resolvedLocationURI.toString(), desc, wsdlModules);
+            imp.setDescriptionElement(importedDesc);
+        }
+
+        return imp;
+    }
+
+    private IncludeElement parseInclude(
+            XMLElement includeEl,
+            DescriptionElement desc,
+            Map wsdlModules) 
+            throws WSDLException {
+
+        IncludeElement include = desc.addIncludeElement();
+
+        String locationURI = includeEl.getAttributeValue(Constants.ATTR_LOCATION);
+
+        parseExtensionAttributes(includeEl, IncludeElement.class, include, desc);
+
+        if(locationURI != null)
+        {
+            URI resolvedLocationURI = resolveURI(getURI(locationURI));
+            include.setLocation(resolvedLocationURI);
+            DescriptionElement includedDesc = 
+                getWSDLFromLocation(resolvedLocationURI.toString(), desc, wsdlModules);
+            include.setDescriptionElement(includedDesc);
+        }
+
+        return include;
+    }
+
+    /*
+     * TODO Initial schema parsing is specific to XML Schema. 
+     * Need generic support for other type systems.
+     * Consider extension architecture with serializer/deserializer.
+     */
+    private TypesElement parseTypes(
+            XMLElement typesEl,
+            DescriptionElement desc) 
+            throws WSDLException {
+
+        TypesElement types = desc.getTypesElement();
+
+        //TODO for now set to W3 XML Schema. Later, add support for non-XML Schema type systems
+        types.setTypeSystem(Constants.TYPE_XSD_2001);
+
+        parseExtensionAttributes(typesEl, TypesElement.class, types, desc);
+
+        XMLElement[] children = typesEl.getChildElements();
+        XMLElement tempEl = null;
+        QName tempElQN = null;
+
+        for(int i=0; i<children.length; i++)
+        {
+            tempEl = children[i];
+            tempElQN = tempEl.getQName();
+
+            //TODO validate element order? <documentation> must be first.
+
+            if (Constants.Q_ELEM_DOCUMENTATION.equals(tempElQN))
+            {
+                parseDocumentation(tempEl, desc, types);
+            }
+            else if (SchemaConstants.XSD_IMPORT_QNAME_LIST.contains(tempElQN))
+            {
+                types.addSchema(parseSchemaImport(tempEl, desc));
+            }
+            else if (SchemaConstants.XSD_SCHEMA_QNAME_LIST.contains(tempElQN))
+            {
+                types.addSchema(parseSchemaInline(tempEl, desc));
+            }
+            else
+            {
+                types.addExtensionElement(
+                        parseExtensionElement(TypesElement.class, types, tempEl, desc) );
+            }
+        }
+
+        return types;
+    }
+
+    protected abstract Schema parseSchemaImport(
+            XMLElement importEl,
+            DescriptionElement desc) 
+            throws WSDLException;
+
+    protected abstract Schema parseSchemaInline(
+            XMLElement schemaEl,
+            DescriptionElement desc) 
+            throws WSDLException;
+
+    private InterfaceElement parseInterface(
+            XMLElement interfaceEl,
+            DescriptionElement desc) 
+            throws WSDLException {
+        
+        InterfaceElement intface = desc.addInterfaceElement();
+
+        String name = interfaceEl.getAttributeValue(Constants.ATTR_NAME);
+
+        if(name != null)
+        {
+            intface.setName(new NCName(name));
+        }
+
+        String styleDefault = interfaceEl.getAttributeValue(Constants.ATTR_STYLE_DEFAULT);
+        if(styleDefault != null)
+        {
+            List stringList = StringUtils.parseNMTokens(styleDefault);
+            String uriString = null;
+            Iterator it = stringList.iterator();
+            while(it.hasNext())
+            {
+                uriString = (String)it.next();
+                intface.addStyleDefaultURI(getURI(uriString));
+            }
+        }
+
+        String extendsAtt = interfaceEl.getAttributeValue(Constants.ATTR_EXTENDS);
+        if(extendsAtt != null)
+        {
+            List stringList = StringUtils.parseNMTokens(extendsAtt);
+            String qnString = null;
+            Iterator it = stringList.iterator();
+            while(it.hasNext())
+            {
+                qnString = (String)it.next();
+                intface.addExtendedInterfaceName(interfaceEl.getQName(qnString));
+            }
+        }
+
+        parseExtensionAttributes(interfaceEl, InterfaceElement.class, intface, desc);
+
+        /* Parse the child elements of <interface>. 
+         * As per WSDL 2.0 spec, they must be in the following order if present:
+         * <documentation>
+         * <fault> <operation> <feature> <property> or extension elements in any order
+         * TODO validate that the elements are in correct order
+         */ 
+
+        XMLElement[] children = interfaceEl.getChildElements();
+        XMLElement tempEl = null;
+        QName tempElQN = null;
+
+        for(int i=0; i<children.length; i++)
+        {
+            tempEl = children[i];
+            tempElQN = tempEl.getQName();
+
+            if (Constants.Q_ELEM_DOCUMENTATION.equals(tempElQN))
+            {
+                parseDocumentation(tempEl, desc, intface);
+            }
+            else if (Constants.Q_ELEM_FAULT.equals(tempElQN))
+            {
+                parseInterfaceFault(tempEl, desc, intface);
+            }
+            else if (Constants.Q_ELEM_OPERATION.equals(tempElQN))
+            {
+                parseInterfaceOperation(tempEl, desc, intface);
+            }
+            else if (Constants.Q_ELEM_FEATURE.equals(tempElQN))
+            {
+                parseFeature(tempEl, desc, intface);
+            }
+            else if (Constants.Q_ELEM_PROPERTY.equals(tempElQN))
+            {
+                parseProperty(tempEl, desc, intface);
+            }
+            else
+            {
+                intface.addExtensionElement(
+                        parseExtensionElement(InterfaceElement.class, intface, tempEl, desc) );
+            }
+        }
+
+        return intface;
+    }
+
+    /* Parse the attributes and child elements of interface <fault>. 
+     * As per WSDL 2.0 spec, the child elements must be in the following order if present:
+     * <documentation>
+     * <feature> <property> or extension elements in any order
+     * 
+     * TODO validate that the elements are in correct order
+     */ 
+    private InterfaceFaultElement parseInterfaceFault(
+            XMLElement faultEl,
+            DescriptionElement desc,
+            InterfaceElement parent) 
+            throws WSDLException {
+
+        InterfaceFaultElement fault = parent.addInterfaceFaultElement();
+        fault.setParentElement(parent);
+
+        String name = faultEl.getAttributeValue(Constants.ATTR_NAME);
+        if(name != null)
+        {
+            fault.setName(new NCName(name));
+        }
+
+        String element = faultEl.getAttributeValue(Constants.ATTR_ELEMENT);
+        if(element != null)
+        {
+            try {
+                QName qname = faultEl.getQName(element);
+                fault.setElementName(qname);
+            } catch (WSDLException e) {
+                getErrorReporter().reportError( 
+                        new ErrorLocatorImpl(),  //TODO line&col nos.
+                        "WSDL505",
+                        new Object[] {element, faultEl.getQName()},
+                        ErrorReporter.SEVERITY_ERROR);
+            }
+        }
+
+        parseExtensionAttributes(faultEl, InterfaceFaultElement.class, fault, desc);
+
+        XMLElement[] children = faultEl.getChildElements();
+        XMLElement tempEl = null;
+        QName tempElQN = null;
+
+        for(int i=0; i<children.length; i++)
+        {
+            tempEl = children[i];
+            tempElQN = tempEl.getQName();
+
+            if (Constants.Q_ELEM_DOCUMENTATION.equals(tempElQN))
+            {
+                parseDocumentation(tempEl, desc, fault);
+            }
+            else if (Constants.Q_ELEM_FEATURE.equals(tempElQN))
+            {
+                parseFeature(tempEl, desc, fault);
+            }
+            else if (Constants.Q_ELEM_PROPERTY.equals(tempElQN))
+            {
+                parseProperty(tempEl, desc, fault);
+            }
+            else
+            {
+                fault.addExtensionElement(
+                        parseExtensionElement(InterfaceFaultElement.class, fault, tempEl, desc) );
+            }
+        }
+
+        return fault;
+    }
+
+    private InterfaceOperationElement parseInterfaceOperation(
+            XMLElement operEl, 
+            DescriptionElement desc,
+            InterfaceElement parent) 
+            throws WSDLException {
+
+        InterfaceOperationElement oper = parent.addInterfaceOperationElement();
+        oper.setParentElement(parent);
+
+        String name = operEl.getAttributeValue(Constants.ATTR_NAME);
+        if(name != null)
+        {
+            oper.setName(new NCName(name));
+        }
+
+        String style = operEl.getAttributeValue(Constants.ATTR_STYLE);
+        if(style != null)
+        {
+            List stringList = StringUtils.parseNMTokens(style);
+            String uriString = null;
+            Iterator it = stringList.iterator();
+            while(it.hasNext())
+            {
+                uriString = (String)it.next();
+                oper.addStyleURI(getURI(uriString));
+            }
+        }
+
+        String pat = operEl.getAttributeValue(Constants.ATTR_PATTERN);
+        if(pat != null)
+        {
+            oper.setPattern(getURI(pat));
+        }
+
+        parseExtensionAttributes(operEl, InterfaceOperationElement.class, oper, desc);
+
+        /* Parse the child elements of interface <operation>. 
+         * As per WSDL 2.0 spec, they must be in the following order if present:
+         * <documentation> 
+         * <input> <output> <infault> <outfault> <feature> <property> or extension elements in any order
+         * TODO validate that the elements are in correct order
+         */ 
+
+        XMLElement[] children = operEl.getChildElements();
+        XMLElement tempEl = null;
+        QName tempElQN = null;
+
+        for(int i=0; i<children.length; i++)
+        {
+            tempEl = children[i];
+            tempElQN = tempEl.getQName();
+
+            if (Constants.Q_ELEM_DOCUMENTATION.equals(tempElQN))
+            {
+                parseDocumentation(tempEl, desc, oper);
+            }
+            else if (Constants.Q_ELEM_FEATURE.equals(tempElQN))
+            {
+                parseFeature(tempEl, desc, oper);
+            }
+            else if (Constants.Q_ELEM_PROPERTY.equals(tempElQN))
+            {
+                parseProperty(tempEl, desc, oper);
+            }
+            else if (Constants.Q_ELEM_INPUT.equals(tempElQN))
+            {
+                parseInterfaceMessageReference(tempEl, desc, oper);
+            }
+            else if (Constants.Q_ELEM_OUTPUT.equals(tempElQN))
+            {
+                parseInterfaceMessageReference(tempEl, desc, oper);
+            }
+            else if (Constants.Q_ELEM_INFAULT.equals(tempElQN))
+            {
+                parseInterfaceFaultReference(tempEl, desc, oper);
+            }
+            else if (Constants.Q_ELEM_OUTFAULT.equals(tempElQN))
+            {
+                parseInterfaceFaultReference(tempEl, desc, oper);
+            }
+            else
+            {
+                oper.addExtensionElement(
+                        parseExtensionElement(InterfaceOperationElement.class, oper, tempEl, desc) );
+            }
+        }
+
+        return oper;
+    }
+
+    private InterfaceFaultReferenceElement parseInterfaceFaultReference(
+            XMLElement faultRefEl,
+            DescriptionElement desc,
+            InterfaceOperationElement parent)
+            throws WSDLException {
+
+        InterfaceFaultReferenceElement faultRef = parent.addInterfaceFaultReferenceElement();
+        faultRef.setParentElement(parent);
+
+        if(Constants.ELEM_INFAULT.equals(faultRefEl.getLocalName())) {
+            faultRef.setDirection(Direction.IN);
+        } 
+        else if(Constants.ELEM_OUTFAULT.equals(faultRefEl.getLocalName())){
+            faultRef.setDirection(Direction.OUT);
+        }
+
+        String ref = faultRefEl.getAttributeValue(Constants.ATTR_REF);
+        if(ref != null)
+        {
+            try {
+                QName qname = faultRefEl.getQName(ref);
+                faultRef.setRef(qname);
+            } catch (WSDLException e) {
+                getErrorReporter().reportError( 
+                        new ErrorLocatorImpl(),  //TODO line&col nos.
+                        "WSDL505",
+                        new Object[] {ref, faultRefEl.getQName()},
+                        ErrorReporter.SEVERITY_ERROR);
+            }
+        }
+
+        String msgLabel = faultRefEl.getAttributeValue(Constants.ATTR_MESSAGE_LABEL);
+        if(msgLabel != null)
+        {
+            faultRef.setMessageLabel(new NCName(msgLabel));
+        }
+
+        parseExtensionAttributes(faultRefEl, InterfaceFaultReferenceElement.class, faultRef, desc);
+
+        XMLElement[] children = faultRefEl.getChildElements();
+        XMLElement tempEl = null;
+        QName tempElQN = null;
+
+        for(int i=0; i<children.length; i++)
+        {
+            tempEl = children[i];
+            tempElQN = tempEl.getQName();
+
+            if (Constants.Q_ELEM_DOCUMENTATION.equals(tempElQN))
+            {
+                parseDocumentation(tempEl, desc, faultRef);
+            }
+            else if (Constants.Q_ELEM_FEATURE.equals(tempElQN))
+            {
+                parseFeature(tempEl, desc, faultRef);
+            }
+            else if (Constants.Q_ELEM_PROPERTY.equals(tempElQN))
+            {
+                parseProperty(tempEl, desc, faultRef);
+            }
+            else
+            {
+                faultRef.addExtensionElement(
+                        parseExtensionElement(InterfaceFaultReferenceElement.class, faultRef, tempEl, desc) );
+            }
+        }
+
+        return faultRef;
+    }
+
+    private InterfaceMessageReferenceElement parseInterfaceMessageReference(
+            XMLElement msgRefEl,
+            DescriptionElement desc,
+            InterfaceOperationElement parent)
+            throws WSDLException {
+
+        InterfaceMessageReferenceElement message = parent.addInterfaceMessageReferenceElement();
+        message.setParentElement(parent);
+
+        if(Constants.ELEM_INPUT.equals(msgRefEl.getLocalName())) {
+            message.setDirection(Direction.IN);
+        } 
+        else if(Constants.ELEM_OUTPUT.equals(msgRefEl.getLocalName())) {
+            message.setDirection(Direction.OUT);
+        }
+
+        String msgLabel = msgRefEl.getAttributeValue(Constants.ATTR_MESSAGE_LABEL);
+        if(msgLabel != null) 
+        {
+            message.setMessageLabel(new NCName(msgLabel));
+        }
+        else
+        {
+            //TODO this is a temp fix, correct action to use MEP to determine default
+            if(message.getDirection().equals(Direction.IN))
+            {
+                message.setMessageLabel(MessageLabel.IN);
+            }
+            else
+            {
+                message.setMessageLabel(MessageLabel.OUT);
+            }
+        }
+
+        String element = msgRefEl.getAttributeValue(Constants.ATTR_ELEMENT);
+        if(element != null)
+        {
+            if(element.equals(Constants.NMTOKEN_ANY) ||
+                    element.equals(Constants.NMTOKEN_NONE) ||
+                    element.equals(Constants.NMTOKEN_OTHER))
+            {
+                message.setMessageContentModel(element);
+            }
+            else
+            {
+                //element is not #any, #none or #other, so it must be an element qname
+                message.setMessageContentModel(Constants.NMTOKEN_ELEMENT);
+                try {
+                    QName qname = msgRefEl.getQName(element);
+                    message.setElementName(qname);
+                } catch (WSDLException e) {
+                    getErrorReporter().reportError( 
+                            new ErrorLocatorImpl(),  //TODO line&col nos.
+                            "WSDL505",
+                            new Object[] {element, msgRefEl.getQName()},
+                            ErrorReporter.SEVERITY_ERROR);
+                }
+            }
+        }
+        else
+        {
+            //Per mapping defined in WSDL 2.0 Part 2 spec section 2.5.3,
+            //if element attribute not present, message content model is #other
+            message.setMessageContentModel(Constants.NMTOKEN_OTHER);
+        }
+
+        parseExtensionAttributes(msgRefEl, InterfaceMessageReferenceElement.class, message, desc);
+
+        XMLElement[] children = msgRefEl.getChildElements();
+        XMLElement tempEl = null;
+        QName tempElQN = null;
+
+        for(int i=0; i<children.length; i++)
+        {
+            tempEl = children[i];
+            tempElQN = tempEl.getQName();
+
+            if (Constants.Q_ELEM_DOCUMENTATION.equals(tempElQN))
+            {
+                parseDocumentation(tempEl, desc, message);
+            }
+            else if (Constants.Q_ELEM_FEATURE.equals(tempElQN))
+            {
+                parseFeature(tempEl, desc, message);
+            }
+            else if (Constants.Q_ELEM_PROPERTY.equals(tempElQN))
+            {
+                parseProperty(tempEl, desc, message);
+            }
+            else
+            {
+                message.addExtensionElement(
+                        parseExtensionElement(InterfaceMessageReferenceElement.class, message, tempEl, desc) );
+            }
+        }
+
+        return message;
+    }
+
+    private BindingElement parseBinding(
+            XMLElement bindEl,
+            DescriptionElement desc)
+            throws WSDLException {
+
+        BindingElement binding = desc.addBindingElement();
+
+        String name = bindEl.getAttributeValue(Constants.ATTR_NAME);
+        if(name != null)
+        {
+            binding.setName(new NCName(name));
+        }
+
+        QName intfaceQN = null;
+        String intface = bindEl.getAttributeValue(Constants.ATTR_INTERFACE);
+        if(intface != null)
+        {
+            try {
+                intfaceQN = bindEl.getQName(intface);
+                binding.setInterfaceName(intfaceQN);
+            } catch (WSDLException e) {
+                getErrorReporter().reportError( 
+                        new ErrorLocatorImpl(),  //TODO line&col nos.
+                        "WSDL505",
+                        new Object[] {intface, bindEl.getQName()},
+                        ErrorReporter.SEVERITY_ERROR);
+            }
+        }
+
+        String type = bindEl.getAttributeValue(Constants.ATTR_TYPE);
+        if(type != null) {
+            binding.setType(getURI(type));
+        }
+
+        parseExtensionAttributes(bindEl, BindingElement.class, binding, desc);
+
+        /* Parse the child elements of <binding>. 
+         * As per WSDL 2.0 spec, they must be in the following order if present:
+         * <documentation>
+         * <fault> <operation> <feature> <property> or extension elements in any order
+         * TODO validate that the elements are in correct order
+         */ 
+
+        XMLElement[] children = bindEl.getChildElements();
+        XMLElement tempEl = null;
+        QName tempElQN = null;
+
+        for(int i=0; i<children.length; i++)
+        {
+            tempEl = children[i];
+            tempElQN = tempEl.getQName();
+
+            if (Constants.Q_ELEM_DOCUMENTATION.equals(tempElQN))
+            {
+                parseDocumentation(tempEl, desc, binding);
+            }
+            else if (Constants.Q_ELEM_FAULT.equals(tempElQN))
+            {
+                parseBindingFault(tempEl, desc, binding);
+            }
+            else if (Constants.Q_ELEM_OPERATION.equals(tempElQN))
+            {
+                parseBindingOperation(tempEl, desc, binding);
+            }
+            else if (Constants.Q_ELEM_FEATURE.equals(tempElQN))
+            {
+                parseFeature(tempEl, desc, binding);
+            }
+            else if (Constants.Q_ELEM_PROPERTY.equals(tempElQN))
+            {
+                parseProperty(tempEl, desc, binding);
+            }
+            else
+            {
+                binding.addExtensionElement(
+                        parseExtensionElement(BindingElement.class, binding, tempEl, desc) );
+            }
+        }
+
+        return binding;
+    }
+
+    private BindingFaultElement parseBindingFault(XMLElement bindFaultEl,
+            DescriptionElement desc,
+            BindingElement parent)
+            throws WSDLException {
+
+        BindingFaultElement fault = parent.addBindingFaultElement();
+        fault.setParentElement(parent);
+
+        QName intFltQN = null;
+        String ref = bindFaultEl.getAttributeValue(Constants.ATTR_REF);
+        if(ref != null)
+        {
+            try {
+                intFltQN = bindFaultEl.getQName(ref);
+                fault.setRef(intFltQN);
+            } catch (WSDLException e) {
+                getErrorReporter().reportError( 
+                        new ErrorLocatorImpl(),  //TODO line&col nos.
+                        "WSDL505",
+                        new Object[] {ref, bindFaultEl.getQName()},
+                        ErrorReporter.SEVERITY_ERROR);
+            }
+        }
+
+        parseExtensionAttributes(bindFaultEl, BindingFaultElement.class, fault, desc);
+
+        /* Parse the child elements of binding <fault>. 
+         * As per WSDL 2.0 spec, they must be in the following order if present:
+         * <documentation> 
+         * <feature> <property> or extension elements in any order
+         * TODO validate that the elements are in correct order
+         */ 
+
+        XMLElement[] children = bindFaultEl.getChildElements();
+        XMLElement tempEl = null;
+        QName tempElQN = null;
+
+        for(int i=0; i<children.length; i++)
+        {
+            tempEl = children[i];
+            tempElQN = tempEl.getQName();
+
+            if (Constants.Q_ELEM_DOCUMENTATION.equals(tempElQN))
+            {
+                parseDocumentation(tempEl, desc, fault);
+            }
+            else if (Constants.Q_ELEM_FEATURE.equals(tempElQN))
+            {
+                parseFeature(tempEl, desc, fault);
+            }
+            else if (Constants.Q_ELEM_PROPERTY.equals(tempElQN))
+            {
+                parseProperty(tempEl, desc, fault);
+            }
+            else
+            {
+                fault.addExtensionElement(
+                        parseExtensionElement(BindingFaultElement.class, fault, tempEl, desc) );
+            }
+        }
+
+        return fault;
+    }
+
+    private BindingOperationElement parseBindingOperation(
+            XMLElement bindOpEl,
+            DescriptionElement desc,
+            BindingElement parent)
+            throws WSDLException {
+
+        BindingOperationElement oper = parent.addBindingOperationElement();
+        oper.setParentElement(parent);
+
+        QName refQN = null;
+        String ref = bindOpEl.getAttributeValue(Constants.ATTR_REF);
+        if(ref != null)
+        {
+            try {
+                refQN = bindOpEl.getQName(ref);
+                oper.setRef(refQN);
+            } catch (WSDLException e) {
+                getErrorReporter().reportError( 
+                        new ErrorLocatorImpl(),  //TODO line&col nos.
+                        "WSDL505",
+                        new Object[] {ref, bindOpEl.getQName()},
+                        ErrorReporter.SEVERITY_ERROR);
+            }
+        }
+
+        parseExtensionAttributes(bindOpEl, BindingOperationElement.class, oper, desc);
+
+        /* Parse the child elements of binding <operation>. 
+         * As per WSDL 2.0 spec, they must be in the following order if present:
+         * <documentation> 
+         * <input> <output> <infault> <outfault> <feature> <property> or extension elements in any order
+         * TODO validate that the elements are in correct order
+         */ 
+
+        XMLElement[] children = bindOpEl.getChildElements();
+        XMLElement tempEl = null;
+        QName tempElQN = null;
+
+        for(int i=0; i<children.length; i++)
+        {
+            tempEl = children[i];
+            tempElQN = tempEl.getQName();
+
+            if (Constants.Q_ELEM_DOCUMENTATION.equals(tempElQN))
+            {
+                parseDocumentation(tempEl, desc, oper);
+            }
+            else if (Constants.Q_ELEM_FEATURE.equals(tempElQN))
+            {
+                parseFeature(tempEl, desc, oper);
+            }
+            else if (Constants.Q_ELEM_PROPERTY.equals(tempElQN))
+            {
+                parseProperty(tempEl, desc, oper);
+            }
+            else if (Constants.Q_ELEM_INPUT.equals(tempElQN))
+            {
+                parseBindingMessageReference(tempEl, desc, oper);
+            }
+            else if (Constants.Q_ELEM_OUTPUT.equals(tempElQN))
+            {
+                parseBindingMessageReference(tempEl, desc, oper);
+            }
+            else if (Constants.Q_ELEM_INFAULT.equals(tempElQN))
+            {
+                parseBindingFaultReference(tempEl, desc, oper);
+            }
+            else if (Constants.Q_ELEM_OUTFAULT.equals(tempElQN))
+            {
+                parseBindingFaultReference(tempEl, desc, oper);
+            }
+            else
+            {
+                oper.addExtensionElement(
+                        parseExtensionElement(BindingOperationElement.class, oper, tempEl, desc) );
+            }
+        }
+
+        return oper;
+    }
+
+    private BindingFaultReferenceElement parseBindingFaultReference(
+            XMLElement faultRefEl,
+            DescriptionElement desc,
+            BindingOperationElement parent)
+            throws WSDLException {
+
+        BindingFaultReferenceElement faultRef = parent.addBindingFaultReferenceElement();
+        faultRef.setParentElement(parent);
+
+        QName refQN = null;
+        String ref = faultRefEl.getAttributeValue(Constants.ATTR_REF);
+        if(ref != null)
+        {
+            try {
+                refQN = faultRefEl.getQName(ref);
+                faultRef.setRef(refQN);
+            } catch (WSDLException e) {
+                getErrorReporter().reportError( 
+                        new ErrorLocatorImpl(),  //TODO line&col nos.
+                        "WSDL505",
+                        new Object[] {ref, faultRefEl.getQName()},
+                        ErrorReporter.SEVERITY_ERROR);
+            }
+        }
+
+        String msgLabel = faultRefEl.getAttributeValue(Constants.ATTR_MESSAGE_LABEL);
+        if(msgLabel != null)
+        {
+            faultRef.setMessageLabel(new NCName(msgLabel));
+        }
+
+        parseExtensionAttributes(faultRefEl, BindingFaultReferenceElement.class, faultRef, desc);
+
+        /* Parse the child elements of binding operation <infault> or <outfault>. 
+         * As per WSDL 2.0 spec, they must be in the following order if present:
+         * <documentation> 
+         * <feature> <property> or extension elements in any order
+         * TODO validate that the elements are in correct order
+         */ 
+
+        XMLElement[] children = faultRefEl.getChildElements();
+        XMLElement tempEl = null;
+        QName tempElQN = null;
+
+        for(int i=0; i<children.length; i++)
+        {
+            tempEl = children[i];
+            tempElQN = tempEl.getQName();
+
+            if (Constants.Q_ELEM_DOCUMENTATION.equals(tempElQN))
+            {
+                parseDocumentation(tempEl, desc, faultRef);
+            }
+            else if (Constants.Q_ELEM_FEATURE.equals(tempElQN))
+            {
+                parseFeature(tempEl, desc, faultRef);
+            }
+            else if (Constants.Q_ELEM_PROPERTY.equals(tempElQN))
+            {
+                parseProperty(tempEl, desc, faultRef);
+            }
+            else
+            {
+                faultRef.addExtensionElement(
+                        parseExtensionElement(BindingFaultReferenceElement.class, faultRef, tempEl, desc) );
+            }
+        }
+
+        return faultRef;
+    }
+
+    private BindingMessageReferenceElement parseBindingMessageReference(
+            XMLElement msgRefEl,
+            DescriptionElement desc,
+            BindingOperationElement parent)
+            throws WSDLException {
+
+        BindingMessageReferenceElement message = parent.addBindingMessageReferenceElement();
+        message.setParentElement(parent);
+
+        if(Constants.ELEM_INPUT.equals(msgRefEl.getLocalName())) {
+            message.setDirection(Direction.IN);
+        } 
+        else if(Constants.ELEM_OUTPUT.equals(msgRefEl.getLocalName())) {
+            message.setDirection(Direction.OUT);
+        }
+
+        String msgLabel = msgRefEl.getAttributeValue(Constants.ATTR_MESSAGE_LABEL);
+        if(msgLabel != null) 
+        {
+            message.setMessageLabel(new NCName(msgLabel));
+        }
+        else
+        {
+            //TODO this is a temp fix, correct action to use MEP to determine default
+            if(message.getDirection().equals(Direction.IN))
+            {
+                message.setMessageLabel(MessageLabel.IN);
+            }
+            else
+            {
+                message.setMessageLabel(MessageLabel.OUT);
+            }
+        }
+
+        parseExtensionAttributes(msgRefEl, BindingMessageReferenceElement.class, message, desc);
+
+        /* Parse the child elements of binding operation <input> or <output>. 
+         * As per WSDL 2.0 spec, they must be in the following order if present:
+         * <documentation> 
+         * <feature> <property> or extension elements in any order
+         * TODO validate that the elements are in correct order
+         */ 
+
+        XMLElement[] children = msgRefEl.getChildElements();
+        XMLElement tempEl = null;
+        QName tempElQN = null;
+
+        for(int i=0; i<children.length; i++)
+        {
+            tempEl = children[i];
+            tempElQN = tempEl.getQName();
+
+            if (Constants.Q_ELEM_DOCUMENTATION.equals(tempElQN))
+            {
+                parseDocumentation(tempEl, desc, message);
+            }
+            else if (Constants.Q_ELEM_FEATURE.equals(tempElQN))
+            {
+                parseFeature(tempEl, desc, message);
+            }
+            else if (Constants.Q_ELEM_PROPERTY.equals(tempElQN))
+            {
+                parseProperty(tempEl, desc, message);
+            }
+            else
+            {
+                message.addExtensionElement(
+                        parseExtensionElement(BindingMessageReferenceElement.class, message, tempEl, desc) );
+            }
+        }
+
+        return message;
+    }
+
+    private ServiceElement parseService(
+            XMLElement serviceEl,
+            DescriptionElement desc)
+            throws WSDLException {
+
+        ServiceElement service = desc.addServiceElement();
+
+        String name = serviceEl.getAttributeValue(Constants.ATTR_NAME);
+        if(name != null)
+        {
+            service.setName(new NCName(name));
+        }
+
+        QName intfaceQN = null;
+        String intface = serviceEl.getAttributeValue(Constants.ATTR_INTERFACE);
+        if(intface != null)
+        {
+            try {
+                intfaceQN = serviceEl.getQName(intface);
+                service.setInterfaceName(intfaceQN);
+            } catch (WSDLException e) {
+                getErrorReporter().reportError( 
+                        new ErrorLocatorImpl(),  //TODO line&col nos.
+                        "WSDL505",
+                        new Object[] {intface, serviceEl.getQName()},
+                        ErrorReporter.SEVERITY_ERROR);
+            }
+        }
+
+		parseExtensionAttributes(serviceEl, ServiceElement.class, service, desc);
+
+		/* Parse the child elements of <service>. 
+		 * As per WSDL 2.0 spec, they must be in the following order if present:
+		 * <documentation> 
+		 * <endpoint>
+		 * <feature> <property> or extension elements in any order
+		 * TODO validate that the elements are in correct order
+		 */ 
+
+        XMLElement[] children = serviceEl.getChildElements();
+        XMLElement tempEl = null;
+        QName tempElQN = null;
+
+        for(int i=0; i<children.length; i++)
+        {
+            tempEl = children[i];
+            tempElQN = tempEl.getQName();
+
+			if (Constants.Q_ELEM_DOCUMENTATION.equals(tempElQN))
+			{
+				parseDocumentation(tempEl, desc, service);
+			}
+			else if (Constants.Q_ELEM_ENDPOINT.equals(tempElQN))
+			{
+				parseEndpoint(tempEl, desc, service);
+			}
+			else if (Constants.Q_ELEM_FEATURE.equals(tempElQN))
+			{
+				parseFeature(tempEl, desc, service);
+			}
+			else if (Constants.Q_ELEM_PROPERTY.equals(tempElQN))
+			{
+				parseProperty(tempEl, desc, service);
+			}
+			else
+			{
+				service.addExtensionElement(
+						parseExtensionElement(ServiceElement.class, service, tempEl, desc) );
+			}
+		}
+
+		return service;
+	}
+            
+    private EndpointElement parseEndpoint(
+            XMLElement endpointEl,
+            DescriptionElement desc,
+            ServiceElement parent)
+            throws WSDLException {
+
+        EndpointElement endpoint = parent.addEndpointElement();
+        endpoint.setParentElement(parent);
+
+        String name = endpointEl.getAttributeValue(Constants.ATTR_NAME);
+        if(name != null)
+        {
+            endpoint.setName(new NCName(name));
+        }
+
+        QName bindingQN = null;
+        String binding = endpointEl.getAttributeValue(Constants.ATTR_BINDING);
+        if(binding != null)
+        {
+            try {
+                bindingQN = endpointEl.getQName(binding);
+                endpoint.setBindingName(bindingQN);
+            } catch (WSDLException e) {
+                getErrorReporter().reportError( 
+                        new ErrorLocatorImpl(),  //TODO line&col nos.
+                        "WSDL505",
+                        new Object[] {binding, endpointEl.getQName()},
+                        ErrorReporter.SEVERITY_ERROR);
+            }
+        }
+
+        String address = endpointEl.getAttributeValue(Constants.ATTR_ADDRESS);
+
+        if(address != null)
+        {
+            endpoint.setAddress(getURI(address));
+        }
+
+        parseExtensionAttributes(endpointEl, EndpointElement.class, endpoint, desc);
+
+        /* Parse the child elements of <endpoint>. 
+         * As per WSDL 2.0 spec, they must be in the following order if present:
+         * <documentation> 
+         * <feature> <property> or extension elements in any order
+         * TODO validate that the elements are in correct order
+         */ 
+
+        XMLElement[] children = endpointEl.getChildElements();
+        XMLElement tempEl = null;
+        QName tempElQN = null;
+
+        for(int i=0; i<children.length; i++)
+        {
+            tempEl = children[i];
+            tempElQN = tempEl.getQName();
+
+            if (Constants.Q_ELEM_DOCUMENTATION.equals(tempElQN))
+            {
+                parseDocumentation(tempEl, desc, endpoint);
+            }
+            else if (Constants.Q_ELEM_FEATURE.equals(tempElQN))
+            {
+                parseFeature(tempEl, desc, endpoint);
+            }
+            else if (Constants.Q_ELEM_PROPERTY.equals(tempElQN))
+            {
+                parseProperty(tempEl, desc, endpoint);
+            }
+            else
+            {
+                endpoint.addExtensionElement(
+                        parseExtensionElement(ServiceElement.class, endpoint, tempEl, desc) );
+            }
+        }
+
+        return endpoint;
+    }
+
+    private FeatureElement parseFeature(
+            XMLElement featEl,
+            DescriptionElement desc, ConfigurableElement parent)
+            throws WSDLException {
+
+        FeatureElement feature = parent.addFeatureElement();
+        feature.setParentElement(parent);
+
+        String ref = featEl.getAttributeValue(Constants.ATTR_REF);
+        if(ref != null)
+        {
+            feature.setRef(getURI(ref));
+        }
+
+        String req = featEl.getAttributeValue(Constants.ATTR_REQUIRED);
+        feature.setRequired(Constants.VALUE_TRUE.equals(req) ? true : false);
+        //TODO t.b.c. what if attr value is not 'true' or 'false'? (eg, missing, mispelt or not lower case.
+
+        parseExtensionAttributes(featEl, FeatureElement.class, feature, desc);
+
+        /* Parse the child elements of the <feature> element. 
+         * As per WSDL 2.0 spec, they must be in the following order if present:
+         * <documentation>
+         * extension elements.
+         * 
+         * TODO validate that the elements are in correct order
+         */ 
+
+        XMLElement[] children = featEl.getChildElements();
+        XMLElement tempEl = null;
+        QName tempElQN = null;
+
+        for(int i=0; i<children.length; i++)
+        {
+            tempEl = children[i];
+            tempElQN = tempEl.getQName();
+            if (Constants.Q_ELEM_DOCUMENTATION.equals(tempElQN))
+            {
+                parseDocumentation(tempEl, desc, feature);
+            }
+            else
+            {
+                feature.addExtensionElement(
+                        parseExtensionElement(FeatureElement.class, feature, tempEl, desc) );
+            }
+        }
+
+        return feature;
+    }
+
+    protected abstract PropertyElement parseProperty(
+            XMLElement propEl, 
+            DescriptionElement desc,
+            ConfigurableElement parent)
+            throws WSDLException;
+
+
+    /* --- */
+
+    protected ExtensionElement parseExtensionElement(
+            Class parentType,
+            WSDLElement parent,
+            XMLElement el,
+            DescriptionElement desc)
+            throws WSDLException {
+
+        QName elementType = el.getQName();
+        String namespaceURI = (el.getNamespaceURI()).toString();
+
+        try
+        {
+            if (namespaceURI == null || namespaceURI.equals(Constants.NS_URI_WSDL20))
+            {
+                getErrorReporter().reportError(
+                        new ErrorLocatorImpl(),  //TODO line&col nos.
+                        "WSDL520",
+                        new Object[] {elementType, parentType.getName()},
+                        ErrorReporter.SEVERITY_ERROR);
+                return null;
+            }
+
+            ExtensionRegistry extReg = desc.getExtensionRegistry();
+
+            if (extReg == null)
+            {
+                getErrorReporter().reportError(
+                        new ErrorLocatorImpl(),  //TODO line&col nos.
+                        "WSDL514",
+                        new Object[] {elementType, parentType.getName()},
+                        ErrorReporter.SEVERITY_ERROR);
+                return null;
+            }
+
+            ExtensionDeserializer extDS = extReg.queryDeserializer(parentType,
+                    elementType);
+
+            return extDS.unmarshall(parentType, parent, elementType, el, desc, extReg);
+        }
+        catch (WSDLException e)
+        {
+            if (e.getLocation() == null)
+            {
+                //TODO fix this after refactoring into BaseWSDLReader
+                //e.setLocation(XPathUtils.getXPathExprFromNode(el));
+            }
+            throw e;
+        }
+    }
+
+    protected abstract void parseExtensionAttributes(
+            XMLElement extEl, 
+            Class wsdlClass, 
+            WSDLElement wsdlObj,
+            DescriptionElement desc)
+            throws WSDLException;
+
+
+
+    protected abstract void parseNamespaceDeclarations(
+            XMLElement xmlElem, 
+            WSDLElement wsdlElem) 
+            throws WSDLException;
+
+    /* Parse the schema for schema to include the built in schema types in the Woden model.
+     * TODO: As there are a finite number of built in schema types it may be better to create
+     * constants rather than reading the schema for schema on the creation of every model. 
+     * Also, this method currently requires that the schema elements exist in the types element.
+     * This may not be the best idea as it may imply that this schema contains an actual import
+     * statement in a WSDL 2.0 document. This method also does not work for when building the
+     * model programmatically.
+     * This method should be reevaluated at a later point.
+     */
+    protected void parseSchemaForXMLSchema(DescriptionElement desc) {
+        //This method is subject to reevaluation and a different approach,
+        //so the default implementation is empty.
+        //Subclasses can override this to do something useful.
+    }
+
+    /* ************************************************************
+     *  Helper methods
+     * ************************************************************/
+
+    /**
+     * Returns an XMLElement object representing the specified element
+     * object. The element object argument must be compatible with the 
+     * concrete reader implementation. If so, this method returns an XMLElement
+     * object that is type-compatible with the reader implementatation (e.g. a
+     * DOMXMLElement for DOMWSDLReader).
+     * 
+     * @throws IllegalArgumentException if elem is not a type recognized by the 
+     * WSDLReader implementation.
+     */
+    abstract protected XMLElement createXMLElement(Object elem) throws IllegalArgumentException;
+
+    /*
+     * Convert a string of type xs:anyURI to a java.net.URI.
+     * An empty string argument will return an empty string URI.
+     * A null argument will return a null.
+     */
+    protected URI getURI(String anyURI) throws WSDLException {
+        URI uri = null;
+        if(anyURI != null)
+        {
+            try {
+                uri = new URI(anyURI);
+            } catch (URISyntaxException e) {
+                getErrorReporter().reportError(
+                        new ErrorLocatorImpl(),  //TODO line&col nos.
+                        "WSDL506", 
+                        new Object[] {anyURI}, 
+                        ErrorReporter.SEVERITY_ERROR, 
+                        e);
+            }
+        }
+        return uri;
+    }
+
+    /*
+     * Retrieve a WSDL document by resolving the location URI specified 
+     * on a WSDL &lt;import&gt; or &lt;include&gt; element.
+     */
+    protected abstract DescriptionElement getWSDLFromLocation(
+            String locationURI,
+            DescriptionElement desc,
+            Map wsdlModules)
+            throws WSDLException;
+
     /**
      * Provides the capability of setting a supplied URI Resolver.
      * 
      */
     public void setURIResolver(URIResolver resolver) {
-    	fResolver = resolver;
+        fResolver = resolver;
     }
 
     /*
@@ -311,25 +1744,25 @@
      * TODO move to o.a.w.internal.util ?
      */
     protected URI resolveURI(URI uri) throws WSDLException {
-    	
-    	if (uri != null) {
-        	URI resolvedUri = null;
-        	try {
-        		resolvedUri = getURIResolver().resolveURI(uri);
-        	} catch (IOException e) {
-        		getErrorReporter().reportError(
+        
+        if (uri != null) {
+            URI resolvedUri = null;
+            try {
+                resolvedUri = getURIResolver().resolveURI(uri);
+            } catch (IOException e) {
+                getErrorReporter().reportError(
                         new ErrorLocatorImpl(),  //TODO line&col nos.
                         "WSDL524",
                         new Object[] {uri}, 
                         ErrorReporter.SEVERITY_ERROR, 
                         e);
-        	}
-        	if (resolvedUri != null) {
-        		uri = resolvedUri;
-        	}
+            }
+            if (resolvedUri != null) {
+                uri = resolvedUri;
+            }
         }
-    	
-    	return uri;
+        
+        return uri;
     }
 
     /*
@@ -339,24 +1772,24 @@
      * @return
      */
     protected String resolveURI(String uri) {
-    	String resolvedUri;
-    	try {
-    		resolvedUri = getURIResolver().resolveURI(new URI(uri)).toString();
-    	} catch (Exception e) {
-    		// revert to "default" behaviour
-    		resolvedUri = uri;
-    	}
-    	
-    	return resolvedUri;	
+        String resolvedUri;
+        try {
+            resolvedUri = getURIResolver().resolveURI(new URI(uri)).toString();
+        } catch (Exception e) {
+            // revert to "default" behaviour
+            resolvedUri = uri;
+        }
+        
+        return resolvedUri; 
     }
  
     
     /**
      * Find the current URI Resolver
      */
-	public URIResolver getURIResolver() {
-		return fResolver;
-	}
+    public URIResolver getURIResolver() {
+        return fResolver;
+    }
     
     
 }

Added: incubator/woden/trunk/java/src/org/apache/woden/internal/BaseXMLElement.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/BaseXMLElement.java?view=auto&rev=466188
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/internal/BaseXMLElement.java (added)
+++ incubator/woden/trunk/java/src/org/apache/woden/internal/BaseXMLElement.java Fri Oct 20 09:32:50 2006
@@ -0,0 +1,177 @@
+/**
+ * Copyright 2006 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.woden.internal;
+
+import java.net.URI;
+
+import javax.xml.namespace.QName;
+
+import org.apache.woden.ErrorReporter;
+import org.apache.woden.WSDLException;
+import org.apache.woden.XMLElement;
+
+/**
+ * This abstract class implements methods of the XMLElement interface that are
+ * common across all concrete implementations.
+ * 
+ */
+public abstract class BaseXMLElement implements XMLElement {
+
+    protected Object fSource = null;
+    protected ErrorReporter fErrorReporter = null;
+
+    protected BaseXMLElement(ErrorReporter errorReporter) {
+        fErrorReporter = errorReporter;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.woden.XMLElement#setSource(java.lang.Object)
+     */
+    abstract public void setSource(Object elem);
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.woden.XMLElement#getSource()
+     */
+    public final Object getSource() {
+        return fSource;
+    }
+    
+    //TODO refactor getAttributes() here
+    
+    /*
+     * (non-Javadoc)
+     * @see org.apache.woden.XMLElement#getAttribute(java.lang.String)
+     */
+    public final String getAttributeValue(String attrName) {
+    	
+    	if(fSource != null) {
+    		return doGetAttributeValue(attrName);
+    	} else { 
+    		return null;
+    	}
+    	
+    }
+    
+    protected abstract String doGetAttributeValue(String attrName);
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.woden.XMLElement#getNamespaceURI()
+     */
+    public final URI getNamespaceURI() throws WSDLException {
+    	
+    	if(fSource != null) {
+    		return doGetNamespaceURI();
+    	} else {
+    		return null;
+    	}
+    }
+    
+    protected abstract URI doGetNamespaceURI() throws WSDLException;
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.woden.XMLElement#getLocalName()
+     */
+    public final String getLocalName() {
+    	
+    	if(fSource != null) {
+    		return doGetLocalName();
+    	} else {
+    		return null;
+    	}
+    }
+    
+    protected abstract String doGetLocalName();
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.woden.XMLElement#getQName()
+     */
+    public final QName getQName() {
+    	
+    	if(fSource != null) {
+    		return doGetQName();
+    	} else {
+    		return null;
+    	}
+    }
+    
+    protected abstract QName doGetQName();
+    
+    /*
+     * (non-Javadoc)
+     * @see org.apache.woden.XMLElement#getQName(java.lang.String)
+     */
+    public final QName getQName(String prefixedValue) throws WSDLException {
+    	
+    	if(fSource != null) {
+    		return doGetQName(prefixedValue);
+    	} else {
+    		return null;
+    	}
+    }
+
+    protected abstract QName doGetQName(String prefixedValue) throws WSDLException;
+    
+    /*
+     * (non-Javadoc)
+     * @see org.apache.woden.XMLElement#getFirstChildElement()
+     */
+    public final XMLElement getFirstChildElement() {
+    	
+    	if(fSource != null) {
+    		return doGetFirstChildElement();
+    	} else {
+    		return null;
+    	}
+    }
+    
+    protected abstract XMLElement doGetFirstChildElement();
+    
+    /*
+     * (non-Javadoc)
+     * @see org.apache.woden.XMLElement#getNextSiblingElement()
+     */
+    public final XMLElement getNextSiblingElement() {
+    	
+    	if(fSource != null) {
+    		return doGetNextSiblingElement();
+    	} else {
+    		return null;
+    	}
+    }
+    
+    protected abstract XMLElement doGetNextSiblingElement();
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.woden.XMLElement#getChildElements()
+     */
+    public final XMLElement[] getChildElements() {
+        
+        if(fSource != null) {
+            return doGetChildElements();
+        } else {
+            return null;
+        }
+    }
+    
+    protected abstract XMLElement[] doGetChildElements();
+    
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: woden-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: woden-dev-help@ws.apache.org