cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject svn commit: r590557 - in /incubator/cxf/trunk: rt/core/src/main/java/org/apache/cxf/wsdl11/ testutils/ tools/javato/ws/ tools/validator/src/main/java/org/apache/cxf/tools/validator/ tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/...
Date Wed, 31 Oct 2007 04:47:20 GMT
Author: mmao
Date: Tue Oct 30 21:47:13 2007
New Revision: 590557

URL: http://svn.apache.org/viewvc?rev=590557&view=rev
Log:
* CXF-1137  CXF-1154
 * Enable WsdlRefValidator during wsdl2java by default
 * Fix bad wsdls
 * Extract the schema extraction from wsdlServiceBuilder
 * WsdlValidator support imported wsdls
 * Ignore some tests due to the bug in the wsdlValidator, one is recursive wsdl, and other is catalog support
 * Make wsdlDefinition final since WsdlValidator should only validate the wsdl, not to change the wsdl definition passed in


Added:
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/SchemaUtil.java
    incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1137/
    incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1137/helloWorld.wsdl
Modified:
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
    incubator/cxf/trunk/testutils/pom.xml
    incubator/cxf/trunk/tools/javato/ws/pom.xml
    incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/WSDLValidator.java
    incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/AbstractDefinitionValidator.java
    incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/Messages.properties
    incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/Stax2DOM.java
    incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/UniqueBodyPartsValidator.java
    incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/ValidatorUtil.java
    incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDL11Validator.java
    incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDLRefValidator.java
    incubator/cxf/trunk/tools/validator/src/test/java/org/apache/cxf/tools/validator/internal/WSDLRefValidatorTest.java
    incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
    incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/AbstractWSDLBuilder.java
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java
    incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
    incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
    incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/xml_format_root.wsdl

Added: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/SchemaUtil.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/SchemaUtil.java?rev=590557&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/SchemaUtil.java (added)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/SchemaUtil.java Tue Oct 30 21:47:13 2007
@@ -0,0 +1,205 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.wsdl11;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import javax.wsdl.Definition;
+import javax.wsdl.Import;
+import javax.wsdl.Types;
+import javax.wsdl.extensions.UnknownExtensibilityElement;
+import javax.wsdl.extensions.schema.Schema;
+import javax.wsdl.extensions.schema.SchemaImport;
+
+import org.w3c.dom.Element;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.catalog.CatalogXmlSchemaURIResolver;
+import org.apache.cxf.catalog.OASISCatalogManager;
+import org.apache.cxf.common.util.FixedExtensionDeserializer;
+import org.apache.cxf.helpers.CastUtils;
+import org.apache.cxf.service.model.SchemaInfo;
+import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaCollection;
+
+import static org.apache.cxf.helpers.CastUtils.cast;
+
+public final class SchemaUtil {
+    private final Map<String, Element> schemaList;
+    private final Bus bus;
+    private Map<String, String> catalogResolvedMap;
+
+
+    public SchemaUtil(final Bus b, final Map<String, Element> s) {
+        this.bus = b;
+        this.schemaList = s;
+    }
+
+    public void getSchemas(final Definition def, final ServiceInfo serviceInfo) {
+        XmlSchemaCollection schemaCol = serviceInfo.getXmlSchemaCollection();
+        schemaCol.getExtReg().setDefaultExtensionDeserializer(
+            new FixedExtensionDeserializer());
+
+        List<Definition> defList = new ArrayList<Definition>();
+        parseImports(def, defList);
+        extractSchema(def, schemaCol, serviceInfo);
+        // added
+        getSchemaList(def);
+        for (Definition def2 : defList) {
+            extractSchema(def2, schemaCol, serviceInfo);
+            // added
+            getSchemaList(def2);
+        }
+    }
+
+    private void extractSchema(Definition def, XmlSchemaCollection schemaCol, ServiceInfo serviceInfo) {
+        Types typesElement = def.getTypes();
+        if (typesElement != null) {
+            int schemaCount = 1;
+            for (Object obj : typesElement.getExtensibilityElements()) {
+                org.w3c.dom.Element schemaElem = null;
+                if (obj instanceof Schema) {
+                    Schema schema = (Schema)obj;
+                    schemaElem = schema.getElement();
+                } else if (obj instanceof UnknownExtensibilityElement) {
+                    org.w3c.dom.Element elem = ((UnknownExtensibilityElement)obj).getElement();
+                    if (elem.getLocalName().equals("schema")) {
+                        schemaElem = elem;
+                    }
+                }
+                if (schemaElem != null) {
+                    for (Object prefix : def.getNamespaces().keySet()) {
+                        String ns = (String)def.getNamespaces().get(prefix);
+                        if (!"".equals(prefix) && !schemaElem.hasAttribute("xmlns:" + prefix)) {
+                            schemaElem.setAttributeNS(javax.xml.XMLConstants.XMLNS_ATTRIBUTE_NS_URI,
+                                                      "xmlns:" + prefix, ns);
+                        }
+                    }
+                    String systemId = def.getDocumentBaseURI() + "#types" + schemaCount;
+
+                    schemaCol.setBaseUri(def.getDocumentBaseURI());
+                    CatalogXmlSchemaURIResolver schemaResolver =
+                        new CatalogXmlSchemaURIResolver(OASISCatalogManager.getCatalogManager(bus));
+                    schemaCol.setSchemaResolver(schemaResolver);
+                    
+                    XmlSchema xmlSchema = schemaCol.read(schemaElem, systemId);
+                    SchemaInfo schemaInfo = new SchemaInfo(serviceInfo, xmlSchema.getTargetNamespace());
+                    schemaInfo.setElement(schemaElem);
+                    schemaInfo.setSchema(xmlSchema);
+                    schemaInfo.setSystemId(systemId);
+                    serviceInfo.addSchema(schemaInfo);
+                    schemaCount++;
+                }
+            }
+        }
+    }
+
+    private void parseImports(Definition def, List<Definition> defList) {
+        List<Import> importList = new ArrayList<Import>();
+
+        Collection<List<Import>> ilist = cast(def.getImports().values());
+        for (List<Import> list : ilist) {
+            importList.addAll(list);
+        }
+        for (Import impt : importList) {
+            if (!defList.contains(impt.getDefinition())) {
+                defList.add(impt.getDefinition());
+                parseImports(impt.getDefinition(), defList);
+            }
+        }
+    }
+
+    // Workaround for getting the elements
+    private void getSchemaList(Definition def) {
+        Types typesElement = def.getTypes();
+        if (typesElement != null) {
+            Iterator ite = typesElement.getExtensibilityElements().iterator();
+            while (ite.hasNext()) {
+                Object obj = ite.next();
+                if (obj instanceof Schema) {
+                    Schema schema = (Schema)obj;
+                    addSchema(schema.getDocumentBaseURI(), schema);
+                }
+            }
+        }
+    }
+
+    private void addSchema(String docBaseURI, Schema schema) {
+        //String docBaseURI = schema.getDocumentBaseURI();
+        Element schemaEle = schema.getElement();
+        if (schemaList.get(docBaseURI) == null) {
+            schemaList.put(docBaseURI, schemaEle);
+        } else if (schemaList.get(docBaseURI) != null && schemaList.containsValue(schemaEle)) {
+            // do nothing
+        } else {
+            String tns = schema.getDocumentBaseURI() + "#"
+                         + schema.getElement().getAttribute("targetNamespace");
+            if (schemaList.get(tns) == null) {
+                schemaList.put(tns, schema.getElement());
+            }
+        }
+
+        Map<String, List> imports = CastUtils.cast(schema.getImports());
+        if (imports != null && imports.size() > 0) {
+            Collection<String> importKeys = imports.keySet();
+            for (String importNamespace : importKeys) {
+
+                List<SchemaImport> schemaImports = CastUtils.cast(imports.get(importNamespace));
+                
+                for (SchemaImport schemaImport : schemaImports) {
+                    Schema tempImport = schemaImport.getReferencedSchema();                   
+                    String key = schemaImport.getSchemaLocationURI();
+                    if (importNamespace == null && tempImport != null) {
+                        importNamespace = tempImport.getDocumentBaseURI();
+                    }
+                    if ((catalogResolvedMap == null || !catalogResolvedMap.containsKey(key)) 
+                        && tempImport != null) {                 
+                        key = tempImport.getDocumentBaseURI();
+                    }
+                    if (tempImport != null
+                        && !isSchemaParsed(key, importNamespace)
+                        && !schemaList.containsValue(tempImport.getElement())) {
+                        addSchema(key, tempImport);
+                    }
+                }
+
+            }
+        }
+    }
+
+    private boolean isSchemaParsed(String baseUri, String ns) {
+        if (schemaList.get(baseUri) != null) {
+            Element ele = schemaList.get(baseUri);
+            String tns = ele.getAttribute("targetNamespace");
+            if (ns.equals(tns)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public void setCatalogResolvedMap(Map<String, String> resolvedMap) {
+        catalogResolvedMap = resolvedMap;
+    }
+}

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java?rev=590557&r1=590556&r2=590557&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java Tue Oct 30 21:47:13 2007
@@ -43,26 +43,17 @@
 import javax.wsdl.Port;
 import javax.wsdl.PortType;
 import javax.wsdl.Service;
-import javax.wsdl.Types;
 import javax.wsdl.extensions.ExtensibilityElement;
-import javax.wsdl.extensions.UnknownExtensibilityElement;
-import javax.wsdl.extensions.schema.Schema;
-import javax.wsdl.extensions.schema.SchemaImport;
 import javax.wsdl.extensions.soap.SOAPBinding;
 import javax.wsdl.extensions.soap12.SOAP12Binding;
 import javax.xml.namespace.QName;
 
 import org.w3c.dom.Element;
 
-
-
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusException;
 import org.apache.cxf.binding.BindingFactory;
-import org.apache.cxf.catalog.CatalogXmlSchemaURIResolver;
-import org.apache.cxf.catalog.OASISCatalogManager;
 import org.apache.cxf.common.logging.LogUtils;
-import org.apache.cxf.common.util.FixedExtensionDeserializer;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.service.model.AbstractMessageContainer;
 import org.apache.cxf.service.model.AbstractPropertiesHolder;
@@ -77,12 +68,10 @@
 import org.apache.cxf.service.model.MessageInfo;
 import org.apache.cxf.service.model.MessagePartInfo;
 import org.apache.cxf.service.model.OperationInfo;
-import org.apache.cxf.service.model.SchemaInfo;
 import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.cxf.service.model.UnwrappedOperationInfo;
 import org.apache.cxf.transport.DestinationFactory;
 import org.apache.cxf.transport.DestinationFactoryManager;
-import org.apache.ws.commons.schema.XmlSchema;
 import org.apache.ws.commons.schema.XmlSchemaCollection;
 import org.apache.ws.commons.schema.XmlSchemaComplexType;
 import org.apache.ws.commons.schema.XmlSchemaElement;
@@ -269,20 +258,9 @@
     }
 
     private void getSchemas(Definition def, ServiceInfo serviceInfo) {
-        XmlSchemaCollection schemaCol = serviceInfo.getXmlSchemaCollection();
-        schemaCol.getExtReg().setDefaultExtensionDeserializer(
-            new FixedExtensionDeserializer());
-
-        List<Definition> defList = new ArrayList<Definition>();
-        parseImports(def, defList);
-        extractSchema(def, schemaCol, serviceInfo);
-        // added
-        getSchemaList(def);
-        for (Definition def2 : defList) {
-            extractSchema(def2, schemaCol, serviceInfo);
-            // added
-            getSchemaList(def2);
-        }
+        SchemaUtil schemaUtil = new SchemaUtil(bus, this.schemaList);
+        schemaUtil.setCatalogResolvedMap(this.catalogResolvedMap);
+        schemaUtil.getSchemas(def, serviceInfo);
     }
 
     private void parseImports(Definition def, List<Definition> defList) {
@@ -298,118 +276,6 @@
                 parseImports(impt.getDefinition(), defList);
             }
         }
-    }
-
-    private void extractSchema(Definition def, XmlSchemaCollection schemaCol, ServiceInfo serviceInfo) {
-        Types typesElement = def.getTypes();
-        if (typesElement != null) {
-            int schemaCount = 1;
-            for (Object obj : typesElement.getExtensibilityElements()) {
-                org.w3c.dom.Element schemaElem = null;
-                if (obj instanceof Schema) {
-                    Schema schema = (Schema)obj;
-                    schemaElem = schema.getElement();
-                } else if (obj instanceof UnknownExtensibilityElement) {
-                    org.w3c.dom.Element elem = ((UnknownExtensibilityElement)obj).getElement();
-                    if (elem.getLocalName().equals("schema")) {
-                        schemaElem = elem;
-                    }
-                }
-                if (schemaElem != null) {
-                    for (Object prefix : def.getNamespaces().keySet()) {
-                        String ns = (String)def.getNamespaces().get(prefix);
-                        if (!"".equals(prefix) && !schemaElem.hasAttribute("xmlns:" + prefix)) {
-                            schemaElem.setAttributeNS(javax.xml.XMLConstants.XMLNS_ATTRIBUTE_NS_URI,
-                                                      "xmlns:" + prefix, ns);
-                        }
-                    }
-                    String systemId = def.getDocumentBaseURI() + "#types" + schemaCount;
-
-                    schemaCol.setBaseUri(def.getDocumentBaseURI());
-                    CatalogXmlSchemaURIResolver schemaResolver =
-                        new CatalogXmlSchemaURIResolver(OASISCatalogManager.getCatalogManager(bus));
-                    schemaCol.setSchemaResolver(schemaResolver);
-                    XmlSchema xmlSchema = schemaCol.read(schemaElem, systemId);
-
-                    SchemaInfo schemaInfo = new SchemaInfo(serviceInfo, xmlSchema.getTargetNamespace());
-                    schemaInfo.setElement(schemaElem);
-                    schemaInfo.setSchema(xmlSchema);
-                    schemaInfo.setSystemId(systemId);
-                    serviceInfo.addSchema(schemaInfo);
-                    schemaCount++;
-                }
-            }
-        }
-    }
-
-    // Workaround for getting the elements
-    private void getSchemaList(Definition def) {
-        Types typesElement = def.getTypes();
-        if (typesElement != null) {
-            Iterator ite = typesElement.getExtensibilityElements().iterator();
-            while (ite.hasNext()) {
-                Object obj = ite.next();
-                if (obj instanceof Schema) {
-                    Schema schema = (Schema)obj;
-                    addSchema(schema.getDocumentBaseURI(), schema);
-                }
-            }
-        }
-    }
-
-    private void addSchema(String docBaseURI, Schema schema) {
-        //String docBaseURI = schema.getDocumentBaseURI();
-        Element schemaEle = schema.getElement();
-        if (schemaList.get(docBaseURI) == null) {
-            schemaList.put(docBaseURI, schemaEle);
-        } else if (schemaList.get(docBaseURI) != null && schemaList.containsValue(schemaEle)) {
-            // do nothing
-        } else {
-            String tns = schema.getDocumentBaseURI() + "#"
-                         + schema.getElement().getAttribute("targetNamespace");
-            if (schemaList.get(tns) == null) {
-                schemaList.put(tns, schema.getElement());
-            }
-        }
-
-        Map<String, List> imports = CastUtils.cast(schema.getImports());
-        if (imports != null && imports.size() > 0) {
-            Collection<String> importKeys = imports.keySet();
-            for (String importNamespace : importKeys) {
-
-                List<SchemaImport> schemaImports = CastUtils.cast(imports.get(importNamespace));
-                
-                for (SchemaImport schemaImport : schemaImports) {
-                    Schema tempImport = schemaImport.getReferencedSchema();                   
-                    String key = schemaImport.getSchemaLocationURI();
-                    if (importNamespace == null && tempImport != null) {
-                        importNamespace = tempImport.getDocumentBaseURI();
-                    }
-                    if ((catalogResolvedMap == null || !catalogResolvedMap.containsKey(key)) 
-                        && tempImport != null) {                 
-                        key = tempImport.getDocumentBaseURI();
-                    }
-                    if (tempImport != null
-                        && !isSchemaParsed(key, importNamespace)
-                        && !schemaList.containsValue(tempImport.getElement())) {
-                        addSchema(key, tempImport);
-                    }
-                }
-
-            }
-        }
-
-    }
-
-    private boolean isSchemaParsed(String baseUri, String ns) {
-        if (schemaList.get(baseUri) != null) {
-            Element ele = schemaList.get(baseUri);
-            String tns = ele.getAttribute("targetNamespace");
-            if (ns.equals(tns)) {
-                return true;
-            }
-        }
-        return false;
     }
 
     public EndpointInfo buildEndpoint(ServiceInfo service, BindingInfo bi, Port port) {

Modified: incubator/cxf/trunk/testutils/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/pom.xml?rev=590557&r1=590556&r2=590557&view=diff
==============================================================================
--- incubator/cxf/trunk/testutils/pom.xml (original)
+++ incubator/cxf/trunk/testutils/pom.xml Tue Oct 30 21:47:13 2007
@@ -345,6 +345,7 @@
                                 <wsdlOption>
                                     <wsdl>${basedir}/src/main/resources/wsdl/ordered_param_holder.wsdl</wsdl>
                                 </wsdlOption>
+
                                 <wsdlOption>
                                     <wsdl>${basedir}/src/main/resources/wsdl/hello_world_services.wsdl</wsdl>
                                 </wsdlOption>

Modified: incubator/cxf/trunk/tools/javato/ws/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/pom.xml?rev=590557&r1=590556&r2=590557&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/javato/ws/pom.xml (original)
+++ incubator/cxf/trunk/tools/javato/ws/pom.xml Tue Oct 30 21:47:13 2007
@@ -207,7 +207,7 @@
                                 <wsdlOption>
                                     <wsdl>${basedir}/src/test/resources/java2wsdl_wsdl/hello_world_bare.wsdl</wsdl>
                                     <extraargs>
-                                        <arg>-verbose</arg>
+					<!--arg>-verbose</arg-->
                                     </extraargs>
                                 </wsdlOption>
                                 <wsdlOption>

Modified: incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/WSDLValidator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/WSDLValidator.java?rev=590557&r1=590556&r2=590557&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/WSDLValidator.java (original)
+++ incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/WSDLValidator.java Tue Oct 30 21:47:13 2007
@@ -57,7 +57,8 @@
                 if (isVerboseOn()) {
                     env.put(ToolConstants.CFG_VERBOSE, Boolean.TRUE);
                 }
-
+                env.put(ToolConstants.CFG_VALIDATE_WSDL, Boolean.TRUE);
+                System.out.println("1########: " + env.optionSet(ToolConstants.CFG_VALIDATE_WSDL));
                 env.put(ToolConstants.CFG_CMD_ARG, getArgument());
 
               

Modified: incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/AbstractDefinitionValidator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/AbstractDefinitionValidator.java?rev=590557&r1=590556&r2=590557&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/AbstractDefinitionValidator.java (original)
+++ incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/AbstractDefinitionValidator.java Tue Oct 30 21:47:13 2007
@@ -25,18 +25,19 @@
 import org.apache.cxf.tools.validator.AbstractValidator;
 
 public abstract class AbstractDefinitionValidator extends AbstractValidator {
-    protected Definition def;
+    protected final Definition def;
     protected ToolContext env;
 
     public AbstractDefinitionValidator() {
         super();
+        this.def = null;
     }
 
-    public AbstractDefinitionValidator(Definition definition) {
+    public AbstractDefinitionValidator(final Definition definition) {
         this.def = definition;
     }
 
-    public AbstractDefinitionValidator(Definition definition, ToolContext pEnv) {
+    public AbstractDefinitionValidator(final Definition definition, ToolContext pEnv) {
         this.def = definition;
         this.env = pEnv;
     }

Modified: incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/Messages.properties?rev=590557&r1=590556&r2=590557&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/Messages.properties (original)
+++ incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/Messages.properties Tue Oct 30 21:47:13 2007
@@ -33,4 +33,9 @@
 
 TYPE_REF_NOT_FOUND = Part <{1}> in Message <{0}> referenced Type <{2}> can not be found in the schemas
 
-FAILED_AT_POINT = {2}:[{0},{1}] \n Caused by {3} not exist.
\ No newline at end of file
+FAILED_AT_POINT = {2}:[{0},{1}] \n Caused by {3} not exist.
+
+SCHEMA_READ_FAIL = Can not resolve the schema with {0}
+
+WRONG_MEP = Invalid WSDL, Operation {0} in PortType {1} not request-response or one-way
+NO_PORTTYPE = Can not find the portType by name: {0}
\ No newline at end of file

Modified: incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/Stax2DOM.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/Stax2DOM.java?rev=590557&r1=590556&r2=590557&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/Stax2DOM.java (original)
+++ incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/Stax2DOM.java Tue Oct 30 21:47:13 2007
@@ -72,7 +72,7 @@
             if (wsdlURI.toString().startsWith("http")) {
                 return getDocument(wsdlURI.toURL());
             }
-            return getDocument(new File(wsdlURI));
+            return getDocument(wsdlURI.toURL());
         } catch (Exception e) {
             throw new ToolException(e);
         }

Modified: incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/UniqueBodyPartsValidator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/UniqueBodyPartsValidator.java?rev=590557&r1=590556&r2=590557&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/UniqueBodyPartsValidator.java (original)
+++ incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/UniqueBodyPartsValidator.java Tue Oct 30 21:47:13 2007
@@ -35,7 +35,6 @@
 
     public UniqueBodyPartsValidator(Definition def) {
         super(def);
-
     }
 
     public boolean isValid() {

Modified: incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/ValidatorUtil.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/ValidatorUtil.java?rev=590557&r1=590556&r2=590557&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/ValidatorUtil.java (original)
+++ incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/ValidatorUtil.java Tue Oct 30 21:47:13 2007
@@ -22,12 +22,14 @@
 import java.io.File;
 import java.io.IOException;
 import java.net.URI;
+import java.net.URISyntaxException;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.logging.Level;
 import java.util.logging.Logger;
-
+import javax.wsdl.Definition;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
@@ -37,15 +39,16 @@
 import org.w3c.dom.NamedNodeMap;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
-
 import org.xml.sax.SAXException;
 
+import org.apache.cxf.BusFactory;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.cxf.tools.common.ToolException;
 import org.apache.cxf.wsdl.WSDLConstants;
-
+import org.apache.cxf.wsdl11.SchemaUtil;
 import org.apache.ws.commons.schema.XmlSchemaCollection;
 
 public final class ValidatorUtil {
@@ -54,6 +57,15 @@
     private ValidatorUtil() {
     }
 
+
+    public static XmlSchemaCollection getSchema(final Definition def) {
+        ServiceInfo serviceInfo = new ServiceInfo();
+        new SchemaUtil(BusFactory.getDefaultBus(), 
+                       new HashMap<String, Element>()).getSchemas(def, 
+                                                                  serviceInfo);
+        return serviceInfo.getXmlSchemaCollection();
+    }
+
     /**
      * Get a list of schemas found in a wsdl Document.
      * The list will include any schemas from imported wsdls.
@@ -86,14 +98,20 @@
             String tns = schemaEl.getAttribute("targetNamespace");
             try {
                 schemaCol.read(schemaEl, tns);
-            } catch (java.lang.RuntimeException ex) {
+            } catch (RuntimeException ex) {
+                LOG.log(Level.WARNING, "SCHEMA_READ_FAIL", tns);
                 //
                 // Couldn't find schema... check if it's relative to wsdl.
                 // XXX - Using setBaseUri() on the XmlSchemaCollection,
                 // only seems to work for the first imported xsd... so pass
                 // in the baseURI here.
                 //
-                schemaCol.read(schemaEl, baseURI);
+                try {
+                    schemaCol.read(schemaEl, baseURI);
+                } catch (RuntimeException ex2) {
+                    LOG.log(Level.WARNING, "SCHEMA_READ_FAIL", baseURI);
+                    continue;
+                }
             }
         }
         schemaList.add(schemaCol);
@@ -143,7 +161,7 @@
         String myBasePath = basePath;
         try {
             myBasePath = new URI(basePath.replaceAll(" ", "%20")).getPath();
-        } catch (java.net.URISyntaxException e1) {
+        } catch (URISyntaxException e1) {
             // This will be problematic...
         }
         for (int x = 0; x < nodes.getLength(); x++) {

Modified: incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDL11Validator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDL11Validator.java?rev=590557&r1=590556&r2=590557&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDL11Validator.java (original)
+++ incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDL11Validator.java Tue Oct 30 21:47:13 2007
@@ -21,6 +21,7 @@
 
 import java.io.File;
 import java.io.FileFilter;
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.net.JarURLConnection;
 import java.net.URI;
@@ -55,11 +56,11 @@
     protected static final Logger LOG = LogUtils.getL7dLogger(SchemaValidator.class);
     private final List<AbstractValidator> validators = new ArrayList<AbstractValidator>();
 
-    public WSDL11Validator(Definition definition) {
+    public WSDL11Validator(final Definition definition) {
         super(definition);
     }
 
-    public WSDL11Validator(Definition definition, ToolContext pe) {
+    public WSDL11Validator(final Definition definition, ToolContext pe) {
         super(definition, pe);
     }
 
@@ -67,6 +68,9 @@
         LOG.log(Level.INFO, new Message("VALIDATE_WSDL", LOG, wsdl).toString());
         try {
             return XMLUtils.parse(new InputSource(URIParserUtil.getAbsoluteURI(wsdl)));
+        } catch (FileNotFoundException fe) {
+            LOG.log(Level.WARNING, "Can not find the wsdl " + wsdl + "to validate");
+            return null;
         } catch (Exception e) {
             throw new ToolException(e);
         }
@@ -83,21 +87,31 @@
         // 3.If 1 and 2 is null , then load these schema files from jar file
         String wsdl = (String)env.get(ToolConstants.CFG_WSDLURL);
 
-        WSDLRefValidator wsdlRefValidator = new WSDLRefValidator(wsdl, getWSDLDoc(wsdl));
+        Document doc = getWSDLDoc(wsdl);
+        if (doc == null) {
+            return true;
+        }
+        WSDLRefValidator wsdlRefValidator = new WSDLRefValidator(wsdl, doc);
         wsdlRefValidator.setSuppressWarnings(env.optionSet(ToolConstants.CFG_SUPPRESS_WARNINGS));
-
-        this.def = wsdlRefValidator.getDefinition();
-
+        Definition wsdlDef = wsdlRefValidator.getDefinition();        
         validators.add(wsdlRefValidator);
-        validators.add(new UniqueBodyPartsValidator(this.def));
-        validators.add(new WSIBPValidator(this.def));
-        validators.add(new MIMEBindingValidator(this.def));
+
+        if (env.optionSet(ToolConstants.CFG_VALIDATE_WSDL)) {
+            validators.add(new UniqueBodyPartsValidator(wsdlDef));
+            validators.add(new WSIBPValidator(wsdlDef));
+            validators.add(new MIMEBindingValidator(wsdlDef));
+        }
 
         for (AbstractValidator validator : validators) {
             if (!validator.isValid()) {
                 addErrorMessage(validator.getErrorMessage());                
                 throw new ToolException(this.getErrorMessage());
             }
+        }
+
+        // By default just use WsdlRefValidator
+        if (!env.optionSet(ToolConstants.CFG_VALIDATE_WSDL)) {
+            return true;
         }
 
         if (!StringUtils.isEmpty(schemaDir)) {

Modified: incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDLRefValidator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDLRefValidator.java?rev=590557&r1=590556&r2=590557&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDLRefValidator.java (original)
+++ incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDLRefValidator.java Tue Oct 30 21:47:13 2007
@@ -19,7 +19,6 @@
 
 package org.apache.cxf.tools.validator.internal;
 
-import java.io.IOException;
 import java.net.URISyntaxException;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -81,7 +80,7 @@
     private Definition definition;
 
     private List<Definition> importedDefinitions;
-    private List<XmlSchemaCollection> schemas;
+    private List<XmlSchemaCollection> schemas = new ArrayList<XmlSchemaCollection>();
     private XmlSchemaCollection schemaCollection = new XmlSchemaCollection();
 
     private boolean suppressWarnings;
@@ -97,7 +96,7 @@
         WSDLDefinitionBuilder wsdlBuilder = new WSDLDefinitionBuilder();
         try {
             this.definition = wsdlBuilder.build(wsdl);
-
+            
             if (wsdlBuilder.getImportedDefinitions().size() > 0) {
                 importedDefinitions = new ArrayList<Definition>();
                 importedDefinitions.addAll(wsdlBuilder.getImportedDefinitions());
@@ -110,10 +109,12 @@
         }
 
         try {
-            Document document = doc == null ? getWSDLDocument() : doc;
-            schemas = ValidatorUtil.getSchemaList(document, definition.getDocumentBaseURI());
-        } catch (IOException ex) {
-            throw new ToolException("Cannot get schema list " + definition.getDocumentBaseURI(), ex);
+            schemas.add(ValidatorUtil.getSchema(this.definition));
+            if (importedDefinitions != null) {
+                for (Definition d : importedDefinitions) {
+                    schemas.add(ValidatorUtil.getSchema(d));
+                }
+            }
         } catch (Exception ex) {
             throw new ToolException(ex);
         }
@@ -206,10 +207,6 @@
         return vResults.isSuccessful();
     }
 
-    public void setDefinition(final Definition def) {
-        this.definition = def;
-    }
-
     private Map<QName, Service> getServices() {
         Map<QName, Service> services = new HashMap<QName, Service>();
         Iterator sNames = definition.getAllServices().keySet().iterator();
@@ -373,11 +370,13 @@
                 XNode vBopNode = getOperationXNode(vBindingNode, bop.getName());
                 vOpNode.setFailurePoint(vBopNode);
                 vNodes.add(vOpNode);
-                String inName = bop.getBindingInput().getName();
-                if (!StringUtils.isEmpty(inName)) {
-                    XNode vInputNode = getInputXNode(vOpNode, inName);
-                    vInputNode.setFailurePoint(getInputXNode(vBopNode, inName));
-                    vNodes.add(vInputNode);
+                if (bop.getBindingInput() != null) {
+                    String inName = bop.getBindingInput().getName();
+                    if (!StringUtils.isEmpty(inName)) {
+                        XNode vInputNode = getInputXNode(vOpNode, inName);
+                        vInputNode.setFailurePoint(getInputXNode(vBopNode, inName));
+                        vNodes.add(vInputNode);
+                    }
                 }
                 if (bop.getBindingOutput() != null) {
                     String outName = bop.getBindingOutput().getName();
@@ -397,9 +396,22 @@
         }
     }
 
+    private javax.wsdl.Message getMessage(QName msgName) {
+        javax.wsdl.Message message = this.definition.getMessage(msgName);
+        if (message == null) {
+            for (Definition d : importedDefinitions) {
+                message = d.getMessage(msgName);
+                if (message != null) {
+                    break;
+                }
+            }
+        }
+        return message;
+    }
+
     private void collectValidationPointsForMessages() {
         for (QName msgName : messageRefNames) {
-            javax.wsdl.Message message = this.definition.getMessage(msgName);
+            javax.wsdl.Message message = getMessage(msgName);
             for (Iterator iter = message.getParts().values().iterator(); iter.hasNext();) {
                 Part part = (Part) iter.next();
                 QName elementName = part.getElementName();
@@ -437,12 +449,35 @@
         }
     }
 
+    private PortType getPortType(QName ptName) {
+        PortType portType = this.definition.getPortType(ptName);
+        if (portType == null) {
+            for (Definition d : importedDefinitions) {
+                portType = d.getPortType(ptName);
+                if (portType != null) {
+                    break;
+                }
+            }
+        }
+        return portType;
+    }
+
     private void collectValidationPointsForPortTypes() {
         for (QName ptName : portTypeRefNames) {
-            PortType portType = this.definition.getPortType(ptName);
+            PortType portType = getPortType(ptName);
+            if (portType == null) {
+                vResults.addError(new Message("NO_PORTTYPE", LOG, ptName));
+                continue;
+            }
+
             XNode vPortTypeNode = getXNode(portType);
             for (Operation operation : getOperations(portType).values()) {
                 XNode vOperationNode = getOperationXNode(vPortTypeNode, operation.getName());
+                if (operation.getInput() == null) {
+                    vResults.addError(new Message("WRONG_MEP", LOG, operation.getName(),
+                                                  portType.getQName()));
+                    continue;
+                }
                 javax.wsdl.Message inMsg = operation.getInput().getMessage();
                 if (inMsg == null) {
                     addWarning("Operation " + operation.getName() + " in PortType: "

Modified: incubator/cxf/trunk/tools/validator/src/test/java/org/apache/cxf/tools/validator/internal/WSDLRefValidatorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/validator/src/test/java/org/apache/cxf/tools/validator/internal/WSDLRefValidatorTest.java?rev=590557&r1=590556&r2=590557&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/validator/src/test/java/org/apache/cxf/tools/validator/internal/WSDLRefValidatorTest.java (original)
+++ incubator/cxf/trunk/tools/validator/src/test/java/org/apache/cxf/tools/validator/internal/WSDLRefValidatorTest.java Tue Oct 30 21:47:13 2007
@@ -19,7 +19,6 @@
 
 package org.apache.cxf.tools.validator.internal;
 
-import java.io.File;
 import java.util.HashSet;
 import java.util.Set;
 
@@ -55,7 +54,7 @@
                                   WSDLRefValidator.LOG,
                                   27,
                                   2,
-                                  new File(new java.net.URI(wsdl)).toString(),
+                                  new java.net.URI(wsdl).toURL(),
                                   text);
         assertEquals(msg.toString(), t);
     }
@@ -127,7 +126,7 @@
                                   WSDLRefValidator.LOG,
                                   42,
                                   6,
-                                  new File(new java.net.URI(wsdl)).toString(),
+                                  new java.net.URI(wsdl).toURL(),
                                   text);
         assertEquals(msg.toString(), results.getErrors().pop());
     }

Modified: incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java?rev=590557&r1=590556&r2=590557&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java (original)
+++ incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java Tue Oct 30 21:47:13 2007
@@ -153,12 +153,14 @@
                     Definition definition = builder.getWSDLModel();
 
                     context.put(Definition.class, definition);
-                    if (context.optionSet(ToolConstants.CFG_VALIDATE_WSDL)) {
+
+                    // Revisit validator doesn't support catalog
+                    if (!context.optionSet(ToolConstants.CFG_CATALOG)) {
                         builder.validate(definition);
                     }
 
                     WSDLServiceBuilder serviceBuilder = new WSDLServiceBuilder(getBus());
-                    serviceBuilder.setCatalogResolvedMap(builder.getCataLogResovedMap());
+                    serviceBuilder.setCatalogResolvedMap(builder.getCataLogResolvedMap());
                     String serviceName = (String)context.get(ToolConstants.CFG_SERVICENAME);
 
                     if (serviceName != null) {

Modified: incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/AbstractWSDLBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/AbstractWSDLBuilder.java?rev=590557&r1=590556&r2=590557&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/AbstractWSDLBuilder.java (original)
+++ incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/AbstractWSDLBuilder.java Tue Oct 30 21:47:13 2007
@@ -44,5 +44,5 @@
 
     public abstract T getWSDLModel();
     
-    public abstract Map<String, String> getCataLogResovedMap();
+    public abstract Map<String, String> getCataLogResolvedMap();
 }

Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java?rev=590557&r1=590556&r2=590557&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java (original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java Tue Oct 30 21:47:13 2007
@@ -69,7 +69,7 @@
 
     private List<InputSource> jaxbBindings;
     private Element handlerChain;
-    private Map<String, String> cataLogResovedMap = new HashMap<String, String>();
+    private Map<String, String> cataLogResolvedMap = new HashMap<String, String>();
 
     public JAXWSDefinitionBuilder() {
         builder = new WSDLDefinitionBuilder();
@@ -176,7 +176,7 @@
         CustomizedWSDLLocator wsdlLocator = new CustomizedWSDLLocator(wsdlUrl, eleMap);
         wsdlLocator.setCatalogResolver(OASISCatalogManager.getCatalogManager(bus).getCatalog());
         Definition def = wsdlReader.readWSDL(wsdlLocator);
-        cataLogResovedMap.putAll(wsdlLocator.getResolvedMap());
+        cataLogResolvedMap.putAll(wsdlLocator.getResolvedMap());
         return def;
 
     }
@@ -194,12 +194,12 @@
     }
 
 
-    public boolean validate(Definition def) throws ToolException {
+    public boolean validate(final Definition def) throws ToolException {
         return new WSDL11Validator(def, context).isValid();
     }
     
     
-    public Map<String, String> getCataLogResovedMap() {
-        return this.cataLogResovedMap;
+    public Map<String, String> getCataLogResolvedMap() {
+        return this.cataLogResolvedMap;
     }
 }

Modified: incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java?rev=590557&r1=590556&r2=590557&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java (original)
+++ incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java Tue Oct 30 21:47:13 2007
@@ -40,7 +40,7 @@
 import org.apache.cxf.tools.wsdlto.frontend.jaxws.validator.UniqueBodyValidator;
 import org.junit.After;
 import org.junit.Before;
-
+import org.junit.Ignore;
 import org.junit.Test;
 import org.mortbay.jetty.Server;
 import org.mortbay.jetty.handler.ResourceHandler;
@@ -65,7 +65,7 @@
         env.put(DataBindingProfile.class, PluginLoader.getInstance().getDataBindingProfile("jaxb"));
         env.put(ToolConstants.CFG_IMPL, "impl");
         env.put(ToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
-
+        env.put(ToolConstants.CFG_SUPPRESS_WARNINGS, true);
         processor = new JAXWSContainer(null);
 
     }
@@ -559,6 +559,7 @@
     }
     
     @Test
+    @Ignore("WsdlValidator failed with the wsdl")
     public void testRecursiveImport() throws Exception {
         env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/cxf778/hello_world_recursive.wsdl"));
         processor.setContext(env);
@@ -605,8 +606,11 @@
             processor.execute();
             fail("exception should be thrown");
         } catch (Exception e) {
+            String expectedErrorMsg = "Part <in> in Message " 
+                + "<{http://apache.org/hello_world_soap_http}greetMeRequest> referenced Type " 
+                + "<{http://apache.org/hello_world_soap_http/types}greetMee> can not be found in the schemas";
             assertTrue("Fail to create java parameter exception should be thrown",
-                       e.getMessage().indexOf("Failed to create java parameter") > -1);
+                       e.getMessage().indexOf(expectedErrorMsg) > -1);
         }
 
     }
@@ -859,6 +863,17 @@
         File file = new File(output, "org/mytest");
         assertEquals(13, file.list().length);
         
+    }
+    @Test
+    public void testCxf1137() {
+        try {
+            env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/cxf1137/helloWorld.wsdl"));
+            processor.setContext(env);
+            processor.execute();
+            fail("The wsdl is not a valid wsdl, see cxf-1137");
+        } catch (Exception e) {
+            assertTrue(e.getMessage().indexOf("Summary:  Failures: 5, Warnings: 0") != -1);
+        }
     }
     
     @Test

Modified: incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java?rev=590557&r1=590556&r2=590557&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java (original)
+++ incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java Tue Oct 30 21:47:13 2007
@@ -970,8 +970,10 @@
             processor.setContext(env);
             processor.execute();
         } catch (Exception e) {
+            String expectedMsg = "Invalid WSDL, Operation notify in PortType " 
+                + "{http://services.medial.com.br/echo}EchoNotification not request-response or one-way";
             assertTrue("Invalid wsdl should be diagnosed", e.getMessage()
-                .indexOf("Invalid WSDL,wsdl:operation") > -1);
+                .indexOf(expectedMsg) > -1);
         }
     }
 

Added: incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1137/helloWorld.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1137/helloWorld.wsdl?rev=590557&view=auto
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1137/helloWorld.wsdl (added)
+++ incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1137/helloWorld.wsdl Tue Oct 30 21:47:13 2007
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you 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.
+-->
+<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+		  xmlns:ns1="http://schemas.xmlsoap.org/soap/http"
+		  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+		  xmlns:tns="http://company.hw.demo/"
+		  xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="HelloWorld"
+		  targetNamespace="http://company.hw.demo/">
+    <wsdl:types>
+	<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+		   xmlns="http://company.hw.demo/"
+		   attributeFormDefault="unqualified"
+		   elementFormDefault="unqualified"
+		   targetNamespace="http://company.hw.demo/">
+	    <xs:complexType name="response">
+		<xs:sequence>
+		    <xs:element minOccurs="0" name="a" type="xs:string" />
+		    <xs:element minOccurs="0" name="b" type="xs:string" />
+		</xs:sequence>
+	    </xs:complexType>
+	    <xs:complexType name="request">
+		<xs:sequence>
+		    <xs:element minOccurs="0" name="a" type="xs:string" />
+		    <xs:element minOccurs="0" name="b" type="xs:string" />
+		</xs:sequence>
+	    </xs:complexType>
+	    <xs:element name="CustomException" type="CustomException" />
+	    <xs:complexType name="CustomException">
+		<xs:sequence>
+		    <xs:element name="a" nillable="true" type="xs:string" />
+		    <xs:element name="b" nillable="true" type="xs:string" />
+		    <xs:element name="message" nillable="true"
+				type="xs:string" />
+		</xs:sequence>
+	    </xs:complexType>
+	    <xs:element name="sayHi" type="sayHi" />
+	    <xs:complexType name="sayHi">
+		<xs:sequence>
+		    <xs:element minOccurs="0" name="arg0" type="request" />
+		</xs:sequence>
+	    </xs:complexType>
+	    <xs:element name="sayHiResponse" type="sayHiResponse" />
+	    <xs:complexType name="sayHiResponse">
+		<xs:sequence>
+		    <xs:element minOccurs="0" name="return" type="response" />
+		</xs:sequence>
+	    </xs:complexType>
+	</xs:schema>
+    </wsdl:types>
+    <wsdl:message name="sayHi">
+	<wsdl:part element="tns:sayHi" name="parameters"></wsdl:part>
+    </wsdl:message>
+    <wsdl:message name="CustomException">
+	<wsdl:part element="tns:CustomException" name="CustomException">
+	</wsdl:part>
+    </wsdl:message>
+    <wsdl:message name="sayHiResponse">
+	<wsdl:part element="tns:sayHiResponse" name="result"></wsdl:part>
+    </wsdl:message>
+    <wsdl:portType name="HelloWorldPortType">
+	<wsdl:operation name="sayHi">
+	    <wsdl:input message="tns:sayHi" name="sayHi"></wsdl:input>
+	    <wsdl:output message="tns:sayHiResponse"
+			 name="sayHiResponse">
+	    </wsdl:output>
+	    <wsdl:fault message="tns:CustomException"
+			name="CustomException">
+	    </wsdl:fault>
+	</wsdl:operation>
+    </wsdl:portType>
+    <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
+	<soap:binding style="document"
+		      transport="http://schemas.xmlsoap.org/soap/http" />
+	<wsdl:operation name="sayHi">
+	    <soap:operation soapAction="" style="document" />
+	    <wsdl:input name="sayHi">
+		<soap:body use="literal" />
+	    </wsdl:input>
+	    <wsdl:output name="sayHiResponse">
+		<soap:body use="literal" />
+	    </wsdl:output>
+	    <wsdl:fault name="CustomException">
+		<soap:fault name="CustomException" use="literal" />
+	    </wsdl:fault>
+	</wsdl:operation>
+    </wsdl:binding>
+    <wsdl:service name="HelloWorldService">
+	<wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldPort">
+	    <soap:address location="http://localhost:8080/helloWorld" />
+	</wsdl:port>
+    </wsdl:service>
+</wsdl:definitions>
\ No newline at end of file

Modified: incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/xml_format_root.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/xml_format_root.wsdl?rev=590557&r1=590556&r2=590557&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/xml_format_root.wsdl (original)
+++ incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/xml_format_root.wsdl Tue Oct 30 21:47:13 2007
@@ -41,6 +41,11 @@
     <wsdl:part element="tns:requestType" name="me"/>
   </wsdl:message>
 
+  <wsdl:message name="greetMeResponse">
+    <wsdl:part element="tns:responseType" name="theResponse"/>
+  </wsdl:message>
+
+
   <wsdl:portType name="Greeter">
     <wsdl:operation name="sayHi">
       <wsdl:input message="tns:sayHiRequest" name="sayHiRequest"/>



Mime
View raw message