[jbossws-commits] JBossWS SVN: r1575 - in branches/tdiesler/trunk/src: main/java/org/jboss/ws/common main/java/org/jboss/ws/common/umdm main/java/org/jboss/ws/common/wsdl main/java/org/jboss/ws/core/metadata/builder/jaxws main/java/org/jboss/ws/core/server main/java/org/jboss/ws/integration/jboss50 main/java/org/jboss/ws/tools main/java/org/jboss/ws/tools/helpers test/java/org/jboss/test/ws/common/wsdl11 test/java/org/jboss/test/ws/jaxrpc/jbws1068 test/java/org/jboss/test/ws/jaxrpc/jbws1190 test/java/org/jboss/test/ws/jaxrpc/jbws958 test/java/org/jboss/test/ws/jaxrpc/webserviceref test/java/org/jboss/test/ws/jaxrpc/wseventing test/java/org/jboss/test/ws/jaxws/context test/java/org/jboss/test/ws/jaxws/endpoint test/java/org/jboss/test/ws/jaxws/jbws1190 test/java/org/jboss/test/ws/jaxws/jbws860 test/java/org/jboss/test/ws/jaxws/jbws944 test/java/org/jboss/test/ws/jaxws/jsr181/webservice test/java/org/jboss/test/ws/jaxws/provider test/java/org/jboss/test/ws/jaxws/samples/jsr181ejb test! /java/org/jboss/test/ws/jaxws/samples/jsr181pojo test/java/org/jboss/test/ws/jaxws/samples/retail test/java/org/jboss/test/ws/jaxws/webserviceref test/java/org/jboss/test/ws/tools test/java/org/jboss/test/ws/tools/holders test/java/org/jboss/test/ws/tools/validation

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Wed Dec 6 09:17:27 EST 2006


Author: thomas.diesler at jboss.com
Date: 2006-12-06 09:17:04 -0500 (Wed, 06 Dec 2006)
New Revision: 1575

Added:
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/wsdl/
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/wsdl/WSDL11DefinitionFactory.java
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/wsdl/WSDL11Reader.java
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/wsdl/WSDL11Writer.java
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/wsdl/WSDLDefinitionsFactory.java
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/wsdl/WSDLLocatorImpl.java
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/wsdl/WSDLWriter.java
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/wsdl/WSDLWriterResolver.java
Removed:
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/wsdl/WSDL11DefinitionFactory.java
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/wsdl/WSDL11Reader.java
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/wsdl/WSDL11Writer.java
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/wsdl/WSDLDefinitionsFactory.java
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/wsdl/WSDLLocatorImpl.java
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/wsdl/WSDLWriter.java
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/wsdl/
Modified:
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/umdm/ServiceMetaData.java
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/WSDLFilePublisher.java
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceRefHandler.java
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/JavaToWSDL.java
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/WSDLToJava.java
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/helpers/ToolsHelper.java
   branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/wsdl11/MicrosoftGeneratedWSDLTestCase.java
   branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/wsdl11/MultiSchemaTestCase.java
   branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/wsdl11/SimpleFileImportTestCase.java
   branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/wsdl11/WSDL11TestCase.java
   branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/wsdl11/WSDLTypesTestCase.java
   branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/jbws1068/JBWS1068TestCase.java
   branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/jbws1190/TestEndpointImpl.java
   branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/jbws958/JBWS958TestCase.java
   branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/webserviceref/WebServiceRefClientTestCase.java
   branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/webserviceref/WebServiceRefEJBTestCase.java
   branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/webserviceref/WebServiceRefServletTestCase.java
   branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wseventing/DIIClientTestCase.java
   branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wseventing/EventingSupport.java
   branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/context/WebServiceContextTestCase.java
   branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointTestCase.java
   branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1190/TestEndpointImpl.java
   branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws860/JBWS860TestCase.java
   branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws944/JBWS944TestCase.java
   branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jsr181/webservice/JSR181WebServiceBase.java
   branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderJAXBTestCase.java
   branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderMessageTestCase.java
   branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderPayloadTestCase.java
   branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/jsr181ejb/JSR181WebServiceEJB3TestCase.java
   branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/jsr181pojo/JSR181WebServiceJSETestCase.java
   branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/RetailSampleTestCase.java
   branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/WebServiceRefClientTestCase.java
   branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/WebServiceRefEJB3TestCase.java
   branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/WebServiceRefServletTestCase.java
   branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/tools/WSDL11ToJavaTestCase.java
   branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/tools/WSDL11ToWSDL20TestCase.java
   branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/tools/WSToolsTest.java
   branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/tools/holders/StandardHoldersTestCase.java
   branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/tools/validation/WSDL11ValidationTestCase.java
Log:


Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/umdm/ServiceMetaData.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/umdm/ServiceMetaData.java	2006-12-06 14:12:50 UTC (rev 1574)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/umdm/ServiceMetaData.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -48,8 +48,8 @@
 import org.jboss.ws.common.metadata.wsdl.WSDLUtils;
 import org.jboss.ws.common.metadata.wsdl.xmlschema.JBossXSModel;
 import org.jboss.ws.common.umdm.HandlerMetaData.HandlerType;
+import org.jboss.ws.common.wsdl.WSDLDefinitionsFactory;
 import org.jboss.ws.core.metadata.wsse.WSSecurityConfiguration;
-import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
 import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
 
 /**

Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/wsdl (from rev 1573, branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/wsdl)

Deleted: branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/wsdl/WSDL11DefinitionFactory.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/wsdl/WSDL11DefinitionFactory.java	2006-12-06 14:11:26 UTC (rev 1573)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/wsdl/WSDL11DefinitionFactory.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -1,96 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.ws.tools.wsdl;
-
-// $Id$
-
-import java.net.URL;
-
-import javax.wsdl.Definition;
-import javax.wsdl.WSDLException;
-import javax.wsdl.factory.WSDLFactory;
-import javax.wsdl.xml.WSDLReader;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.common.utils.JBossWSEntityResolver;
-import org.xml.sax.EntityResolver;
-
-import com.ibm.wsdl.xml.WSDLReaderImpl;
-
-/**
- * A factory that creates a WSDL-1.1 <code>Definition</code> from an URL.
- *
- * @author Thomas.Diesler at jboss.org
- * @since 15-April-2004
- */
-public class WSDL11DefinitionFactory
-{
-   // provide logging
-   private static Logger log = Logger.getLogger(WSDL11DefinitionFactory.class);
-
-   // This feature is set by default in wsdl4j, it means the object structore contains the imported arguments
-   public static final String FEATURE_IMPORT_DOCUMENTS = "javax.wsdl.importDocuments";
-   // Set this feature for additional debugging output
-   public static final String FEATURE_VERBOSE = "javax.wsdl.verbose";
-
-   // The WSDLReader that is used by this factory
-   private WSDLReader wsdlReader;
-
-   // Hide constructor
-   private WSDL11DefinitionFactory() throws WSDLException
-   {
-      WSDLFactory wsdlFactory = WSDLFactory.newInstance();
-      wsdlReader = wsdlFactory.newWSDLReader();
-      wsdlReader.setFeature(WSDL11DefinitionFactory.FEATURE_VERBOSE, false);
-   }
-
-   /** Create a new instance of a wsdl factory */
-   public static WSDL11DefinitionFactory newInstance() throws WSDLException
-   {
-      return new WSDL11DefinitionFactory();
-   }
-
-   /** Set a feature on the underlying reader */
-   public void setFeature(String name, boolean value) throws IllegalArgumentException
-   {
-      wsdlReader.setFeature(name, value);
-   }
-
-   /**
-    * Read the wsdl document from the given URL
-    */
-   public Definition parse(URL wsdlLocation) throws WSDLException
-   {
-      if (wsdlLocation == null)
-         throw new IllegalArgumentException("URL cannot be null");
-
-      log.trace("parse: " + wsdlLocation.toExternalForm());
-      
-      EntityResolver entityResolver = new JBossWSEntityResolver();
-      
-      // Set EntityResolver in patched version of wsdl4j-1.5.2jboss
-      ((WSDLReaderImpl)wsdlReader).setEntityResolver(entityResolver);
-      
-      Definition wsdlDefinition = wsdlReader.readWSDL(new WSDLLocatorImpl(entityResolver, wsdlLocation));
-      return wsdlDefinition;
-   }
-}

Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/wsdl/WSDL11DefinitionFactory.java (from rev 1574, branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/wsdl/WSDL11DefinitionFactory.java)
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/wsdl/WSDL11DefinitionFactory.java	2006-12-06 14:12:50 UTC (rev 1574)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/wsdl/WSDL11DefinitionFactory.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -0,0 +1,96 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.ws.common.wsdl;
+
+// $Id$
+
+import java.net.URL;
+
+import javax.wsdl.Definition;
+import javax.wsdl.WSDLException;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.common.utils.JBossWSEntityResolver;
+import org.xml.sax.EntityResolver;
+
+import com.ibm.wsdl.xml.WSDLReaderImpl;
+
+/**
+ * A factory that creates a WSDL-1.1 <code>Definition</code> from an URL.
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 15-April-2004
+ */
+public class WSDL11DefinitionFactory
+{
+   // provide logging
+   private static Logger log = Logger.getLogger(WSDL11DefinitionFactory.class);
+
+   // This feature is set by default in wsdl4j, it means the object structore contains the imported arguments
+   public static final String FEATURE_IMPORT_DOCUMENTS = "javax.wsdl.importDocuments";
+   // Set this feature for additional debugging output
+   public static final String FEATURE_VERBOSE = "javax.wsdl.verbose";
+
+   // The WSDLReader that is used by this factory
+   private WSDLReader wsdlReader;
+
+   // Hide constructor
+   private WSDL11DefinitionFactory() throws WSDLException
+   {
+      WSDLFactory wsdlFactory = WSDLFactory.newInstance();
+      wsdlReader = wsdlFactory.newWSDLReader();
+      wsdlReader.setFeature(WSDL11DefinitionFactory.FEATURE_VERBOSE, false);
+   }
+
+   /** Create a new instance of a wsdl factory */
+   public static WSDL11DefinitionFactory newInstance() throws WSDLException
+   {
+      return new WSDL11DefinitionFactory();
+   }
+
+   /** Set a feature on the underlying reader */
+   public void setFeature(String name, boolean value) throws IllegalArgumentException
+   {
+      wsdlReader.setFeature(name, value);
+   }
+
+   /**
+    * Read the wsdl document from the given URL
+    */
+   public Definition parse(URL wsdlLocation) throws WSDLException
+   {
+      if (wsdlLocation == null)
+         throw new IllegalArgumentException("URL cannot be null");
+
+      log.trace("parse: " + wsdlLocation.toExternalForm());
+      
+      EntityResolver entityResolver = new JBossWSEntityResolver();
+      
+      // Set EntityResolver in patched version of wsdl4j-1.5.2jboss
+      ((WSDLReaderImpl)wsdlReader).setEntityResolver(entityResolver);
+      
+      Definition wsdlDefinition = wsdlReader.readWSDL(new WSDLLocatorImpl(entityResolver, wsdlLocation));
+      return wsdlDefinition;
+   }
+}

Deleted: branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/wsdl/WSDL11Reader.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Reader.java	2006-12-06 14:11:26 UTC (rev 1573)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/wsdl/WSDL11Reader.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -1,1219 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ws.tools.wsdl;
-
-// $Id$
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.wsdl.Binding;
-import javax.wsdl.BindingInput;
-import javax.wsdl.BindingOperation;
-import javax.wsdl.BindingOutput;
-import javax.wsdl.Definition;
-import javax.wsdl.Fault;
-import javax.wsdl.Import;
-import javax.wsdl.Input;
-import javax.wsdl.Message;
-import javax.wsdl.Operation;
-import javax.wsdl.Output;
-import javax.wsdl.Part;
-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.mime.MIMEContent;
-import javax.wsdl.extensions.mime.MIMEMultipartRelated;
-import javax.wsdl.extensions.mime.MIMEPart;
-import javax.wsdl.extensions.schema.Schema;
-import javax.wsdl.extensions.soap.SOAPAddress;
-import javax.wsdl.extensions.soap.SOAPBinding;
-import javax.wsdl.extensions.soap.SOAPBody;
-import javax.wsdl.extensions.soap.SOAPHeader;
-import javax.wsdl.extensions.soap.SOAPOperation;
-import javax.xml.namespace.QName;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.common.Constants;
-import org.jboss.ws.common.WSException;
-import org.jboss.ws.common.jaxrpc.Style;
-import org.jboss.ws.common.metadata.wsdl.NCName;
-import org.jboss.ws.common.metadata.wsdl.WSDLBinding;
-import org.jboss.ws.common.metadata.wsdl.WSDLBindingMessageReference;
-import org.jboss.ws.common.metadata.wsdl.WSDLBindingOperation;
-import org.jboss.ws.common.metadata.wsdl.WSDLBindingOperationInput;
-import org.jboss.ws.common.metadata.wsdl.WSDLBindingOperationOutput;
-import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.common.metadata.wsdl.WSDLEndpoint;
-import org.jboss.ws.common.metadata.wsdl.WSDLInterface;
-import org.jboss.ws.common.metadata.wsdl.WSDLInterfaceFault;
-import org.jboss.ws.common.metadata.wsdl.WSDLInterfaceOperation;
-import org.jboss.ws.common.metadata.wsdl.WSDLInterfaceOperationInput;
-import org.jboss.ws.common.metadata.wsdl.WSDLInterfaceOperationOutfault;
-import org.jboss.ws.common.metadata.wsdl.WSDLInterfaceOperationOutput;
-import org.jboss.ws.common.metadata.wsdl.WSDLMIMEPart;
-import org.jboss.ws.common.metadata.wsdl.WSDLProperty;
-import org.jboss.ws.common.metadata.wsdl.WSDLRPCPart;
-import org.jboss.ws.common.metadata.wsdl.WSDLRPCSignatureItem;
-import org.jboss.ws.common.metadata.wsdl.WSDLSOAPHeader;
-import org.jboss.ws.common.metadata.wsdl.WSDLService;
-import org.jboss.ws.common.metadata.wsdl.WSDLTypes;
-import org.jboss.ws.common.metadata.wsdl.WSDLUtils;
-import org.jboss.ws.common.metadata.wsdl.XSModelTypes;
-import org.jboss.ws.common.metadata.wsdl.WSDLRPCSignatureItem.Direction;
-import org.jboss.ws.common.metadata.wsdl.xmlschema.JBossXSModel;
-import org.jboss.ws.common.metadata.wsdl.xsd.SchemaUtils;
-import org.jboss.ws.common.utils.DOMUtils;
-import org.jboss.ws.common.utils.DOMWriter;
-import org.jboss.ws.tools.JavaToXSD;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-
-/**
- * A helper that translates a WSDL-1.1 object graph into a WSDL-2.0 object graph.
- *
- * @author Thomas.Diesler at jboss.org
- * @author Anil.Saldhana at jboss.org
- * @author <a href="jason.greene at jboss.com">Jason T. Greene</a>
- * @since 10-Oct-2004
- */
-public class WSDL11Reader
-{
-   // provide logging
-   private static final Logger log = Logger.getLogger(WSDL11Reader.class);
-
-   private static QName SOAP12_BINDING = new QName(Constants.NS_SOAP12, "binding");
-   private static QName SOAP12_BODY = new QName(Constants.NS_SOAP12, "body");
-   private static QName SOAP12_OPERATION = new QName(Constants.NS_SOAP12, "operation");
-   private static QName SOAP12_ADDRESS = new QName(Constants.NS_SOAP12, "address");
-
-   private WSDLDefinitions destWsdl;
-
-   // Maps wsdl message parts to their corresponding element names
-   private Map<String, QName> messagePartToElementMap = new HashMap<String, QName>();
-
-   // Map of <ns,URL> for schemalocation keyed by namespace
-   private Map<String, URL> schemaLocationsMap = new HashMap<String, URL>();
-
-   private LinkedHashMap<QName, Binding> allBindings;
-   private LinkedHashMap<QName, Binding> portTypeBindings;
-
-   // Temporary files used by this reader.
-   private List<File> tempFiles = new ArrayList<File>();
-
-   /**
-    * Takes a WSDL11 Definition element and converts into
-    * our object graph that has been developed for WSDL20
-    *
-    * @param srcWsdl The src WSDL11 definition
-    * @param wsdlLoc The source location, if null we cannot process imports or includes
-    */
-   public WSDLDefinitions processDefinition(Definition srcWsdl, URL wsdlLoc) throws IOException
-   {
-      log.trace("processDefinition: " + wsdlLoc);
-
-      destWsdl = new WSDLDefinitions();
-      destWsdl.setWsdlTypes(new XSModelTypes());
-      destWsdl.setWsdlOneOneDefinition(srcWsdl);
-      destWsdl.setWsdlNamespace(Constants.NS_WSDL11);
-
-      processNamespaces(srcWsdl);
-      processTypes(srcWsdl, wsdlLoc);
-      processServices(srcWsdl);
-
-      if (getAllDefinedBindings(srcWsdl).size() != destWsdl.getBindings().length)
-         processUnreachableBindings(srcWsdl);
-
-      cleanupTemporaryFiles();
-
-      return destWsdl;
-   }
-
-   private void cleanupTemporaryFiles()
-   {
-     for (File current : tempFiles)
-     {
-        current.delete();
-     }
-   }
-
-   // process all bindings not within service separetly
-   private void processUnreachableBindings(Definition srcWsdl)
-   {
-      log.trace("processUnreachableBindings");
-
-      Iterator it = getAllDefinedBindings(srcWsdl).values().iterator();
-      while (it.hasNext())
-      {
-         Binding srcBinding = (Binding)it.next();
-         QName srcQName = srcBinding.getQName();
-
-         WSDLBinding destBinding = destWsdl.getBinding(new NCName(srcQName));
-         if (destBinding == null)
-         {
-            processBinding(srcWsdl, srcBinding);
-         }
-      }
-   }
-
-   private void processNamespaces(Definition srcWsdl)
-   {
-      String targetNS = srcWsdl.getTargetNamespace();
-      destWsdl.setTargetNamespace(targetNS);
-
-      // Copy wsdl namespaces
-      Map nsMap = srcWsdl.getNamespaces();
-      Iterator iter = nsMap.entrySet().iterator();
-      while (iter.hasNext())
-      {
-         Map.Entry entry = (Map.Entry)iter.next();
-         String prefix = (String)entry.getKey();
-         String nsURI = (String)entry.getValue();
-         destWsdl.registerNamespaceURI(nsURI, prefix);
-      }
-   }
-
-   private void processTypes(Definition srcWsdl, URL wsdlLoc) throws IOException
-   {
-      log.trace("BEGIN processTypes: " + wsdlLoc);
-
-      WSDLTypes destTypes = destWsdl.getWsdlTypes();
-
-      Types srcTypes = srcWsdl.getTypes();
-      if (srcTypes != null && srcTypes.getExtensibilityElements().size() > 0)
-      {
-         List extElements = srcTypes.getExtensibilityElements();
-         int len = extElements.size();
-
-         for (int i = 0; i < len; i++)
-         {
-            ExtensibilityElement extElement = (ExtensibilityElement)extElements.get(i);
-
-            Element domElement;
-            if (extElement instanceof Schema)
-            {
-               domElement = ((Schema)extElement).getElement();
-            }
-            else if (extElement instanceof UnknownExtensibilityElement)
-            {
-               domElement = ((UnknownExtensibilityElement)extElement).getElement();
-            }
-            else
-            {
-               throw new WSException("Unsupported extensibility element: " + extElement);
-            }
-
-            Element domElementClone = (Element)domElement.cloneNode(true);
-            copyParentNamespaceDeclarations(domElementClone, domElement);
-
-            String localname = domElementClone.getLocalName();
-            try
-            {
-               if ("import".equals(localname))
-               {
-                  processSchemaImport(destTypes, wsdlLoc, domElementClone);
-               }
-               else if ("schema".equals(localname))
-               {
-                  processSchemaInclude(destTypes, wsdlLoc, domElementClone);
-               }
-               else
-               {
-                  throw new IllegalArgumentException("Unsuported schema element: " + localname);
-               }
-            }
-            catch (IOException e)
-            {
-               throw new WSException("Cannot extract schema definition", e);
-            }
-         }
-
-         if (len > 0)
-         {
-            JavaToXSD jxsd = new JavaToXSD();
-            JBossXSModel xsmodel = jxsd.parseSchema(schemaLocationsMap);
-            WSDLUtils.addSchemaModel(destTypes, destWsdl.getTargetNamespace(), xsmodel);
-         }
-      }
-      else
-      {
-         log.trace("Empty wsdl types element, processing imports");
-         Iterator it = srcWsdl.getImports().values().iterator();
-         while (it.hasNext())
-         {
-            List<Import> srcImports = (List<Import>)it.next();
-            for (Import srcImport : srcImports)
-            {
-               Definition impDefinition = srcImport.getDefinition();
-               String impLoc = impDefinition.getDocumentBaseURI();
-               processTypes(impDefinition, new URL(impLoc));
-            }
-         }
-      }
-
-      log.trace("END processTypes: " + wsdlLoc + "\n" + destTypes);
-   }
-
-   private void copyParentNamespaceDeclarations(Element destElement, Element srcElement)
-   {
-      Node parent = srcElement.getParentNode();
-      while (parent != null)
-      {
-         if (parent.hasAttributes())
-         {
-            NamedNodeMap attributes = parent.getAttributes();
-            for (int i = 0; i < attributes.getLength(); i++)
-            {
-               Attr attr = (Attr)attributes.item(i);
-               String name = attr.getName();
-               String value = attr.getValue();
-               if (name.startsWith("xmlns:") && destElement.hasAttribute(name) == false)
-                  destElement.setAttribute(name, value);
-            }
-         }
-         parent = parent.getParentNode();
-      }
-   }
-
-   private void processSchemaImport(WSDLTypes types, URL wsdlLoc, Element importEl) throws IOException
-   {
-      if (wsdlLoc == null)
-         throw new IllegalArgumentException("Cannot process import, parent location not set");
-
-      log.trace("processSchemaImport: " + wsdlLoc);
-
-      String location = getOptionalAttribute(importEl, "schemaLocation");
-      if (location == null)
-         throw new IllegalArgumentException("schemaLocation is null for xsd:import");
-
-      URL locationURL = getLocationURL(wsdlLoc, location);
-      Element rootElement = DOMUtils.parse(locationURL.openStream());
-      URL newloc = processSchemaInclude(types, locationURL, rootElement);
-      if (newloc != null)
-         importEl.setAttribute("schemaLocation", newloc.toExternalForm());
-   }
-
-   private URL processSchemaInclude(WSDLTypes types, URL wsdlLoc, Element schemaEl) throws IOException
-   {
-      if (wsdlLoc == null)
-         throw new IllegalArgumentException("Cannot process iclude, parent location not set");
-
-      File tmpFile = null;
-      if (wsdlLoc == null)
-         throw new IllegalArgumentException("Cannot process include, parent location not set");
-
-      log.trace("processSchemaInclude: " + wsdlLoc);
-
-      String schemaPrefix = schemaEl.getPrefix();
-
-      String importTag = (schemaPrefix == null) ? "import" : schemaPrefix + ":import";
-      Element importElement = schemaEl.getOwnerDocument().createElementNS(Constants.NS_SCHEMA_XSD, importTag);
-      importElement.setAttribute("namespace", Constants.URI_SOAP11_ENC);
-      schemaEl.insertBefore(importElement, DOMUtils.getFirstChildElement(schemaEl));
-
-      // Handle schema includes
-      Iterator it = DOMUtils.getChildElements(schemaEl, new QName(Constants.NS_SCHEMA_XSD, "include"));
-      while (it.hasNext())
-      {
-         Element includeEl = (Element)it.next();
-         String location = getOptionalAttribute(includeEl, "schemaLocation");
-         if (location == null)
-            throw new IllegalArgumentException("schemaLocation is null for xsd:include");
-
-         URL locationURL = getLocationURL(wsdlLoc, location);
-         Element rootElement = DOMUtils.parse(locationURL.openStream());
-         URL newloc = processSchemaInclude(types, locationURL, rootElement);
-         if (newloc != null)
-            includeEl.setAttribute("schemaLocation", newloc.toExternalForm());
-      }
-
-      String targetNS = getOptionalAttribute(schemaEl, "targetNamespace");
-      if (targetNS != null)
-      {
-         log.trace("processSchemaInclude: [targetNS=" + targetNS + ",parentURL=" + wsdlLoc + "]");
-
-         tmpFile = SchemaUtils.getSchemaTempFile(targetNS);
-         tempFiles.add(tmpFile);
-
-         FileWriter fwrite = new FileWriter(tmpFile);
-         new DOMWriter(fwrite).setPrettyprint(true).print(schemaEl);
-         fwrite.close();
-
-         schemaLocationsMap.put(targetNS, tmpFile.toURL());
-      }
-
-      // schema elements that have no target namespace are skipped
-      //
-      //  <xsd:schema>
-      //    <xsd:import namespace="http://org.jboss.webservice/example/types" schemaLocation="Hello.xsd"/>
-      //    <xsd:import namespace="http://org.jboss.webservice/example/types/arrays/org/jboss/test/webservice/admindevel" schemaLocation="subdir/HelloArr.xsd"/>
-      //  </xsd:schema>
-      if (targetNS == null)
-      {
-         log.trace("Schema element without target namespace in: " + wsdlLoc);
-      }
-
-      handleSchemaImports(schemaEl, wsdlLoc);
-
-      return tmpFile != null ? tmpFile.toURL() : null;
-   }
-
-   private void handleSchemaImports(Element schemaEl, URL wsdlLoc) throws MalformedURLException
-   {
-      if (wsdlLoc == null)
-         throw new IllegalArgumentException("Cannot process import, parent location not set");
-
-      Iterator it = DOMUtils.getChildElements(schemaEl, new QName(Constants.NS_SCHEMA_XSD, "import"));
-      while (it.hasNext())
-      {
-         Element includeEl = (Element)it.next();
-         String schemaLocation = getOptionalAttribute(includeEl, "schemaLocation");
-         String namespace = getOptionalAttribute(includeEl, "namespace");
-
-         log.trace("handleSchemaImport: [namespace=" + namespace + ",schemaLocation=" + schemaLocation + "]");
-
-         // Skip, let the entity resolver resolve these
-         if (namespace != null && schemaLocation != null)
-         {
-            URL currLoc = getLocationURL(wsdlLoc, schemaLocation);
-            schemaLocationsMap.put(namespace, currLoc);
-         }
-         else
-         {
-            log.trace("Skip schema import: [namespace=" + namespace + ",schemaLocation=" + schemaLocation + "]");
-         }
-      }
-   }
-
-   private URL getLocationURL(URL parentURL, String location) throws MalformedURLException
-   {
-      log.trace("getLocationURL: [location=" + location + ",parent=" + parentURL + "]");
-
-      URL locationURL = null;
-      try
-      {
-         locationURL = new URL(location);
-      }
-      catch (MalformedURLException e)
-      {
-         // ignore malformed URL
-      }
-
-      if (locationURL == null)
-      {
-         String parentProtocol = parentURL.getProtocol();
-         if (parentProtocol.equals("file") && !location.startsWith("/"))
-         {
-            String path = parentURL.toExternalForm();
-            path = path.substring(0, path.lastIndexOf("/"));
-            locationURL = new URL(path + "/" + location);
-         }
-         else if (parentProtocol.startsWith("http") && location.startsWith("/"))
-         {
-            String path = parentProtocol + "://" + parentURL.getHost() + ":" + parentURL.getPort();
-            locationURL = new URL(path + location);
-         }
-         else if (parentProtocol.equals("jar") && !location.startsWith("/"))
-         {
-            String path = parentURL.toExternalForm();
-            path = path.substring(0, path.lastIndexOf("/"));
-            locationURL = new URL(path + "/" + location);
-         }
-         else
-         {
-            throw new WSException("Unsupported schemaLocation: " + location);
-         }
-      }
-
-      log.trace("Modified schemaLocation: " + locationURL);
-      return locationURL;
-   }
-
-   private void processPortType(Definition srcWsdl, PortType srcPortType)
-   {
-      log.trace("processPortType: " + srcPortType.getQName());
-
-      QName qname = srcPortType.getQName();
-      NCName ncName = new NCName(qname);
-      if (destWsdl.getInterface(ncName) == null)
-      {
-         WSDLInterface destInterface = new WSDLInterface(destWsdl);
-         destInterface.setName(ncName);
-         destInterface.setQName(qname);
-
-         // eventing extensions
-         QName eventSourceProp = (QName)srcPortType.getExtensionAttribute(Constants.WSDL_ATTRIBUTE_WSE_EVENTSOURCE);
-         if (eventSourceProp != null && eventSourceProp.getLocalPart().equals(Boolean.TRUE.toString()))
-         {
-            destInterface.addProperty(new WSDLProperty(Constants.WSDL_PROPERTY_EVENTSOURCE, eventSourceProp.getLocalPart()));
-         }
-
-         destWsdl.addInterface(destInterface);
-
-         processPortTypeOperations(srcWsdl, destInterface, srcPortType);
-      }
-   }
-
-   private void processPortTypeOperations(Definition srcWsdl, WSDLInterface destInterface, PortType srcPortType)
-   {
-      Iterator itOperations = srcPortType.getOperations().iterator();
-      while (itOperations.hasNext())
-      {
-         Operation srcOperation = (Operation)itOperations.next();
-
-         WSDLInterfaceOperation destOperation = new WSDLInterfaceOperation(destInterface);
-         destOperation.setName(new NCName(srcOperation.getName()));
-         destOperation.setStyle(getOperationStyle(srcWsdl, srcPortType, srcOperation));
-
-         processOperationInput(srcWsdl, srcOperation, destOperation, srcPortType);
-         processOperationOutput(srcWsdl, srcOperation, destOperation, srcPortType);
-         processOperationFaults(srcOperation, destOperation, destInterface);
-
-         destInterface.addOperation(destOperation);
-      }
-   }
-
-   private void processOperationInput(Definition srcWsdl, Operation srcOperation, WSDLInterfaceOperation destOperation, PortType srcPortType)
-   {
-      Input srcInput = srcOperation.getInput();
-      if (srcInput != null)
-      {
-         Message srcMessage = srcInput.getMessage();
-         log.trace("processOperationInput: " + srcMessage.getQName());
-
-         QName wsaAction = (QName)srcInput.getExtensionAttribute(Constants.WSDL_ATTRIBUTE_WSA_ACTION);
-         if (wsaAction != null)
-            destOperation.addProperty(new WSDLProperty(Constants.WSDL_PROPERTY_ACTION_IN, wsaAction.getLocalPart()));
-
-         List<String> paramOrder = (List<String>) srcOperation.getParameterOrdering();
-         if (paramOrder != null)
-         {
-            for (String name : paramOrder)
-            {
-               if (srcMessage.getPart(name) != null)
-                  destOperation.addRpcSignatureItem(new WSDLRPCSignatureItem(name));
-            }
-         }
-
-         WSDLInterfaceOperationInput rpcInput = new WSDLInterfaceOperationInput(destOperation);
-         for (Part srcPart : (List<Part>) srcMessage.getOrderedParts(paramOrder))
-         {
-            if (Constants.URI_STYLE_IRI == destOperation.getStyle())
-            {
-               WSDLInterfaceOperationInput destInput = new WSDLInterfaceOperationInput(destOperation);
-               QName elementName = messagePartToElementName(srcWsdl, srcPortType, srcOperation, srcMessage, srcPart);
-               destInput.setElement(elementName);
-
-               //Lets remember the Message name
-               destInput.setMessageName(srcMessage.getQName());
-               destOperation.addProperty(new WSDLProperty(Constants.WSDL_PROPERTY_MESSAGE_NAME_IN, srcMessage.getQName().getLocalPart()));
-
-               destInput.setPartName(srcPart.getName());
-
-               destOperation.addInput(destInput);
-            }
-            else
-            {
-               // If we don't have a type then we aren't a valid RPC parameter
-               // This could happen on a header element, in which case the
-               // binding will pick it up
-               QName xmlType = srcPart.getTypeName();
-               if (xmlType != null)
-                  rpcInput.addChildPart(new WSDLRPCPart(srcPart.getName(), destWsdl.registerQName(xmlType)));
-               else
-                  messagePartToElementName(srcWsdl, srcPortType, srcOperation, srcMessage, srcPart);
-            }
-         }
-         if (Constants.URI_STYLE_RPC == destOperation.getStyle())
-         {
-            // This is really a place holder, but also the actual value used in
-            // WSDL 2.0 RPC bindings
-            rpcInput.setElement(destOperation.getQName());
-            rpcInput.setMessageName(srcMessage.getQName());
-            destOperation.addInput(rpcInput);
-         }
-      }
-   }
-
-   private void processOperationOutput(Definition srcWsdl, Operation srcOperation, WSDLInterfaceOperation destOperation, PortType srcPortType)
-   {
-      Output srcOutput = srcOperation.getOutput();
-      if (srcOutput == null)
-      {
-         destOperation.setPattern(Constants.WSDL20_PATTERN_IN_ONLY);
-         return;
-      }
-
-      Message srcMessage = srcOutput.getMessage();
-      log.trace("processOperationOutput: " + srcMessage.getQName());
-
-      destOperation.setPattern(Constants.WSDL20_PATTERN_IN_OUT);
-      QName wsaAction = (QName) srcOutput.getExtensionAttribute(Constants.WSDL_ATTRIBUTE_WSA_ACTION);
-      if (wsaAction != null)
-         destOperation.addProperty(new WSDLProperty(Constants.WSDL_PROPERTY_ACTION_OUT, wsaAction.getLocalPart()));
-
-      List<String> paramOrder = (List<String>) srcOperation.getParameterOrdering();
-      if (paramOrder != null)
-      {
-         for (String name : paramOrder)
-         {
-            if (srcMessage.getPart(name) != null)
-            {
-               WSDLRPCSignatureItem item = destOperation.getRpcSignatureitem(name);
-               if (item != null)
-                  item.setDirection(Direction.INOUT);
-               else
-                  destOperation.addRpcSignatureItem(new WSDLRPCSignatureItem(name, Direction.OUT));
-            }
-         }
-      }
-
-      WSDLInterfaceOperationOutput rpcOutput = new WSDLInterfaceOperationOutput(destOperation);
-      for (Part srcPart : (List<Part>) srcMessage.getOrderedParts(null))
-      {
-         if (Constants.URI_STYLE_IRI == destOperation.getStyle())
-         {
-            WSDLInterfaceOperationOutput destOutput = new WSDLInterfaceOperationOutput(destOperation);
-
-            QName elementName = messagePartToElementName(srcWsdl, srcPortType, srcOperation, srcMessage, srcPart);
-            destOutput.setElement(elementName);
-
-            // Lets remember the Message name
-            destOutput.setMessageName(srcMessage.getQName());
-            destOperation.addProperty(new WSDLProperty(Constants.WSDL_PROPERTY_MESSAGE_NAME_OUT, srcMessage.getQName()
-                  .getLocalPart()));
-
-            // Remember the original part name
-            destOutput.setPartName(srcPart.getName());
-
-            destOperation.addOutput(destOutput);
-         }
-         else
-         {
-            // If we don't have a type then we aren't a valid RPC parameter
-            // This could happen on a header element, in which case the
-            // binding will pick it up
-            QName xmlType = srcPart.getTypeName();
-            if (xmlType != null)
-               rpcOutput.addChildPart(new WSDLRPCPart(srcPart.getName(), destWsdl.registerQName(xmlType)));
-            else
-               messagePartToElementName(srcWsdl, srcPortType, srcOperation, srcMessage, srcPart);
-         }
-      }
-
-      if (Constants.URI_STYLE_RPC == destOperation.getStyle())
-      {
-         // This is really a place holder, but also the actual value used in
-         // WSDL 2.0 RPC bindings
-         QName name = destOperation.getQName();
-         rpcOutput.setElement(new QName(name.getNamespaceURI(), name.getLocalPart() + "Response"));
-         rpcOutput.setMessageName(srcMessage.getQName());
-         destOperation.addOutput(rpcOutput);
-      }
-   }
-
-   private void processOperationFaults(Operation srcOperation, WSDLInterfaceOperation destOperation, WSDLInterface destInterface)
-   {
-
-      Map faults = srcOperation.getFaults();
-      Iterator itFaults = faults.values().iterator();
-      while (itFaults.hasNext())
-      {
-         Fault srcFault = (Fault)itFaults.next();
-         processOperationFault(destOperation, destInterface, srcFault);
-      }
-   }
-
-   private void processOperationFault(WSDLInterfaceOperation destOperation, WSDLInterface destInterface, Fault srcFault)
-   {
-      String faultName = srcFault.getName();
-      log.trace("processOperationFault: " + faultName);
-
-      WSDLInterfaceFault destFault = new WSDLInterfaceFault(destInterface);
-      NCName ncName = new NCName(faultName);
-      destFault.setName(ncName);
-
-      Message message = srcFault.getMessage();
-      QName messageName = message.getQName();
-
-      Map partsMap = message.getParts();
-      if (partsMap.size() != 1)
-         throw new WSException("Unsupported number of fault parts in message " + messageName);
-
-      Part part = (Part)partsMap.values().iterator().next();
-      QName xmlName = part.getElementName();
-
-      if (xmlName != null)
-      {
-         destFault.setElement(xmlName);
-      }
-      else
-      {
-         destFault.setElement(messageName);
-         log.warn("Unsupported fault message part in message: " + messageName);
-      }
-
-      WSDLInterfaceFault prevFault = destInterface.getFault(ncName);
-      if (prevFault != null && prevFault.getName().equals(ncName) == false)
-         throw new WSException("Fault name must be unique: " + faultName);
-
-      // Add the fault to the interface
-      destInterface.addFault(destFault);
-
-      // Add the fault refererence to the operation
-      WSDLInterfaceOperationOutfault opOutFault = new WSDLInterfaceOperationOutfault(destOperation);
-      opOutFault.setRef(new QName(destWsdl.getTargetNamespace(), faultName));
-      destOperation.addOutfault(opOutFault);
-   }
-
-   /** Translate the message part name into an XML element name.
-    */
-   private QName messagePartToElementName(Definition srcWsdl, PortType srcPortType, Operation srcOperation, Message srcMessage, Part srcPart)
-   {
-      // <part name="param" element="tns:SomeType" />
-      QName xmlName = srcPart.getElementName();
-
-      // <part name="param" type="xsd:string" />
-      if (xmlName == null)
-         xmlName = new QName(srcPart.getName());
-
-      xmlName = destWsdl.registerQName(xmlName);
-      String key = srcMessage.getQName() + "->" + srcPart.getName();
-      messagePartToElementMap.put(key, xmlName);
-
-      return xmlName;
-   }
-
-   private BindingOperation getBindingOperation(Definition srcWsdl, PortType srcPortType, Operation srcOperation)
-   {
-      Binding srcBinding = getPortTypeBindings(srcWsdl).get(srcPortType.getQName());
-
-      if (srcBinding == null)
-         throw new WSException("Cannot find binding for: " + srcPortType.getQName());
-
-      String srcOperationName = srcOperation.getName();
-      BindingOperation srcBindingOperation = srcBinding.getBindingOperation(srcOperationName, null, null);
-      if (srcBindingOperation == null)
-         throw new WSException("Cannot find binding operation for: " + srcOperationName);
-      return srcBindingOperation;
-   }
-
-   private String getOperationStyle(Definition srcWsdl, PortType srcPortType, Operation srcOperation)
-   {
-      Binding srcBinding = getPortTypeBindings(srcWsdl).get(srcPortType.getQName());
-      BindingOperation srcBindingOperation = getBindingOperation(srcWsdl, srcPortType, srcOperation);
-
-      String operationStyle = null;
-      List<ExtensibilityElement> extList = srcBindingOperation.getExtensibilityElements();
-      for (ExtensibilityElement extElement : extList)
-      {
-         QName elementType = extElement.getElementType();
-         if (extElement instanceof SOAPOperation)
-         {
-            SOAPOperation soapOp = (SOAPOperation)extElement;
-            operationStyle = soapOp.getStyle();
-         }
-         else if (SOAP12_OPERATION.equals(elementType))
-         {
-            Element domElement = ((UnknownExtensibilityElement)extElement).getElement();
-            operationStyle = getOptionalAttribute(domElement, "style");
-         }
-      }
-
-      if (operationStyle == null)
-      {
-         for (ExtensibilityElement extElement : (List<ExtensibilityElement>) srcBinding.getExtensibilityElements())
-         {
-            QName elementType = extElement.getElementType();
-            if (extElement instanceof SOAPBinding)
-            {
-               SOAPBinding soapBinding = (SOAPBinding) extElement;
-               operationStyle = soapBinding.getStyle();
-            }
-            else if (SOAP12_BINDING.equals(elementType))
-            {
-               Element domElement = ((UnknownExtensibilityElement) extElement).getElement();
-               operationStyle = getOptionalAttribute(domElement, "style");
-            }
-         }
-      }
-
-      return  ("rpc".equals(operationStyle)) ? Constants.URI_STYLE_RPC : Constants.URI_STYLE_IRI;
-   }
-
-   private void processBinding(Definition srcWsdl, Binding srcBinding)
-   {
-      QName srcBindingQName = srcBinding.getQName();
-      log.trace("processBinding: " + srcBindingQName);
-
-      NCName ncName = new NCName(srcBindingQName);
-      if (destWsdl.getBinding(ncName) == null)
-      {
-         PortType srcPortType = srcBinding.getPortType();
-         if (srcPortType == null)
-            throw new WSException("Cannot find port type for binding: " + ncName);
-
-         processPortType(srcWsdl, srcPortType);
-
-         WSDLBinding destBinding = new WSDLBinding(destWsdl);
-         destBinding.setQName(srcBindingQName);
-         destBinding.setName(ncName);
-         destBinding.setInterfaceName(srcPortType.getQName());
-
-         String bindingStyle = Style.getDefaultStyle().toString();
-         List<ExtensibilityElement> extList = srcBinding.getExtensibilityElements();
-         for (ExtensibilityElement extElement : extList)
-         {
-            QName elementType = extElement.getElementType();
-            if (extElement instanceof SOAPBinding)
-            {
-               destBinding.setType(Constants.NS_SOAP11);
-               SOAPBinding soapBinding = (SOAPBinding)extElement;
-               bindingStyle = soapBinding.getStyle();
-            }
-            else if (SOAP12_BINDING.equals(elementType))
-            {
-               destBinding.setType(Constants.NS_SOAP12);
-               Element domElement = ((UnknownExtensibilityElement)extElement).getElement();
-               bindingStyle = getOptionalAttribute(domElement, "style");
-            }
-         }
-         destWsdl.addBinding(destBinding);
-         processBindingOperations(destBinding, srcBinding, bindingStyle);
-      }
-   }
-
-   private Map<QName, Binding> getPortTypeBindings(Definition srcWsdl)
-   {
-      getAllDefinedBindings(srcWsdl);
-      return portTypeBindings;
-   }
-
-   private Map<QName, Binding> getAllDefinedBindings(Definition srcWsdl)
-   {
-      if (allBindings != null)
-         return allBindings;
-
-      allBindings = new LinkedHashMap<QName, Binding>();
-      portTypeBindings = new LinkedHashMap<QName, Binding>();
-      Map srcBindings = srcWsdl.getBindings();
-      Iterator itBinding = srcBindings.values().iterator();
-      while (itBinding.hasNext())
-      {
-         Binding srcBinding = (Binding)itBinding.next();
-         allBindings.put(srcBinding.getQName(), srcBinding);
-         portTypeBindings.put(srcBinding.getPortType().getQName(), srcBinding);
-      }
-
-      // Bindings not available when pulled in through <wsdl:import>
-      // http://sourceforge.net/tracker/index.php?func=detail&aid=1240323&group_id=128811&atid=712792
-      Iterator itService = srcWsdl.getServices().values().iterator();
-      while (itService.hasNext())
-      {
-         Service srcService = (Service)itService.next();
-         Iterator itPort = srcService.getPorts().values().iterator();
-         while (itPort.hasNext())
-         {
-            Port srcPort = (Port)itPort.next();
-            Binding srcBinding = srcPort.getBinding();
-            allBindings.put(srcBinding.getQName(), srcBinding);
-            portTypeBindings.put(srcBinding.getPortType().getQName(), srcBinding);
-         }
-      }
-
-      return allBindings;
-   }
-
-   private void processBindingOperations(WSDLBinding destBinding, Binding srcBinding, String bindingStyle)
-   {
-      Iterator it = srcBinding.getBindingOperations().iterator();
-      while (it.hasNext())
-      {
-         BindingOperation srcBindingOperation = (BindingOperation)it.next();
-         processBindingOperation(destBinding, bindingStyle, srcBindingOperation);
-      }
-   }
-
-   private void processBindingOperation(WSDLBinding destBinding, String bindingStyle, BindingOperation srcBindingOperation)
-   {
-      String srcBindingName = srcBindingOperation.getName();
-      log.trace("processBindingOperation: " + srcBindingName);
-
-      WSDLInterface destInterface = destBinding.getInterface();
-      String namespaceURI = destInterface.getQName().getNamespaceURI();
-
-      WSDLBindingOperation destBindingOperation = new WSDLBindingOperation(destBinding);
-      QName refQName = new QName(namespaceURI, srcBindingName);
-      destBindingOperation.setRef(refQName);
-      destBinding.addOperation(destBindingOperation);
-
-      String opName = srcBindingName;
-      WSDLInterfaceOperation destIntfOperation = destInterface.getOperation(new NCName(opName));
-
-      // Process soap:operation at soapAction, soap:operation at style
-      List<ExtensibilityElement> extList = srcBindingOperation.getExtensibilityElements();
-      for (ExtensibilityElement extElement : extList)
-      {
-         QName elementType = extElement.getElementType();
-         if (extElement instanceof SOAPOperation)
-         {
-            SOAPOperation soapOp = (SOAPOperation)extElement;
-            destBindingOperation.setSOAPAction(soapOp.getSoapActionURI());
-         }
-         else if (SOAP12_OPERATION.equals(elementType))
-         {
-            Element domElement = ((UnknownExtensibilityElement)extElement).getElement();
-            destBindingOperation.setSOAPAction(getOptionalAttribute(domElement, "soapAction"));
-         }
-      }
-
-      BindingInput srcBindingInput = srcBindingOperation.getBindingInput();
-      if (srcBindingInput != null)
-      {
-         processBindingInput(destBindingOperation, destIntfOperation, srcBindingOperation, srcBindingInput);
-      }
-
-      BindingOutput srcBindingOutput = srcBindingOperation.getBindingOutput();
-      if (srcBindingOutput != null)
-      {
-         processBindingOutput(destBindingOperation, destIntfOperation, srcBindingOperation, srcBindingOutput);
-      }
-   }
-
-   interface ReferenceCallback
-   {
-      void removeReference(QName element);
-      void removeRPCPart(String partName);
-      QName getXmlType(String partName);
-   }
-
-   private void processBindingInput(WSDLBindingOperation destBindingOperation, final WSDLInterfaceOperation destIntfOperation, final BindingOperation srcBindingOperation, BindingInput srcBindingInput)
-   {
-      log.trace("processBindingInput");
-
-      QName soap11Body = new QName(Constants.NS_SOAP11, "body");
-      List<ExtensibilityElement> extList = srcBindingInput.getExtensibilityElements();
-      WSDLBindingOperationInput input = new WSDLBindingOperationInput(destBindingOperation);
-      destBindingOperation.addInput(input);
-
-      ReferenceCallback cb = new ReferenceCallback()
-      {
-         public QName getXmlType(String partName)
-         {
-            return srcBindingOperation.getOperation().getInput().getMessage().getPart(partName).getTypeName();
-         }
-
-         public void removeReference(QName element)
-         {
-            WSDLInterfaceOperationInput destIntfInput = destIntfOperation.getInput(element);
-            if (destIntfInput == null)
-               destIntfOperation.removeInput(element);
-         }
-
-         public void removeRPCPart(String partName)
-         {
-            WSDLInterfaceOperationInput operationInput = destIntfOperation.getInput(destIntfOperation.getQName());
-            operationInput.removeChildPart(partName);
-         }
-      };
-
-      processBindingReference(destBindingOperation, destIntfOperation, soap11Body, extList, input, cb);
-   }
-
-   private void processBindingOutput(WSDLBindingOperation destBindingOperation, final WSDLInterfaceOperation destIntfOperation, final BindingOperation srcBindingOperation, BindingOutput srcBindingOutput)
-   {
-      log.trace("processBindingInput");
-
-      QName soap11Body = new QName(Constants.NS_SOAP11, "body");
-      List<ExtensibilityElement> extList = srcBindingOutput.getExtensibilityElements();
-      WSDLBindingOperationOutput output = new WSDLBindingOperationOutput(destBindingOperation);
-      destBindingOperation.addOutput(output);
-
-      ReferenceCallback cb = new ReferenceCallback()
-      {
-         public QName getXmlType(String partName)
-         {
-            return srcBindingOperation.getOperation().getOutput().getMessage().getPart(partName).getTypeName();
-         }
-
-         public void removeReference(QName element)
-         {
-            WSDLInterfaceOperationOutput destIntfOutput = destIntfOperation.getOutput(element);
-            if (destIntfOutput == null)
-               destIntfOperation.removeInput(element);
-         }
-
-         public void removeRPCPart(String partName)
-         {
-            QName name = destIntfOperation.getQName();
-            WSDLInterfaceOperationOutput operationOutput = destIntfOperation.getOutput(new QName(name.getNamespaceURI(), name.getLocalPart() + "Response"));
-            operationOutput.removeChildPart(partName);
-         }
-      };
-
-      processBindingReference(destBindingOperation, destIntfOperation, soap11Body, extList, output, cb);
-   }
-
-
-   private void processBindingReference(WSDLBindingOperation destBindingOperation, WSDLInterfaceOperation destIntfOperation,
-         QName soap11Body, List<ExtensibilityElement> extList, WSDLBindingMessageReference reference, ReferenceCallback callback)
-   {
-      for (ExtensibilityElement extElement : extList)
-      {
-         QName elementType = extElement.getElementType();
-         if (soap11Body.equals(elementType) || SOAP12_BODY.equals(elementType))
-         {
-            processEncodingStyle(extElement, destBindingOperation);
-         }
-         else if (extElement instanceof SOAPHeader)
-         {
-            SOAPHeader header = (SOAPHeader)extElement;
-            QName messageQName = header.getMessage();
-            String partName = header.getPart();
-
-            String key = messageQName + "->" + partName;
-            QName elementName = (QName)messagePartToElementMap.get(key);
-            if (elementName == null)
-               throw new WSException("Could not determine element name from header: " + partName);
-
-            reference.addSoapHeader(new WSDLSOAPHeader(elementName, partName));
-            if (Constants.URI_STYLE_IRI == destIntfOperation.getStyle())
-            {
-               callback.removeReference(elementName);
-            }
-            else
-            {
-               // Just in case
-               callback.removeRPCPart(partName);
-            }
-         }
-         else if (extElement instanceof MIMEMultipartRelated)
-         {
-            MIMEMultipartRelated related = (MIMEMultipartRelated)extElement;
-            Iterator i = related.getMIMEParts().iterator();
-            while (i.hasNext())
-            {
-               MIMEPart part = (MIMEPart)i.next();
-               Iterator j = part.getExtensibilityElements().iterator();
-               String name = null;
-               String types = null;
-
-               while (j.hasNext())
-               {
-                  ExtensibilityElement inner = (ExtensibilityElement)j.next();
-                  if (inner instanceof MIMEContent)
-                  {
-                     MIMEContent content = (MIMEContent)inner;
-                     name = content.getPart();
-                     if (types == null)
-                     {
-                        types = content.getType();
-                     }
-                     else
-                     {
-                        types += "," + content.getType();
-                     }
-                  }
-               }
-
-               // Found content types in this part
-               if (name != null)
-               {
-                  QName xmlType  = callback.getXmlType(name);
-                  reference.addMimePart(new WSDLMIMEPart(name, xmlType, types));
-                  if (Constants.URI_STYLE_IRI == destIntfOperation.getStyle())
-                  {
-                     // A mime part must be defined as <part type="">
-                     callback.removeReference(new QName(name));
-                  }
-                  else
-                  {
-                     callback.removeRPCPart(name);
-                  }
-               }
-            }
-         }
-      }
-   }
-
-
-   private void processEncodingStyle(ExtensibilityElement extElement, WSDLBindingOperation destBindingOperation)
-   {
-      log.trace("processEncodingStyle");
-
-      String encStyle = null;
-      QName elementType = extElement.getElementType();
-      if (extElement instanceof SOAPBody)
-      {
-         SOAPBody body = (SOAPBody)extElement;
-         List encStyleList = body.getEncodingStyles();
-         if (encStyleList != null)
-         {
-            if (encStyleList.size() > 1)
-               log.warn("Multiple encoding styles not supported: " + encStyleList);
-
-            if (encStyleList.size() > 0)
-            {
-               encStyle = (String)encStyleList.get(0);
-            }
-         }
-      }
-      else if (SOAP12_BODY.equals(elementType))
-      {
-         Element domElement = ((UnknownExtensibilityElement)extElement).getElement();
-         encStyle = getOptionalAttribute(domElement, "encodingStyle");
-      }
-
-      if (encStyle != null)
-      {
-         String setStyle = destBindingOperation.getEncodingStyle();
-         if (encStyle.equals(setStyle) == false)
-            log.warn("Encoding style '" + encStyle + "' not supported for: " + destBindingOperation.getRef());
-
-         destBindingOperation.setEncodingStyle(encStyle);
-      }
-   }
-
-   private void processServices(Definition srcWsdl)
-   {
-      log.trace("BEGIN processServices: " + srcWsdl.getDocumentBaseURI());
-
-      // Each definition needs a clear binding cache
-      allBindings = null;
-
-      if (srcWsdl.getServices().size() > 0)
-      {
-         Iterator it = srcWsdl.getServices().values().iterator();
-         while (it.hasNext())
-         {
-            Service srcService = (Service)it.next();
-            QName qname = srcService.getQName();
-            WSDLService destService = new WSDLService(destWsdl);
-            destService.setName(new NCName(qname));
-            destService.setQName(qname);
-            destWsdl.addService(destService);
-            processPorts(srcWsdl, destService, srcService);
-         }
-      }
-      else
-      {
-         log.trace("Empty wsdl services, processing imports");
-         Iterator it = srcWsdl.getImports().values().iterator();
-         while (it.hasNext())
-         {
-            List<Import> srcImports = (List<Import>)it.next();
-            for (Import srcImport : srcImports)
-            {
-               Definition importDefinition = srcImport.getDefinition();
-               processServices(importDefinition);
-            }
-         }
-
-         // The binding cache must be clear after imports, so that undefined bindings can be located
-         allBindings = null;
-      }
-
-      log.trace("END processServices: " + srcWsdl.getDocumentBaseURI());
-   }
-
-   private void processPorts(Definition srcWsdl, WSDLService destService, Service srcService)
-   {
-      Iterator it = srcService.getPorts().values().iterator();
-      while (it.hasNext())
-      {
-         Port srcPort = (Port)it.next();
-         processPort(srcWsdl, destService, srcPort);
-      }
-   }
-
-   private void processPort(Definition srcWsdl, WSDLService destService, Port srcPort)
-   {
-      log.trace("processPort: " + srcPort.getName());
-
-      Binding srcBinding = srcPort.getBinding();
-
-      WSDLEndpoint destEndpoint = new WSDLEndpoint(destService);
-      destEndpoint.setName(new NCName(srcPort.getName()));
-      destEndpoint.setBinding(srcBinding.getQName());
-      destEndpoint.setQName(new QName(srcWsdl.getTargetNamespace(), srcPort.getName()));
-      destEndpoint.setAddress(getSOAPAddress(srcPort));
-      destService.addEndpoint(destEndpoint);
-
-      processBinding(srcWsdl, srcBinding);
-   }
-
-   /** Get the endpoint address from the ports extensible element
-    */
-   private String getSOAPAddress(Port srcPort)
-   {
-      String soapAddress = "dummy";
-
-      Iterator it = srcPort.getExtensibilityElements().iterator();
-      while (it.hasNext())
-      {
-         ExtensibilityElement extElement = (ExtensibilityElement)it.next();
-         QName elementType = extElement.getElementType();
-
-         if (extElement instanceof SOAPAddress)
-         {
-            SOAPAddress addr = (SOAPAddress)extElement;
-            soapAddress = addr.getLocationURI();
-            break;
-         }
-         else if (SOAP12_ADDRESS.equals(elementType))
-         {
-            Element domElement = ((UnknownExtensibilityElement)extElement).getElement();
-            soapAddress = getOptionalAttribute(domElement, "location");
-            break;
-         }
-         else if ("address".equals(elementType.getLocalPart()))
-         {
-            log.warn("Unprocessed extension element: " + elementType);
-         }
-      }
-
-      if (soapAddress == null)
-         throw new WSException("Cannot obtain SOAP address");
-
-      return soapAddress;
-   }
-
-   private String getOptionalAttribute(Element domElement, String attrName)
-   {
-      String attrValue = domElement.getAttribute(attrName);
-      return (attrValue.length() > 0 ? attrValue : null);
-   }
-}

Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/wsdl/WSDL11Reader.java (from rev 1574, branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Reader.java)
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Reader.java	2006-12-06 14:12:50 UTC (rev 1574)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/wsdl/WSDL11Reader.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -0,0 +1,1219 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ws.common.wsdl;
+
+// $Id$
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.BindingOutput;
+import javax.wsdl.Definition;
+import javax.wsdl.Fault;
+import javax.wsdl.Import;
+import javax.wsdl.Input;
+import javax.wsdl.Message;
+import javax.wsdl.Operation;
+import javax.wsdl.Output;
+import javax.wsdl.Part;
+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.mime.MIMEContent;
+import javax.wsdl.extensions.mime.MIMEMultipartRelated;
+import javax.wsdl.extensions.mime.MIMEPart;
+import javax.wsdl.extensions.schema.Schema;
+import javax.wsdl.extensions.soap.SOAPAddress;
+import javax.wsdl.extensions.soap.SOAPBinding;
+import javax.wsdl.extensions.soap.SOAPBody;
+import javax.wsdl.extensions.soap.SOAPHeader;
+import javax.wsdl.extensions.soap.SOAPOperation;
+import javax.xml.namespace.QName;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.common.Constants;
+import org.jboss.ws.common.WSException;
+import org.jboss.ws.common.jaxrpc.Style;
+import org.jboss.ws.common.metadata.wsdl.NCName;
+import org.jboss.ws.common.metadata.wsdl.WSDLBinding;
+import org.jboss.ws.common.metadata.wsdl.WSDLBindingMessageReference;
+import org.jboss.ws.common.metadata.wsdl.WSDLBindingOperation;
+import org.jboss.ws.common.metadata.wsdl.WSDLBindingOperationInput;
+import org.jboss.ws.common.metadata.wsdl.WSDLBindingOperationOutput;
+import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
+import org.jboss.ws.common.metadata.wsdl.WSDLEndpoint;
+import org.jboss.ws.common.metadata.wsdl.WSDLInterface;
+import org.jboss.ws.common.metadata.wsdl.WSDLInterfaceFault;
+import org.jboss.ws.common.metadata.wsdl.WSDLInterfaceOperation;
+import org.jboss.ws.common.metadata.wsdl.WSDLInterfaceOperationInput;
+import org.jboss.ws.common.metadata.wsdl.WSDLInterfaceOperationOutfault;
+import org.jboss.ws.common.metadata.wsdl.WSDLInterfaceOperationOutput;
+import org.jboss.ws.common.metadata.wsdl.WSDLMIMEPart;
+import org.jboss.ws.common.metadata.wsdl.WSDLProperty;
+import org.jboss.ws.common.metadata.wsdl.WSDLRPCPart;
+import org.jboss.ws.common.metadata.wsdl.WSDLRPCSignatureItem;
+import org.jboss.ws.common.metadata.wsdl.WSDLSOAPHeader;
+import org.jboss.ws.common.metadata.wsdl.WSDLService;
+import org.jboss.ws.common.metadata.wsdl.WSDLTypes;
+import org.jboss.ws.common.metadata.wsdl.WSDLUtils;
+import org.jboss.ws.common.metadata.wsdl.XSModelTypes;
+import org.jboss.ws.common.metadata.wsdl.WSDLRPCSignatureItem.Direction;
+import org.jboss.ws.common.metadata.wsdl.xmlschema.JBossXSModel;
+import org.jboss.ws.common.metadata.wsdl.xsd.SchemaUtils;
+import org.jboss.ws.common.utils.DOMUtils;
+import org.jboss.ws.common.utils.DOMWriter;
+import org.jboss.ws.tools.JavaToXSD;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+
+/**
+ * A helper that translates a WSDL-1.1 object graph into a WSDL-2.0 object graph.
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @author Anil.Saldhana at jboss.org
+ * @author <a href="jason.greene at jboss.com">Jason T. Greene</a>
+ * @since 10-Oct-2004
+ */
+public class WSDL11Reader
+{
+   // provide logging
+   private static final Logger log = Logger.getLogger(WSDL11Reader.class);
+
+   private static QName SOAP12_BINDING = new QName(Constants.NS_SOAP12, "binding");
+   private static QName SOAP12_BODY = new QName(Constants.NS_SOAP12, "body");
+   private static QName SOAP12_OPERATION = new QName(Constants.NS_SOAP12, "operation");
+   private static QName SOAP12_ADDRESS = new QName(Constants.NS_SOAP12, "address");
+
+   private WSDLDefinitions destWsdl;
+
+   // Maps wsdl message parts to their corresponding element names
+   private Map<String, QName> messagePartToElementMap = new HashMap<String, QName>();
+
+   // Map of <ns,URL> for schemalocation keyed by namespace
+   private Map<String, URL> schemaLocationsMap = new HashMap<String, URL>();
+
+   private LinkedHashMap<QName, Binding> allBindings;
+   private LinkedHashMap<QName, Binding> portTypeBindings;
+
+   // Temporary files used by this reader.
+   private List<File> tempFiles = new ArrayList<File>();
+
+   /**
+    * Takes a WSDL11 Definition element and converts into
+    * our object graph that has been developed for WSDL20
+    *
+    * @param srcWsdl The src WSDL11 definition
+    * @param wsdlLoc The source location, if null we cannot process imports or includes
+    */
+   public WSDLDefinitions processDefinition(Definition srcWsdl, URL wsdlLoc) throws IOException
+   {
+      log.trace("processDefinition: " + wsdlLoc);
+
+      destWsdl = new WSDLDefinitions();
+      destWsdl.setWsdlTypes(new XSModelTypes());
+      destWsdl.setWsdlOneOneDefinition(srcWsdl);
+      destWsdl.setWsdlNamespace(Constants.NS_WSDL11);
+
+      processNamespaces(srcWsdl);
+      processTypes(srcWsdl, wsdlLoc);
+      processServices(srcWsdl);
+
+      if (getAllDefinedBindings(srcWsdl).size() != destWsdl.getBindings().length)
+         processUnreachableBindings(srcWsdl);
+
+      cleanupTemporaryFiles();
+
+      return destWsdl;
+   }
+
+   private void cleanupTemporaryFiles()
+   {
+     for (File current : tempFiles)
+     {
+        current.delete();
+     }
+   }
+
+   // process all bindings not within service separetly
+   private void processUnreachableBindings(Definition srcWsdl)
+   {
+      log.trace("processUnreachableBindings");
+
+      Iterator it = getAllDefinedBindings(srcWsdl).values().iterator();
+      while (it.hasNext())
+      {
+         Binding srcBinding = (Binding)it.next();
+         QName srcQName = srcBinding.getQName();
+
+         WSDLBinding destBinding = destWsdl.getBinding(new NCName(srcQName));
+         if (destBinding == null)
+         {
+            processBinding(srcWsdl, srcBinding);
+         }
+      }
+   }
+
+   private void processNamespaces(Definition srcWsdl)
+   {
+      String targetNS = srcWsdl.getTargetNamespace();
+      destWsdl.setTargetNamespace(targetNS);
+
+      // Copy wsdl namespaces
+      Map nsMap = srcWsdl.getNamespaces();
+      Iterator iter = nsMap.entrySet().iterator();
+      while (iter.hasNext())
+      {
+         Map.Entry entry = (Map.Entry)iter.next();
+         String prefix = (String)entry.getKey();
+         String nsURI = (String)entry.getValue();
+         destWsdl.registerNamespaceURI(nsURI, prefix);
+      }
+   }
+
+   private void processTypes(Definition srcWsdl, URL wsdlLoc) throws IOException
+   {
+      log.trace("BEGIN processTypes: " + wsdlLoc);
+
+      WSDLTypes destTypes = destWsdl.getWsdlTypes();
+
+      Types srcTypes = srcWsdl.getTypes();
+      if (srcTypes != null && srcTypes.getExtensibilityElements().size() > 0)
+      {
+         List extElements = srcTypes.getExtensibilityElements();
+         int len = extElements.size();
+
+         for (int i = 0; i < len; i++)
+         {
+            ExtensibilityElement extElement = (ExtensibilityElement)extElements.get(i);
+
+            Element domElement;
+            if (extElement instanceof Schema)
+            {
+               domElement = ((Schema)extElement).getElement();
+            }
+            else if (extElement instanceof UnknownExtensibilityElement)
+            {
+               domElement = ((UnknownExtensibilityElement)extElement).getElement();
+            }
+            else
+            {
+               throw new WSException("Unsupported extensibility element: " + extElement);
+            }
+
+            Element domElementClone = (Element)domElement.cloneNode(true);
+            copyParentNamespaceDeclarations(domElementClone, domElement);
+
+            String localname = domElementClone.getLocalName();
+            try
+            {
+               if ("import".equals(localname))
+               {
+                  processSchemaImport(destTypes, wsdlLoc, domElementClone);
+               }
+               else if ("schema".equals(localname))
+               {
+                  processSchemaInclude(destTypes, wsdlLoc, domElementClone);
+               }
+               else
+               {
+                  throw new IllegalArgumentException("Unsuported schema element: " + localname);
+               }
+            }
+            catch (IOException e)
+            {
+               throw new WSException("Cannot extract schema definition", e);
+            }
+         }
+
+         if (len > 0)
+         {
+            JavaToXSD jxsd = new JavaToXSD();
+            JBossXSModel xsmodel = jxsd.parseSchema(schemaLocationsMap);
+            WSDLUtils.addSchemaModel(destTypes, destWsdl.getTargetNamespace(), xsmodel);
+         }
+      }
+      else
+      {
+         log.trace("Empty wsdl types element, processing imports");
+         Iterator it = srcWsdl.getImports().values().iterator();
+         while (it.hasNext())
+         {
+            List<Import> srcImports = (List<Import>)it.next();
+            for (Import srcImport : srcImports)
+            {
+               Definition impDefinition = srcImport.getDefinition();
+               String impLoc = impDefinition.getDocumentBaseURI();
+               processTypes(impDefinition, new URL(impLoc));
+            }
+         }
+      }
+
+      log.trace("END processTypes: " + wsdlLoc + "\n" + destTypes);
+   }
+
+   private void copyParentNamespaceDeclarations(Element destElement, Element srcElement)
+   {
+      Node parent = srcElement.getParentNode();
+      while (parent != null)
+      {
+         if (parent.hasAttributes())
+         {
+            NamedNodeMap attributes = parent.getAttributes();
+            for (int i = 0; i < attributes.getLength(); i++)
+            {
+               Attr attr = (Attr)attributes.item(i);
+               String name = attr.getName();
+               String value = attr.getValue();
+               if (name.startsWith("xmlns:") && destElement.hasAttribute(name) == false)
+                  destElement.setAttribute(name, value);
+            }
+         }
+         parent = parent.getParentNode();
+      }
+   }
+
+   private void processSchemaImport(WSDLTypes types, URL wsdlLoc, Element importEl) throws IOException
+   {
+      if (wsdlLoc == null)
+         throw new IllegalArgumentException("Cannot process import, parent location not set");
+
+      log.trace("processSchemaImport: " + wsdlLoc);
+
+      String location = getOptionalAttribute(importEl, "schemaLocation");
+      if (location == null)
+         throw new IllegalArgumentException("schemaLocation is null for xsd:import");
+
+      URL locationURL = getLocationURL(wsdlLoc, location);
+      Element rootElement = DOMUtils.parse(locationURL.openStream());
+      URL newloc = processSchemaInclude(types, locationURL, rootElement);
+      if (newloc != null)
+         importEl.setAttribute("schemaLocation", newloc.toExternalForm());
+   }
+
+   private URL processSchemaInclude(WSDLTypes types, URL wsdlLoc, Element schemaEl) throws IOException
+   {
+      if (wsdlLoc == null)
+         throw new IllegalArgumentException("Cannot process iclude, parent location not set");
+
+      File tmpFile = null;
+      if (wsdlLoc == null)
+         throw new IllegalArgumentException("Cannot process include, parent location not set");
+
+      log.trace("processSchemaInclude: " + wsdlLoc);
+
+      String schemaPrefix = schemaEl.getPrefix();
+
+      String importTag = (schemaPrefix == null) ? "import" : schemaPrefix + ":import";
+      Element importElement = schemaEl.getOwnerDocument().createElementNS(Constants.NS_SCHEMA_XSD, importTag);
+      importElement.setAttribute("namespace", Constants.URI_SOAP11_ENC);
+      schemaEl.insertBefore(importElement, DOMUtils.getFirstChildElement(schemaEl));
+
+      // Handle schema includes
+      Iterator it = DOMUtils.getChildElements(schemaEl, new QName(Constants.NS_SCHEMA_XSD, "include"));
+      while (it.hasNext())
+      {
+         Element includeEl = (Element)it.next();
+         String location = getOptionalAttribute(includeEl, "schemaLocation");
+         if (location == null)
+            throw new IllegalArgumentException("schemaLocation is null for xsd:include");
+
+         URL locationURL = getLocationURL(wsdlLoc, location);
+         Element rootElement = DOMUtils.parse(locationURL.openStream());
+         URL newloc = processSchemaInclude(types, locationURL, rootElement);
+         if (newloc != null)
+            includeEl.setAttribute("schemaLocation", newloc.toExternalForm());
+      }
+
+      String targetNS = getOptionalAttribute(schemaEl, "targetNamespace");
+      if (targetNS != null)
+      {
+         log.trace("processSchemaInclude: [targetNS=" + targetNS + ",parentURL=" + wsdlLoc + "]");
+
+         tmpFile = SchemaUtils.getSchemaTempFile(targetNS);
+         tempFiles.add(tmpFile);
+
+         FileWriter fwrite = new FileWriter(tmpFile);
+         new DOMWriter(fwrite).setPrettyprint(true).print(schemaEl);
+         fwrite.close();
+
+         schemaLocationsMap.put(targetNS, tmpFile.toURL());
+      }
+
+      // schema elements that have no target namespace are skipped
+      //
+      //  <xsd:schema>
+      //    <xsd:import namespace="http://org.jboss.webservice/example/types" schemaLocation="Hello.xsd"/>
+      //    <xsd:import namespace="http://org.jboss.webservice/example/types/arrays/org/jboss/test/webservice/admindevel" schemaLocation="subdir/HelloArr.xsd"/>
+      //  </xsd:schema>
+      if (targetNS == null)
+      {
+         log.trace("Schema element without target namespace in: " + wsdlLoc);
+      }
+
+      handleSchemaImports(schemaEl, wsdlLoc);
+
+      return tmpFile != null ? tmpFile.toURL() : null;
+   }
+
+   private void handleSchemaImports(Element schemaEl, URL wsdlLoc) throws MalformedURLException
+   {
+      if (wsdlLoc == null)
+         throw new IllegalArgumentException("Cannot process import, parent location not set");
+
+      Iterator it = DOMUtils.getChildElements(schemaEl, new QName(Constants.NS_SCHEMA_XSD, "import"));
+      while (it.hasNext())
+      {
+         Element includeEl = (Element)it.next();
+         String schemaLocation = getOptionalAttribute(includeEl, "schemaLocation");
+         String namespace = getOptionalAttribute(includeEl, "namespace");
+
+         log.trace("handleSchemaImport: [namespace=" + namespace + ",schemaLocation=" + schemaLocation + "]");
+
+         // Skip, let the entity resolver resolve these
+         if (namespace != null && schemaLocation != null)
+         {
+            URL currLoc = getLocationURL(wsdlLoc, schemaLocation);
+            schemaLocationsMap.put(namespace, currLoc);
+         }
+         else
+         {
+            log.trace("Skip schema import: [namespace=" + namespace + ",schemaLocation=" + schemaLocation + "]");
+         }
+      }
+   }
+
+   private URL getLocationURL(URL parentURL, String location) throws MalformedURLException
+   {
+      log.trace("getLocationURL: [location=" + location + ",parent=" + parentURL + "]");
+
+      URL locationURL = null;
+      try
+      {
+         locationURL = new URL(location);
+      }
+      catch (MalformedURLException e)
+      {
+         // ignore malformed URL
+      }
+
+      if (locationURL == null)
+      {
+         String parentProtocol = parentURL.getProtocol();
+         if (parentProtocol.equals("file") && !location.startsWith("/"))
+         {
+            String path = parentURL.toExternalForm();
+            path = path.substring(0, path.lastIndexOf("/"));
+            locationURL = new URL(path + "/" + location);
+         }
+         else if (parentProtocol.startsWith("http") && location.startsWith("/"))
+         {
+            String path = parentProtocol + "://" + parentURL.getHost() + ":" + parentURL.getPort();
+            locationURL = new URL(path + location);
+         }
+         else if (parentProtocol.equals("jar") && !location.startsWith("/"))
+         {
+            String path = parentURL.toExternalForm();
+            path = path.substring(0, path.lastIndexOf("/"));
+            locationURL = new URL(path + "/" + location);
+         }
+         else
+         {
+            throw new WSException("Unsupported schemaLocation: " + location);
+         }
+      }
+
+      log.trace("Modified schemaLocation: " + locationURL);
+      return locationURL;
+   }
+
+   private void processPortType(Definition srcWsdl, PortType srcPortType)
+   {
+      log.trace("processPortType: " + srcPortType.getQName());
+
+      QName qname = srcPortType.getQName();
+      NCName ncName = new NCName(qname);
+      if (destWsdl.getInterface(ncName) == null)
+      {
+         WSDLInterface destInterface = new WSDLInterface(destWsdl);
+         destInterface.setName(ncName);
+         destInterface.setQName(qname);
+
+         // eventing extensions
+         QName eventSourceProp = (QName)srcPortType.getExtensionAttribute(Constants.WSDL_ATTRIBUTE_WSE_EVENTSOURCE);
+         if (eventSourceProp != null && eventSourceProp.getLocalPart().equals(Boolean.TRUE.toString()))
+         {
+            destInterface.addProperty(new WSDLProperty(Constants.WSDL_PROPERTY_EVENTSOURCE, eventSourceProp.getLocalPart()));
+         }
+
+         destWsdl.addInterface(destInterface);
+
+         processPortTypeOperations(srcWsdl, destInterface, srcPortType);
+      }
+   }
+
+   private void processPortTypeOperations(Definition srcWsdl, WSDLInterface destInterface, PortType srcPortType)
+   {
+      Iterator itOperations = srcPortType.getOperations().iterator();
+      while (itOperations.hasNext())
+      {
+         Operation srcOperation = (Operation)itOperations.next();
+
+         WSDLInterfaceOperation destOperation = new WSDLInterfaceOperation(destInterface);
+         destOperation.setName(new NCName(srcOperation.getName()));
+         destOperation.setStyle(getOperationStyle(srcWsdl, srcPortType, srcOperation));
+
+         processOperationInput(srcWsdl, srcOperation, destOperation, srcPortType);
+         processOperationOutput(srcWsdl, srcOperation, destOperation, srcPortType);
+         processOperationFaults(srcOperation, destOperation, destInterface);
+
+         destInterface.addOperation(destOperation);
+      }
+   }
+
+   private void processOperationInput(Definition srcWsdl, Operation srcOperation, WSDLInterfaceOperation destOperation, PortType srcPortType)
+   {
+      Input srcInput = srcOperation.getInput();
+      if (srcInput != null)
+      {
+         Message srcMessage = srcInput.getMessage();
+         log.trace("processOperationInput: " + srcMessage.getQName());
+
+         QName wsaAction = (QName)srcInput.getExtensionAttribute(Constants.WSDL_ATTRIBUTE_WSA_ACTION);
+         if (wsaAction != null)
+            destOperation.addProperty(new WSDLProperty(Constants.WSDL_PROPERTY_ACTION_IN, wsaAction.getLocalPart()));
+
+         List<String> paramOrder = (List<String>) srcOperation.getParameterOrdering();
+         if (paramOrder != null)
+         {
+            for (String name : paramOrder)
+            {
+               if (srcMessage.getPart(name) != null)
+                  destOperation.addRpcSignatureItem(new WSDLRPCSignatureItem(name));
+            }
+         }
+
+         WSDLInterfaceOperationInput rpcInput = new WSDLInterfaceOperationInput(destOperation);
+         for (Part srcPart : (List<Part>) srcMessage.getOrderedParts(paramOrder))
+         {
+            if (Constants.URI_STYLE_IRI == destOperation.getStyle())
+            {
+               WSDLInterfaceOperationInput destInput = new WSDLInterfaceOperationInput(destOperation);
+               QName elementName = messagePartToElementName(srcWsdl, srcPortType, srcOperation, srcMessage, srcPart);
+               destInput.setElement(elementName);
+
+               //Lets remember the Message name
+               destInput.setMessageName(srcMessage.getQName());
+               destOperation.addProperty(new WSDLProperty(Constants.WSDL_PROPERTY_MESSAGE_NAME_IN, srcMessage.getQName().getLocalPart()));
+
+               destInput.setPartName(srcPart.getName());
+
+               destOperation.addInput(destInput);
+            }
+            else
+            {
+               // If we don't have a type then we aren't a valid RPC parameter
+               // This could happen on a header element, in which case the
+               // binding will pick it up
+               QName xmlType = srcPart.getTypeName();
+               if (xmlType != null)
+                  rpcInput.addChildPart(new WSDLRPCPart(srcPart.getName(), destWsdl.registerQName(xmlType)));
+               else
+                  messagePartToElementName(srcWsdl, srcPortType, srcOperation, srcMessage, srcPart);
+            }
+         }
+         if (Constants.URI_STYLE_RPC == destOperation.getStyle())
+         {
+            // This is really a place holder, but also the actual value used in
+            // WSDL 2.0 RPC bindings
+            rpcInput.setElement(destOperation.getQName());
+            rpcInput.setMessageName(srcMessage.getQName());
+            destOperation.addInput(rpcInput);
+         }
+      }
+   }
+
+   private void processOperationOutput(Definition srcWsdl, Operation srcOperation, WSDLInterfaceOperation destOperation, PortType srcPortType)
+   {
+      Output srcOutput = srcOperation.getOutput();
+      if (srcOutput == null)
+      {
+         destOperation.setPattern(Constants.WSDL20_PATTERN_IN_ONLY);
+         return;
+      }
+
+      Message srcMessage = srcOutput.getMessage();
+      log.trace("processOperationOutput: " + srcMessage.getQName());
+
+      destOperation.setPattern(Constants.WSDL20_PATTERN_IN_OUT);
+      QName wsaAction = (QName) srcOutput.getExtensionAttribute(Constants.WSDL_ATTRIBUTE_WSA_ACTION);
+      if (wsaAction != null)
+         destOperation.addProperty(new WSDLProperty(Constants.WSDL_PROPERTY_ACTION_OUT, wsaAction.getLocalPart()));
+
+      List<String> paramOrder = (List<String>) srcOperation.getParameterOrdering();
+      if (paramOrder != null)
+      {
+         for (String name : paramOrder)
+         {
+            if (srcMessage.getPart(name) != null)
+            {
+               WSDLRPCSignatureItem item = destOperation.getRpcSignatureitem(name);
+               if (item != null)
+                  item.setDirection(Direction.INOUT);
+               else
+                  destOperation.addRpcSignatureItem(new WSDLRPCSignatureItem(name, Direction.OUT));
+            }
+         }
+      }
+
+      WSDLInterfaceOperationOutput rpcOutput = new WSDLInterfaceOperationOutput(destOperation);
+      for (Part srcPart : (List<Part>) srcMessage.getOrderedParts(null))
+      {
+         if (Constants.URI_STYLE_IRI == destOperation.getStyle())
+         {
+            WSDLInterfaceOperationOutput destOutput = new WSDLInterfaceOperationOutput(destOperation);
+
+            QName elementName = messagePartToElementName(srcWsdl, srcPortType, srcOperation, srcMessage, srcPart);
+            destOutput.setElement(elementName);
+
+            // Lets remember the Message name
+            destOutput.setMessageName(srcMessage.getQName());
+            destOperation.addProperty(new WSDLProperty(Constants.WSDL_PROPERTY_MESSAGE_NAME_OUT, srcMessage.getQName()
+                  .getLocalPart()));
+
+            // Remember the original part name
+            destOutput.setPartName(srcPart.getName());
+
+            destOperation.addOutput(destOutput);
+         }
+         else
+         {
+            // If we don't have a type then we aren't a valid RPC parameter
+            // This could happen on a header element, in which case the
+            // binding will pick it up
+            QName xmlType = srcPart.getTypeName();
+            if (xmlType != null)
+               rpcOutput.addChildPart(new WSDLRPCPart(srcPart.getName(), destWsdl.registerQName(xmlType)));
+            else
+               messagePartToElementName(srcWsdl, srcPortType, srcOperation, srcMessage, srcPart);
+         }
+      }
+
+      if (Constants.URI_STYLE_RPC == destOperation.getStyle())
+      {
+         // This is really a place holder, but also the actual value used in
+         // WSDL 2.0 RPC bindings
+         QName name = destOperation.getQName();
+         rpcOutput.setElement(new QName(name.getNamespaceURI(), name.getLocalPart() + "Response"));
+         rpcOutput.setMessageName(srcMessage.getQName());
+         destOperation.addOutput(rpcOutput);
+      }
+   }
+
+   private void processOperationFaults(Operation srcOperation, WSDLInterfaceOperation destOperation, WSDLInterface destInterface)
+   {
+
+      Map faults = srcOperation.getFaults();
+      Iterator itFaults = faults.values().iterator();
+      while (itFaults.hasNext())
+      {
+         Fault srcFault = (Fault)itFaults.next();
+         processOperationFault(destOperation, destInterface, srcFault);
+      }
+   }
+
+   private void processOperationFault(WSDLInterfaceOperation destOperation, WSDLInterface destInterface, Fault srcFault)
+   {
+      String faultName = srcFault.getName();
+      log.trace("processOperationFault: " + faultName);
+
+      WSDLInterfaceFault destFault = new WSDLInterfaceFault(destInterface);
+      NCName ncName = new NCName(faultName);
+      destFault.setName(ncName);
+
+      Message message = srcFault.getMessage();
+      QName messageName = message.getQName();
+
+      Map partsMap = message.getParts();
+      if (partsMap.size() != 1)
+         throw new WSException("Unsupported number of fault parts in message " + messageName);
+
+      Part part = (Part)partsMap.values().iterator().next();
+      QName xmlName = part.getElementName();
+
+      if (xmlName != null)
+      {
+         destFault.setElement(xmlName);
+      }
+      else
+      {
+         destFault.setElement(messageName);
+         log.warn("Unsupported fault message part in message: " + messageName);
+      }
+
+      WSDLInterfaceFault prevFault = destInterface.getFault(ncName);
+      if (prevFault != null && prevFault.getName().equals(ncName) == false)
+         throw new WSException("Fault name must be unique: " + faultName);
+
+      // Add the fault to the interface
+      destInterface.addFault(destFault);
+
+      // Add the fault refererence to the operation
+      WSDLInterfaceOperationOutfault opOutFault = new WSDLInterfaceOperationOutfault(destOperation);
+      opOutFault.setRef(new QName(destWsdl.getTargetNamespace(), faultName));
+      destOperation.addOutfault(opOutFault);
+   }
+
+   /** Translate the message part name into an XML element name.
+    */
+   private QName messagePartToElementName(Definition srcWsdl, PortType srcPortType, Operation srcOperation, Message srcMessage, Part srcPart)
+   {
+      // <part name="param" element="tns:SomeType" />
+      QName xmlName = srcPart.getElementName();
+
+      // <part name="param" type="xsd:string" />
+      if (xmlName == null)
+         xmlName = new QName(srcPart.getName());
+
+      xmlName = destWsdl.registerQName(xmlName);
+      String key = srcMessage.getQName() + "->" + srcPart.getName();
+      messagePartToElementMap.put(key, xmlName);
+
+      return xmlName;
+   }
+
+   private BindingOperation getBindingOperation(Definition srcWsdl, PortType srcPortType, Operation srcOperation)
+   {
+      Binding srcBinding = getPortTypeBindings(srcWsdl).get(srcPortType.getQName());
+
+      if (srcBinding == null)
+         throw new WSException("Cannot find binding for: " + srcPortType.getQName());
+
+      String srcOperationName = srcOperation.getName();
+      BindingOperation srcBindingOperation = srcBinding.getBindingOperation(srcOperationName, null, null);
+      if (srcBindingOperation == null)
+         throw new WSException("Cannot find binding operation for: " + srcOperationName);
+      return srcBindingOperation;
+   }
+
+   private String getOperationStyle(Definition srcWsdl, PortType srcPortType, Operation srcOperation)
+   {
+      Binding srcBinding = getPortTypeBindings(srcWsdl).get(srcPortType.getQName());
+      BindingOperation srcBindingOperation = getBindingOperation(srcWsdl, srcPortType, srcOperation);
+
+      String operationStyle = null;
+      List<ExtensibilityElement> extList = srcBindingOperation.getExtensibilityElements();
+      for (ExtensibilityElement extElement : extList)
+      {
+         QName elementType = extElement.getElementType();
+         if (extElement instanceof SOAPOperation)
+         {
+            SOAPOperation soapOp = (SOAPOperation)extElement;
+            operationStyle = soapOp.getStyle();
+         }
+         else if (SOAP12_OPERATION.equals(elementType))
+         {
+            Element domElement = ((UnknownExtensibilityElement)extElement).getElement();
+            operationStyle = getOptionalAttribute(domElement, "style");
+         }
+      }
+
+      if (operationStyle == null)
+      {
+         for (ExtensibilityElement extElement : (List<ExtensibilityElement>) srcBinding.getExtensibilityElements())
+         {
+            QName elementType = extElement.getElementType();
+            if (extElement instanceof SOAPBinding)
+            {
+               SOAPBinding soapBinding = (SOAPBinding) extElement;
+               operationStyle = soapBinding.getStyle();
+            }
+            else if (SOAP12_BINDING.equals(elementType))
+            {
+               Element domElement = ((UnknownExtensibilityElement) extElement).getElement();
+               operationStyle = getOptionalAttribute(domElement, "style");
+            }
+         }
+      }
+
+      return  ("rpc".equals(operationStyle)) ? Constants.URI_STYLE_RPC : Constants.URI_STYLE_IRI;
+   }
+
+   private void processBinding(Definition srcWsdl, Binding srcBinding)
+   {
+      QName srcBindingQName = srcBinding.getQName();
+      log.trace("processBinding: " + srcBindingQName);
+
+      NCName ncName = new NCName(srcBindingQName);
+      if (destWsdl.getBinding(ncName) == null)
+      {
+         PortType srcPortType = srcBinding.getPortType();
+         if (srcPortType == null)
+            throw new WSException("Cannot find port type for binding: " + ncName);
+
+         processPortType(srcWsdl, srcPortType);
+
+         WSDLBinding destBinding = new WSDLBinding(destWsdl);
+         destBinding.setQName(srcBindingQName);
+         destBinding.setName(ncName);
+         destBinding.setInterfaceName(srcPortType.getQName());
+
+         String bindingStyle = Style.getDefaultStyle().toString();
+         List<ExtensibilityElement> extList = srcBinding.getExtensibilityElements();
+         for (ExtensibilityElement extElement : extList)
+         {
+            QName elementType = extElement.getElementType();
+            if (extElement instanceof SOAPBinding)
+            {
+               destBinding.setType(Constants.NS_SOAP11);
+               SOAPBinding soapBinding = (SOAPBinding)extElement;
+               bindingStyle = soapBinding.getStyle();
+            }
+            else if (SOAP12_BINDING.equals(elementType))
+            {
+               destBinding.setType(Constants.NS_SOAP12);
+               Element domElement = ((UnknownExtensibilityElement)extElement).getElement();
+               bindingStyle = getOptionalAttribute(domElement, "style");
+            }
+         }
+         destWsdl.addBinding(destBinding);
+         processBindingOperations(destBinding, srcBinding, bindingStyle);
+      }
+   }
+
+   private Map<QName, Binding> getPortTypeBindings(Definition srcWsdl)
+   {
+      getAllDefinedBindings(srcWsdl);
+      return portTypeBindings;
+   }
+
+   private Map<QName, Binding> getAllDefinedBindings(Definition srcWsdl)
+   {
+      if (allBindings != null)
+         return allBindings;
+
+      allBindings = new LinkedHashMap<QName, Binding>();
+      portTypeBindings = new LinkedHashMap<QName, Binding>();
+      Map srcBindings = srcWsdl.getBindings();
+      Iterator itBinding = srcBindings.values().iterator();
+      while (itBinding.hasNext())
+      {
+         Binding srcBinding = (Binding)itBinding.next();
+         allBindings.put(srcBinding.getQName(), srcBinding);
+         portTypeBindings.put(srcBinding.getPortType().getQName(), srcBinding);
+      }
+
+      // Bindings not available when pulled in through <wsdl:import>
+      // http://sourceforge.net/tracker/index.php?func=detail&aid=1240323&group_id=128811&atid=712792
+      Iterator itService = srcWsdl.getServices().values().iterator();
+      while (itService.hasNext())
+      {
+         Service srcService = (Service)itService.next();
+         Iterator itPort = srcService.getPorts().values().iterator();
+         while (itPort.hasNext())
+         {
+            Port srcPort = (Port)itPort.next();
+            Binding srcBinding = srcPort.getBinding();
+            allBindings.put(srcBinding.getQName(), srcBinding);
+            portTypeBindings.put(srcBinding.getPortType().getQName(), srcBinding);
+         }
+      }
+
+      return allBindings;
+   }
+
+   private void processBindingOperations(WSDLBinding destBinding, Binding srcBinding, String bindingStyle)
+   {
+      Iterator it = srcBinding.getBindingOperations().iterator();
+      while (it.hasNext())
+      {
+         BindingOperation srcBindingOperation = (BindingOperation)it.next();
+         processBindingOperation(destBinding, bindingStyle, srcBindingOperation);
+      }
+   }
+
+   private void processBindingOperation(WSDLBinding destBinding, String bindingStyle, BindingOperation srcBindingOperation)
+   {
+      String srcBindingName = srcBindingOperation.getName();
+      log.trace("processBindingOperation: " + srcBindingName);
+
+      WSDLInterface destInterface = destBinding.getInterface();
+      String namespaceURI = destInterface.getQName().getNamespaceURI();
+
+      WSDLBindingOperation destBindingOperation = new WSDLBindingOperation(destBinding);
+      QName refQName = new QName(namespaceURI, srcBindingName);
+      destBindingOperation.setRef(refQName);
+      destBinding.addOperation(destBindingOperation);
+
+      String opName = srcBindingName;
+      WSDLInterfaceOperation destIntfOperation = destInterface.getOperation(new NCName(opName));
+
+      // Process soap:operation at soapAction, soap:operation at style
+      List<ExtensibilityElement> extList = srcBindingOperation.getExtensibilityElements();
+      for (ExtensibilityElement extElement : extList)
+      {
+         QName elementType = extElement.getElementType();
+         if (extElement instanceof SOAPOperation)
+         {
+            SOAPOperation soapOp = (SOAPOperation)extElement;
+            destBindingOperation.setSOAPAction(soapOp.getSoapActionURI());
+         }
+         else if (SOAP12_OPERATION.equals(elementType))
+         {
+            Element domElement = ((UnknownExtensibilityElement)extElement).getElement();
+            destBindingOperation.setSOAPAction(getOptionalAttribute(domElement, "soapAction"));
+         }
+      }
+
+      BindingInput srcBindingInput = srcBindingOperation.getBindingInput();
+      if (srcBindingInput != null)
+      {
+         processBindingInput(destBindingOperation, destIntfOperation, srcBindingOperation, srcBindingInput);
+      }
+
+      BindingOutput srcBindingOutput = srcBindingOperation.getBindingOutput();
+      if (srcBindingOutput != null)
+      {
+         processBindingOutput(destBindingOperation, destIntfOperation, srcBindingOperation, srcBindingOutput);
+      }
+   }
+
+   interface ReferenceCallback
+   {
+      void removeReference(QName element);
+      void removeRPCPart(String partName);
+      QName getXmlType(String partName);
+   }
+
+   private void processBindingInput(WSDLBindingOperation destBindingOperation, final WSDLInterfaceOperation destIntfOperation, final BindingOperation srcBindingOperation, BindingInput srcBindingInput)
+   {
+      log.trace("processBindingInput");
+
+      QName soap11Body = new QName(Constants.NS_SOAP11, "body");
+      List<ExtensibilityElement> extList = srcBindingInput.getExtensibilityElements();
+      WSDLBindingOperationInput input = new WSDLBindingOperationInput(destBindingOperation);
+      destBindingOperation.addInput(input);
+
+      ReferenceCallback cb = new ReferenceCallback()
+      {
+         public QName getXmlType(String partName)
+         {
+            return srcBindingOperation.getOperation().getInput().getMessage().getPart(partName).getTypeName();
+         }
+
+         public void removeReference(QName element)
+         {
+            WSDLInterfaceOperationInput destIntfInput = destIntfOperation.getInput(element);
+            if (destIntfInput == null)
+               destIntfOperation.removeInput(element);
+         }
+
+         public void removeRPCPart(String partName)
+         {
+            WSDLInterfaceOperationInput operationInput = destIntfOperation.getInput(destIntfOperation.getQName());
+            operationInput.removeChildPart(partName);
+         }
+      };
+
+      processBindingReference(destBindingOperation, destIntfOperation, soap11Body, extList, input, cb);
+   }
+
+   private void processBindingOutput(WSDLBindingOperation destBindingOperation, final WSDLInterfaceOperation destIntfOperation, final BindingOperation srcBindingOperation, BindingOutput srcBindingOutput)
+   {
+      log.trace("processBindingInput");
+
+      QName soap11Body = new QName(Constants.NS_SOAP11, "body");
+      List<ExtensibilityElement> extList = srcBindingOutput.getExtensibilityElements();
+      WSDLBindingOperationOutput output = new WSDLBindingOperationOutput(destBindingOperation);
+      destBindingOperation.addOutput(output);
+
+      ReferenceCallback cb = new ReferenceCallback()
+      {
+         public QName getXmlType(String partName)
+         {
+            return srcBindingOperation.getOperation().getOutput().getMessage().getPart(partName).getTypeName();
+         }
+
+         public void removeReference(QName element)
+         {
+            WSDLInterfaceOperationOutput destIntfOutput = destIntfOperation.getOutput(element);
+            if (destIntfOutput == null)
+               destIntfOperation.removeInput(element);
+         }
+
+         public void removeRPCPart(String partName)
+         {
+            QName name = destIntfOperation.getQName();
+            WSDLInterfaceOperationOutput operationOutput = destIntfOperation.getOutput(new QName(name.getNamespaceURI(), name.getLocalPart() + "Response"));
+            operationOutput.removeChildPart(partName);
+         }
+      };
+
+      processBindingReference(destBindingOperation, destIntfOperation, soap11Body, extList, output, cb);
+   }
+
+
+   private void processBindingReference(WSDLBindingOperation destBindingOperation, WSDLInterfaceOperation destIntfOperation,
+         QName soap11Body, List<ExtensibilityElement> extList, WSDLBindingMessageReference reference, ReferenceCallback callback)
+   {
+      for (ExtensibilityElement extElement : extList)
+      {
+         QName elementType = extElement.getElementType();
+         if (soap11Body.equals(elementType) || SOAP12_BODY.equals(elementType))
+         {
+            processEncodingStyle(extElement, destBindingOperation);
+         }
+         else if (extElement instanceof SOAPHeader)
+         {
+            SOAPHeader header = (SOAPHeader)extElement;
+            QName messageQName = header.getMessage();
+            String partName = header.getPart();
+
+            String key = messageQName + "->" + partName;
+            QName elementName = (QName)messagePartToElementMap.get(key);
+            if (elementName == null)
+               throw new WSException("Could not determine element name from header: " + partName);
+
+            reference.addSoapHeader(new WSDLSOAPHeader(elementName, partName));
+            if (Constants.URI_STYLE_IRI == destIntfOperation.getStyle())
+            {
+               callback.removeReference(elementName);
+            }
+            else
+            {
+               // Just in case
+               callback.removeRPCPart(partName);
+            }
+         }
+         else if (extElement instanceof MIMEMultipartRelated)
+         {
+            MIMEMultipartRelated related = (MIMEMultipartRelated)extElement;
+            Iterator i = related.getMIMEParts().iterator();
+            while (i.hasNext())
+            {
+               MIMEPart part = (MIMEPart)i.next();
+               Iterator j = part.getExtensibilityElements().iterator();
+               String name = null;
+               String types = null;
+
+               while (j.hasNext())
+               {
+                  ExtensibilityElement inner = (ExtensibilityElement)j.next();
+                  if (inner instanceof MIMEContent)
+                  {
+                     MIMEContent content = (MIMEContent)inner;
+                     name = content.getPart();
+                     if (types == null)
+                     {
+                        types = content.getType();
+                     }
+                     else
+                     {
+                        types += "," + content.getType();
+                     }
+                  }
+               }
+
+               // Found content types in this part
+               if (name != null)
+               {
+                  QName xmlType  = callback.getXmlType(name);
+                  reference.addMimePart(new WSDLMIMEPart(name, xmlType, types));
+                  if (Constants.URI_STYLE_IRI == destIntfOperation.getStyle())
+                  {
+                     // A mime part must be defined as <part type="">
+                     callback.removeReference(new QName(name));
+                  }
+                  else
+                  {
+                     callback.removeRPCPart(name);
+                  }
+               }
+            }
+         }
+      }
+   }
+
+
+   private void processEncodingStyle(ExtensibilityElement extElement, WSDLBindingOperation destBindingOperation)
+   {
+      log.trace("processEncodingStyle");
+
+      String encStyle = null;
+      QName elementType = extElement.getElementType();
+      if (extElement instanceof SOAPBody)
+      {
+         SOAPBody body = (SOAPBody)extElement;
+         List encStyleList = body.getEncodingStyles();
+         if (encStyleList != null)
+         {
+            if (encStyleList.size() > 1)
+               log.warn("Multiple encoding styles not supported: " + encStyleList);
+
+            if (encStyleList.size() > 0)
+            {
+               encStyle = (String)encStyleList.get(0);
+            }
+         }
+      }
+      else if (SOAP12_BODY.equals(elementType))
+      {
+         Element domElement = ((UnknownExtensibilityElement)extElement).getElement();
+         encStyle = getOptionalAttribute(domElement, "encodingStyle");
+      }
+
+      if (encStyle != null)
+      {
+         String setStyle = destBindingOperation.getEncodingStyle();
+         if (encStyle.equals(setStyle) == false)
+            log.warn("Encoding style '" + encStyle + "' not supported for: " + destBindingOperation.getRef());
+
+         destBindingOperation.setEncodingStyle(encStyle);
+      }
+   }
+
+   private void processServices(Definition srcWsdl)
+   {
+      log.trace("BEGIN processServices: " + srcWsdl.getDocumentBaseURI());
+
+      // Each definition needs a clear binding cache
+      allBindings = null;
+
+      if (srcWsdl.getServices().size() > 0)
+      {
+         Iterator it = srcWsdl.getServices().values().iterator();
+         while (it.hasNext())
+         {
+            Service srcService = (Service)it.next();
+            QName qname = srcService.getQName();
+            WSDLService destService = new WSDLService(destWsdl);
+            destService.setName(new NCName(qname));
+            destService.setQName(qname);
+            destWsdl.addService(destService);
+            processPorts(srcWsdl, destService, srcService);
+         }
+      }
+      else
+      {
+         log.trace("Empty wsdl services, processing imports");
+         Iterator it = srcWsdl.getImports().values().iterator();
+         while (it.hasNext())
+         {
+            List<Import> srcImports = (List<Import>)it.next();
+            for (Import srcImport : srcImports)
+            {
+               Definition importDefinition = srcImport.getDefinition();
+               processServices(importDefinition);
+            }
+         }
+
+         // The binding cache must be clear after imports, so that undefined bindings can be located
+         allBindings = null;
+      }
+
+      log.trace("END processServices: " + srcWsdl.getDocumentBaseURI());
+   }
+
+   private void processPorts(Definition srcWsdl, WSDLService destService, Service srcService)
+   {
+      Iterator it = srcService.getPorts().values().iterator();
+      while (it.hasNext())
+      {
+         Port srcPort = (Port)it.next();
+         processPort(srcWsdl, destService, srcPort);
+      }
+   }
+
+   private void processPort(Definition srcWsdl, WSDLService destService, Port srcPort)
+   {
+      log.trace("processPort: " + srcPort.getName());
+
+      Binding srcBinding = srcPort.getBinding();
+
+      WSDLEndpoint destEndpoint = new WSDLEndpoint(destService);
+      destEndpoint.setName(new NCName(srcPort.getName()));
+      destEndpoint.setBinding(srcBinding.getQName());
+      destEndpoint.setQName(new QName(srcWsdl.getTargetNamespace(), srcPort.getName()));
+      destEndpoint.setAddress(getSOAPAddress(srcPort));
+      destService.addEndpoint(destEndpoint);
+
+      processBinding(srcWsdl, srcBinding);
+   }
+
+   /** Get the endpoint address from the ports extensible element
+    */
+   private String getSOAPAddress(Port srcPort)
+   {
+      String soapAddress = "dummy";
+
+      Iterator it = srcPort.getExtensibilityElements().iterator();
+      while (it.hasNext())
+      {
+         ExtensibilityElement extElement = (ExtensibilityElement)it.next();
+         QName elementType = extElement.getElementType();
+
+         if (extElement instanceof SOAPAddress)
+         {
+            SOAPAddress addr = (SOAPAddress)extElement;
+            soapAddress = addr.getLocationURI();
+            break;
+         }
+         else if (SOAP12_ADDRESS.equals(elementType))
+         {
+            Element domElement = ((UnknownExtensibilityElement)extElement).getElement();
+            soapAddress = getOptionalAttribute(domElement, "location");
+            break;
+         }
+         else if ("address".equals(elementType.getLocalPart()))
+         {
+            log.warn("Unprocessed extension element: " + elementType);
+         }
+      }
+
+      if (soapAddress == null)
+         throw new WSException("Cannot obtain SOAP address");
+
+      return soapAddress;
+   }
+
+   private String getOptionalAttribute(Element domElement, String attrName)
+   {
+      String attrValue = domElement.getAttribute(attrName);
+      return (attrValue.length() > 0 ? attrValue : null);
+   }
+}

Deleted: branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/wsdl/WSDL11Writer.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Writer.java	2006-12-06 14:11:26 UTC (rev 1573)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/wsdl/WSDL11Writer.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -1,538 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.ws.tools.wsdl;
-
-import java.io.IOException;
-import java.io.Writer;
-import java.util.Arrays;
-import java.util.HashSet;
-
-import javax.wsdl.Definition;
-import javax.wsdl.WSDLException;
-import javax.wsdl.factory.WSDLFactory;
-import javax.xml.namespace.QName;
-
-import org.jboss.ws.common.Constants;
-import org.jboss.ws.common.WSException;
-import org.jboss.ws.common.metadata.wsdl.NCName;
-import org.jboss.ws.common.metadata.wsdl.WSDLBinding;
-import org.jboss.ws.common.metadata.wsdl.WSDLBindingMessageReference;
-import org.jboss.ws.common.metadata.wsdl.WSDLBindingOperation;
-import org.jboss.ws.common.metadata.wsdl.WSDLBindingOperationInput;
-import org.jboss.ws.common.metadata.wsdl.WSDLBindingOperationOutput;
-import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.common.metadata.wsdl.WSDLEndpoint;
-import org.jboss.ws.common.metadata.wsdl.WSDLImport;
-import org.jboss.ws.common.metadata.wsdl.WSDLInterface;
-import org.jboss.ws.common.metadata.wsdl.WSDLInterfaceFault;
-import org.jboss.ws.common.metadata.wsdl.WSDLInterfaceMessageReference;
-import org.jboss.ws.common.metadata.wsdl.WSDLInterfaceOperation;
-import org.jboss.ws.common.metadata.wsdl.WSDLInterfaceOperationInput;
-import org.jboss.ws.common.metadata.wsdl.WSDLInterfaceOperationOutfault;
-import org.jboss.ws.common.metadata.wsdl.WSDLInterfaceOperationOutput;
-import org.jboss.ws.common.metadata.wsdl.WSDLRPCPart;
-import org.jboss.ws.common.metadata.wsdl.WSDLRPCSignatureItem;
-import org.jboss.ws.common.metadata.wsdl.WSDLSOAPHeader;
-import org.jboss.ws.common.metadata.wsdl.WSDLService;
-import org.jboss.ws.common.metadata.wsdl.WSDLRPCSignatureItem.Direction;
-import org.jboss.ws.common.utils.DOMUtils;
-import org.jboss.ws.common.utils.DOMWriter;
-import org.w3c.dom.Element;
-
-/**
- * A WSDL Writer that writes a WSDL 1.1 file. It works off
- * of the WSDL20 Object Graph.
- * @author <mailto:Anil.Saldhana at jboss.org>Anil Saldhana
- */
-public class WSDL11Writer extends WSDLWriter
-{
-   //Used Internally
-   private String wsdlStyle = Constants.RPC_LITERAL;
-
-   // Used to prevent duplicates
-   private HashSet<String> writtenFaultMessages = new HashSet<String>();
-
-   /** Use WSDLDefinitions.writeWSDL instead. */
-   public WSDL11Writer(WSDLDefinitions wsdl)
-   {
-      super(wsdl);
-   }
-
-   public void write(Writer writer) throws IOException
-   {
-      write(writer, null);
-   }
-
-
-   public void write(Writer writer, String charset) throws IOException
-   {
-      write(writer, charset, null);
-   }
-
-   public void write(Writer writer, String charset, WSDLWriterResolver resolver) throws IOException
-   {
-      // Write out the wsdl-1.1 represention (only path to obtain is from WSDL11Reader)
-      if (wsdl.getWsdlOneOneDefinition() != null)
-      {
-        Definition wsdlDefinition = wsdl.getWsdlOneOneDefinition();
-        try
-        {
-           WSDLFactory wsdlFactory = WSDLFactory.newInstance();
-           javax.wsdl.xml.WSDLWriter wsdlWriter = wsdlFactory.newWSDLWriter();
-           wsdlWriter.writeWSDL(wsdlDefinition, writer);
-        }
-        catch (WSDLException e)
-        {
-           this.logException(e);
-           throw new IOException(e.toString());
-        }
-      }
-      else
-      {
-         StringBuilder buffer = new StringBuilder();
-
-         //Detect the WSDL Style early
-         wsdlStyle = utils.getWSDLStyle(wsdl);
-
-         StringBuilder importBuffer = new StringBuilder();
-         for (WSDLImport wsdlImport : wsdl.getImports())
-         {
-            if (resolver == null)
-               continue;
-
-            WSDLWriterResolver resolved = resolver.resolve(wsdlImport.getLocation());
-            if (resolved == null)
-               continue;
-
-            String namespace = wsdlImport.getNamespace();
-            importBuffer.append("<import namespace='" + namespace + "' location='" + resolved.actualFile + "'/>");
-            if (resolved != null)
-            {
-               StringBuilder builder = new StringBuilder();
-
-               appendDefinitions(builder, namespace);
-               appendBody(builder, namespace);
-               writeBuilder(builder, resolved.writer, resolved.charset);
-               resolved.writer.close();
-            }
-         }
-
-         appendDefinitions(buffer, wsdl.getTargetNamespace());
-         if (importBuffer.length() > 0)
-            buffer.append(importBuffer);
-
-         appendBody(buffer, wsdl.getTargetNamespace());
-         writeBuilder(buffer, writer, charset);
-      }
-   }
-
-   private void writeBuilder(StringBuilder builder, Writer writer, String charset) throws IOException
-   {
-      Element element = DOMUtils.parse(builder.toString());
-
-      if (charset != null)
-         writer.write("<?xml version=\"1.0\" encoding=\"" + charset + "\"?>\n");
-      new DOMWriter(writer).setPrettyprint(true).print(element);
-   }
-
-   protected void appendBody(StringBuilder builder, String namespace)
-   {
-      writtenFaultMessages.clear();
-
-      appendTypes(builder, namespace);
-      appendMessages(builder, namespace);
-      appendInterfaces(builder, namespace);
-      appendBindings(builder, namespace);
-      appendServices(builder, namespace);
-      builder.append("</definitions>");
-   }
-
-   protected void appendMessages(StringBuilder buffer, String namespace)
-   {
-      WSDLInterface[] interfaces = wsdl.getInterfaces();
-      int len = interfaces != null ? interfaces.length : 0;
-      for (int i = 0; i < len; i++)
-      {
-         WSDLInterface intf = interfaces[i];
-         if (! namespace.equals(intf.getQName().getNamespaceURI()))
-            continue;
-
-         WSDLInterfaceOperation[] operations = intf.getSortedOperations();
-         int lenOps = operations.length;
-         for (int j = 0; j < lenOps; j++)
-         {
-            appendMessage(buffer, operations[j]);
-            appendMessagesForExceptions(buffer, operations[j]);
-         }
-      }
-   }
-
-   private void appendMessage(StringBuilder buffer, WSDLInterfaceOperation operation)
-   {
-      String opname = operation.getName().toString();
-      //Determine the style of the wsdl
-      if (Constants.URI_STYLE_RPC.equals(operation.getStyle()) == false)
-         wsdlStyle = Constants.DOCUMENT_LITERAL; //Not RPC/Literal
-
-      String interfaceName = operation.getWsdlInterface().getName().toString();
-      buffer.append("<message name='" + interfaceName + "_" + opname + "' >");
-      for (WSDLInterfaceOperationInput input : operation.getInputs())
-         appendMessageParts(buffer, input);
-      buffer.append("</message>");
-
-      if (! Constants.WSDL20_PATTERN_IN_ONLY.equals(operation.getPattern()))
-      {
-         buffer.append("<message name='" + interfaceName + "_" + opname + "Response' >");
-         WSDLInterfaceOperationOutput[] outputs = operation.getOutputs();
-         for (WSDLInterfaceOperationOutput output : outputs)
-            appendMessageParts(buffer, output);
-         buffer.append("</message>");
-      }
-   }
-
-   private void appendMessagesForExceptions(StringBuilder buffer, WSDLInterfaceOperation operation)
-   {
-      //Get the outfaults
-      WSDLInterfaceOperationOutfault[] faults = operation.getOutfaults();
-      int len = faults != null ? faults.length : 0;
-
-      for (int i = 0; i < len; i++)
-      {
-         WSDLInterfaceOperationOutfault fault = faults[i];
-         String exceptionName = fault.getRef().getLocalPart();
-         if (writtenFaultMessages.contains(exceptionName))
-            continue;
-
-         WSDLInterfaceFault interfaceFault = operation.getWsdlInterface().getFault(new NCName(exceptionName));
-         QName xmlName = interfaceFault.getElement();
-
-         buffer.append("<message name='" + exceptionName + "' >");
-         String prefix = wsdl.getPrefix(xmlName.getNamespaceURI());
-         String xmlNameStr = prefix + ":" + xmlName.getLocalPart();
-         buffer.append("<part name='" + exceptionName + "' element='" + xmlNameStr + "' />");
-         buffer.append("</message>");
-
-         writtenFaultMessages.add(exceptionName);
-      }
-   }
-
-   private String getReferenceString(QName name)
-   {
-      String namespaceURI = name.getNamespaceURI();
-      String prefix = wsdl.getPrefix(namespaceURI);
-      if (prefix == null)
-         throw new WSException("Prefix not bound for namespace: " + namespaceURI);
-
-      return prefix + ":" + name.getLocalPart();
-   }
-
-   private void appendMessageParts(StringBuilder buffer, WSDLInterfaceMessageReference reference)
-   {
-      if (wsdlStyle.equals(Constants.RPC_LITERAL))
-      {
-         for (WSDLRPCPart part : reference.getChildParts())
-         {
-            buffer.append("<part name='" + part.getName()).append('\'');
-            buffer.append(" type='" + getReferenceString(part.getType()) + "'/>");
-         }
-      }
-      else
-      {
-         QName element = reference.getElement();
-         // Null represents empty message
-         if (element != null)
-         {
-            buffer.append("<part name='" + reference.getPartName() + '\'');
-            buffer.append(" element='" + getReferenceString(element) + "'/>");
-         }
-      }
-
-      WSDLBindingMessageReference bindingReference = getBindingReference(reference);
-      if (bindingReference == null)
-         return;
-
-      for (WSDLSOAPHeader header : bindingReference.getSoapHeaders())
-      {
-         if (header.isIncludeInSignature());
-         {
-            QName element = header.getElement();
-            buffer.append("<part name='" + header.getPartName() + '\'');
-            buffer.append(" element='" + getReferenceString(element) + "'/>");
-         }
-      }
-   }
-
-   private WSDLBindingMessageReference getBindingReference(WSDLInterfaceMessageReference reference)
-   {
-      WSDLInterfaceOperation operation = reference.getWsdlOperation();
-      WSDLInterface wsdlInterface = operation.getWsdlInterface();
-      WSDLBinding binding = wsdlInterface.getWsdlDefinitions().getBindingByInterfaceName(wsdlInterface.getQName());
-      WSDLBindingOperation bindingOperation = binding.getOperationByRef(operation.getQName());
-      WSDLBindingMessageReference[] bindingReferences;
-
-      if (reference instanceof WSDLInterfaceOperationInput)
-         bindingReferences = bindingOperation.getInputs();
-      else
-         bindingReferences = bindingOperation.getOutputs();
-
-      if (bindingReferences.length > 1)
-         throw new IllegalArgumentException("WSDl 1.1 only supports In-Only, and In-Out MEPS, more than reference input found");
-
-      if (bindingReferences.length == 1)
-         return bindingReferences[0];
-
-      return null;
-   }
-
-   protected void appendInterfaces(StringBuilder buffer, String namespace)
-   {
-      WSDLInterface[] intfs = wsdl.getInterfaces();
-      for (int i = 0; i < intfs.length; i++)
-      {
-         WSDLInterface intf = intfs[i];
-         if (!namespace.equals(intf.getQName().getNamespaceURI()))
-            continue;
-
-         buffer.append("<portType name='" + intf.getName() + "'>");
-         appendPortOperations(buffer, intf);
-         buffer.append("</portType>");
-      }
-   }
-
-   private String getParameterOrder(WSDLInterfaceOperation operation)
-   {
-      StringBuilder builder = new StringBuilder();
-      for (WSDLRPCSignatureItem item : operation.getRpcSignatureItems())
-      {
-         if (item.getDirection() != Direction.RETURN)
-         {
-            if (builder.length() > 0)
-               builder.append(' ');
-            builder.append(item.getName());
-         }
-      }
-
-      return builder.toString();
-   }
-
-   protected void appendPortOperations(StringBuilder buffer, WSDLInterface intf)
-   {
-      String prefix = wsdl.getPrefix(intf.getQName().getNamespaceURI());
-      WSDLInterfaceOperation[] operations = intf.getSortedOperations();
-      for (int i = 0; i < operations.length; i++)
-      {
-         WSDLInterfaceOperation operation = operations[i];
-         buffer.append("<operation name='" + operation.getName().toString() + "'");
-
-         String parameterOrder = getParameterOrder(operation);
-         if (parameterOrder.length() > 0)
-            buffer.append(" parameterOrder='").append(parameterOrder).append("'");
-         buffer.append(">");
-
-         String opname = operation.getName().toString();
-         String interfaceName = operation.getWsdlInterface().getName().toString();
-         String msgEl = prefix + ":" + interfaceName + "_" + opname;
-
-         buffer.append("<input message='" + msgEl + "'>").append("</input>");
-
-         if (! Constants.WSDL20_PATTERN_IN_ONLY.equals(operation.getPattern()))
-         {
-            buffer.append("<output message='" + msgEl + "Response'>");
-            buffer.append("</output>");
-         }
-
-         //Append the Faults
-         for (WSDLInterfaceOperationOutfault fault : operation.getOutfaults())
-         {
-            QName element = fault.getRef();
-            buffer.append("<fault  message='" + utils.getFormattedString(element));
-            buffer.append("' name='" + element.getLocalPart() + "'/>");
-         }
-
-         buffer.append("</operation>");
-      }
-   }
-
-   protected void appendBindings(StringBuilder buffer, String namespace)
-   {
-      WSDLBinding[] bindings = wsdl.getBindings();
-      for (int i = 0; i < bindings.length; i++)
-      {
-         WSDLBinding binding = bindings[i];
-         if (!namespace.equals(binding.getQName().getNamespaceURI()))
-            continue;
-         buffer.append("<binding name='" + binding.getName() + "' type='" + getQNameRef(binding.getInterfaceName()) + "'>");
-         //TODO:Need to derive the WSDLStyle from the Style attribute of InterfaceOperation
-         if (wsdlStyle == null)
-            throw new IllegalArgumentException("WSDL Style is null (should be rpc or document");
-         String style = "rpc";
-         if (wsdlStyle.equals(Constants.DOCUMENT_LITERAL))
-            style = "document";
-         buffer.append("<" + soapPrefix + ":binding transport='http://schemas.xmlsoap.org/soap/http' style='" + style + "'/>");
-         appendBindingOperations(buffer, binding);
-         buffer.append("</binding>");
-      }
-   }
-
-   protected void appendBindingOperations(StringBuilder buffer, WSDLBinding binding)
-   {
-      WSDLBindingOperation[] operations = binding.getOperations();
-      Arrays.sort(operations);
-
-      for (int i = 0; i < operations.length; i++)
-      {
-         WSDLBindingOperation operation = operations[i];
-         String interfaceName = operation.getWsdlBinding().getInterfaceName().getLocalPart();
-
-         WSDLInterface wsdlInterface = wsdl.getInterface(new NCName(interfaceName));
-         if (wsdlInterface == null)
-            throw new WSException("WSDL Interface should not be null");
-         WSDLInterfaceOperation interfaceOperation = wsdlInterface.getOperation(new NCName(operation.getRef().getLocalPart()));
-
-         buffer.append("<operation name='" + interfaceOperation.getName() + "'>");
-         String soapAction = (operation.getSOAPAction() != null ? operation.getSOAPAction() : "");
-         buffer.append("<" + soapPrefix + ":operation soapAction=\"" + soapAction + "\"/>");
-
-         WSDLBindingOperationInput[] inputs = operation.getInputs();
-         if (inputs.length != 1)
-            throw new WSException("WSDl 1.1 only supports In-Only, and In-Out MEPS.");
-
-         buffer.append("<input>");
-         appendSOAPBinding(buffer, wsdlInterface, operation, inputs);
-         buffer.append("</input>");
-
-         if (! Constants.WSDL20_PATTERN_IN_ONLY.equals(getBindingOperationPattern(operation)))
-         {
-            buffer.append("<output>");
-            WSDLBindingOperationOutput[] outputs = operation.getOutputs();
-            appendSOAPBinding(buffer, wsdlInterface, operation, outputs);
-            buffer.append("</output>");
-         }
-
-         //Append faults
-         WSDLInterfaceOperationOutfault[] faults = interfaceOperation.getOutfaults();
-         if (faults != null)
-         {
-            for (WSDLInterfaceOperationOutfault fault : faults)
-            {
-               String n = "name='" + fault.getRef().getLocalPart() + "'";
-               buffer.append("<fault  " + n + ">");
-               buffer.append("<" + soapPrefix + ":fault  " + n + " use='literal' />");
-               buffer.append("</fault>");
-            }
-            buffer.append("</operation>");
-         }
-      }
-   }
-
-   private void appendSOAPBinding(StringBuilder buffer, WSDLInterface wsdlInterface, WSDLBindingOperation operation, WSDLBindingMessageReference[] inputs)
-   {
-      String tns = wsdl.getTargetNamespace();
-      WSDLInterfaceOperation interfaceOperation = wsdlInterface.getOperation(new NCName(operation.getRef().getLocalPart()));
-      WSDLInterfaceMessageReference reference = (inputs instanceof WSDLBindingOperationInput[]) ? interfaceOperation.getInputs()[0]
-            : interfaceOperation.getOutputs()[0];
-
-      StringBuilder bodyParts = new StringBuilder();
-      if (Constants.DOCUMENT_LITERAL == wsdlStyle)
-      {
-         bodyParts.append(reference.getPartName());
-      }
-      else
-      {
-         for (WSDLRPCPart part : reference.getChildParts())
-         {
-            if (bodyParts.length() > 0)
-               bodyParts.append(" ");
-            bodyParts.append(part.getName());
-         }
-      }
-
-      StringBuilder soapHeader = new StringBuilder();
-      for (WSDLSOAPHeader header : inputs[0].getSoapHeaders())
-      {
-         if (header.isIncludeInSignature())
-         {
-            String messageName = wsdlInterface.getName() + "_" + operation.getRef().getLocalPart();
-            if (reference instanceof WSDLInterfaceOperationOutput)
-               messageName += "Response";
-            soapHeader.append("<").append(soapPrefix).append(":header use='literal' message='tns:").append(messageName);
-            soapHeader.append("' part='").append(header.getElement().getLocalPart()).append("'/>");
-         }
-      }
-
-      buffer.append("<" + soapPrefix + ":body use='literal'");
-      if (wsdlStyle != Constants.DOCUMENT_LITERAL)
-         buffer.append(" namespace='" + tns + "'");
-      if (soapHeader.length() > 0)
-      {
-         buffer.append(" parts='").append(bodyParts).append("'/>");
-         buffer.append(soapHeader);
-      }
-      else
-      {
-         buffer.append("/>");
-      }
-   }
-
-   private String getBindingOperationPattern(WSDLBindingOperation operation)
-   {
-      WSDLBinding binding = operation.getWsdlBinding();
-      String pattern = binding.getInterface().getOperation(new NCName(operation.getRef().getLocalPart())).getPattern();
-
-      return pattern;
-   }
-
-   protected void appendServices(StringBuilder buffer, String namespace)
-   {
-      WSDLService[] services = wsdl.getServices();
-      int len = services.length;
-      for (int i = 0; i < len; i++)
-      {
-
-         WSDLService service = services[i];
-         if (!namespace.equals(service.getQName().getNamespaceURI()))
-            continue;
-         buffer.append("<service name='" + service.getName() + "'>");
-         WSDLEndpoint[] endpoints = service.getEndpoints();
-         int lenend = endpoints.length;
-         for (int j = 0; j < lenend; j++)
-         {
-            WSDLEndpoint endpoint = endpoints[j];
-            appendServicePort(buffer, endpoint);
-         }
-
-         buffer.append("</service>");
-      }
-   }
-
-   protected void appendServicePort(StringBuilder buffer, WSDLEndpoint endpoint)
-   {
-      String name = endpoint.getName().toString();
-      QName endpointBinding = endpoint.getBinding();
-      String prefix = endpointBinding.getPrefix();
-      prefix = wsdl.getPrefix(endpointBinding.getNamespaceURI());
-      String ebname = prefix + ":" + endpointBinding.getLocalPart();
-      buffer.append("<port name='" + name + "' binding='" + ebname + "'>");
-      buffer.append("<" + soapPrefix + ":address location='" + endpoint.getAddress() + "'/>");
-      buffer.append("</port>");
-   }
-}
\ No newline at end of file

Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/wsdl/WSDL11Writer.java (from rev 1574, branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Writer.java)
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Writer.java	2006-12-06 14:12:50 UTC (rev 1574)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/wsdl/WSDL11Writer.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -0,0 +1,538 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.ws.common.wsdl;
+
+import java.io.IOException;
+import java.io.Writer;
+import java.util.Arrays;
+import java.util.HashSet;
+
+import javax.wsdl.Definition;
+import javax.wsdl.WSDLException;
+import javax.wsdl.factory.WSDLFactory;
+import javax.xml.namespace.QName;
+
+import org.jboss.ws.common.Constants;
+import org.jboss.ws.common.WSException;
+import org.jboss.ws.common.metadata.wsdl.NCName;
+import org.jboss.ws.common.metadata.wsdl.WSDLBinding;
+import org.jboss.ws.common.metadata.wsdl.WSDLBindingMessageReference;
+import org.jboss.ws.common.metadata.wsdl.WSDLBindingOperation;
+import org.jboss.ws.common.metadata.wsdl.WSDLBindingOperationInput;
+import org.jboss.ws.common.metadata.wsdl.WSDLBindingOperationOutput;
+import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
+import org.jboss.ws.common.metadata.wsdl.WSDLEndpoint;
+import org.jboss.ws.common.metadata.wsdl.WSDLImport;
+import org.jboss.ws.common.metadata.wsdl.WSDLInterface;
+import org.jboss.ws.common.metadata.wsdl.WSDLInterfaceFault;
+import org.jboss.ws.common.metadata.wsdl.WSDLInterfaceMessageReference;
+import org.jboss.ws.common.metadata.wsdl.WSDLInterfaceOperation;
+import org.jboss.ws.common.metadata.wsdl.WSDLInterfaceOperationInput;
+import org.jboss.ws.common.metadata.wsdl.WSDLInterfaceOperationOutfault;
+import org.jboss.ws.common.metadata.wsdl.WSDLInterfaceOperationOutput;
+import org.jboss.ws.common.metadata.wsdl.WSDLRPCPart;
+import org.jboss.ws.common.metadata.wsdl.WSDLRPCSignatureItem;
+import org.jboss.ws.common.metadata.wsdl.WSDLSOAPHeader;
+import org.jboss.ws.common.metadata.wsdl.WSDLService;
+import org.jboss.ws.common.metadata.wsdl.WSDLRPCSignatureItem.Direction;
+import org.jboss.ws.common.utils.DOMUtils;
+import org.jboss.ws.common.utils.DOMWriter;
+import org.w3c.dom.Element;
+
+/**
+ * A WSDL Writer that writes a WSDL 1.1 file. It works off
+ * of the WSDL20 Object Graph.
+ * @author <mailto:Anil.Saldhana at jboss.org>Anil Saldhana
+ */
+public class WSDL11Writer extends WSDLWriter
+{
+   //Used Internally
+   private String wsdlStyle = Constants.RPC_LITERAL;
+
+   // Used to prevent duplicates
+   private HashSet<String> writtenFaultMessages = new HashSet<String>();
+
+   /** Use WSDLDefinitions.writeWSDL instead. */
+   public WSDL11Writer(WSDLDefinitions wsdl)
+   {
+      super(wsdl);
+   }
+
+   public void write(Writer writer) throws IOException
+   {
+      write(writer, null);
+   }
+
+
+   public void write(Writer writer, String charset) throws IOException
+   {
+      write(writer, charset, null);
+   }
+
+   public void write(Writer writer, String charset, WSDLWriterResolver resolver) throws IOException
+   {
+      // Write out the wsdl-1.1 represention (only path to obtain is from WSDL11Reader)
+      if (wsdl.getWsdlOneOneDefinition() != null)
+      {
+        Definition wsdlDefinition = wsdl.getWsdlOneOneDefinition();
+        try
+        {
+           WSDLFactory wsdlFactory = WSDLFactory.newInstance();
+           javax.wsdl.xml.WSDLWriter wsdlWriter = wsdlFactory.newWSDLWriter();
+           wsdlWriter.writeWSDL(wsdlDefinition, writer);
+        }
+        catch (WSDLException e)
+        {
+           this.logException(e);
+           throw new IOException(e.toString());
+        }
+      }
+      else
+      {
+         StringBuilder buffer = new StringBuilder();
+
+         //Detect the WSDL Style early
+         wsdlStyle = utils.getWSDLStyle(wsdl);
+
+         StringBuilder importBuffer = new StringBuilder();
+         for (WSDLImport wsdlImport : wsdl.getImports())
+         {
+            if (resolver == null)
+               continue;
+
+            WSDLWriterResolver resolved = resolver.resolve(wsdlImport.getLocation());
+            if (resolved == null)
+               continue;
+
+            String namespace = wsdlImport.getNamespace();
+            importBuffer.append("<import namespace='" + namespace + "' location='" + resolved.actualFile + "'/>");
+            if (resolved != null)
+            {
+               StringBuilder builder = new StringBuilder();
+
+               appendDefinitions(builder, namespace);
+               appendBody(builder, namespace);
+               writeBuilder(builder, resolved.writer, resolved.charset);
+               resolved.writer.close();
+            }
+         }
+
+         appendDefinitions(buffer, wsdl.getTargetNamespace());
+         if (importBuffer.length() > 0)
+            buffer.append(importBuffer);
+
+         appendBody(buffer, wsdl.getTargetNamespace());
+         writeBuilder(buffer, writer, charset);
+      }
+   }
+
+   private void writeBuilder(StringBuilder builder, Writer writer, String charset) throws IOException
+   {
+      Element element = DOMUtils.parse(builder.toString());
+
+      if (charset != null)
+         writer.write("<?xml version=\"1.0\" encoding=\"" + charset + "\"?>\n");
+      new DOMWriter(writer).setPrettyprint(true).print(element);
+   }
+
+   protected void appendBody(StringBuilder builder, String namespace)
+   {
+      writtenFaultMessages.clear();
+
+      appendTypes(builder, namespace);
+      appendMessages(builder, namespace);
+      appendInterfaces(builder, namespace);
+      appendBindings(builder, namespace);
+      appendServices(builder, namespace);
+      builder.append("</definitions>");
+   }
+
+   protected void appendMessages(StringBuilder buffer, String namespace)
+   {
+      WSDLInterface[] interfaces = wsdl.getInterfaces();
+      int len = interfaces != null ? interfaces.length : 0;
+      for (int i = 0; i < len; i++)
+      {
+         WSDLInterface intf = interfaces[i];
+         if (! namespace.equals(intf.getQName().getNamespaceURI()))
+            continue;
+
+         WSDLInterfaceOperation[] operations = intf.getSortedOperations();
+         int lenOps = operations.length;
+         for (int j = 0; j < lenOps; j++)
+         {
+            appendMessage(buffer, operations[j]);
+            appendMessagesForExceptions(buffer, operations[j]);
+         }
+      }
+   }
+
+   private void appendMessage(StringBuilder buffer, WSDLInterfaceOperation operation)
+   {
+      String opname = operation.getName().toString();
+      //Determine the style of the wsdl
+      if (Constants.URI_STYLE_RPC.equals(operation.getStyle()) == false)
+         wsdlStyle = Constants.DOCUMENT_LITERAL; //Not RPC/Literal
+
+      String interfaceName = operation.getWsdlInterface().getName().toString();
+      buffer.append("<message name='" + interfaceName + "_" + opname + "' >");
+      for (WSDLInterfaceOperationInput input : operation.getInputs())
+         appendMessageParts(buffer, input);
+      buffer.append("</message>");
+
+      if (! Constants.WSDL20_PATTERN_IN_ONLY.equals(operation.getPattern()))
+      {
+         buffer.append("<message name='" + interfaceName + "_" + opname + "Response' >");
+         WSDLInterfaceOperationOutput[] outputs = operation.getOutputs();
+         for (WSDLInterfaceOperationOutput output : outputs)
+            appendMessageParts(buffer, output);
+         buffer.append("</message>");
+      }
+   }
+
+   private void appendMessagesForExceptions(StringBuilder buffer, WSDLInterfaceOperation operation)
+   {
+      //Get the outfaults
+      WSDLInterfaceOperationOutfault[] faults = operation.getOutfaults();
+      int len = faults != null ? faults.length : 0;
+
+      for (int i = 0; i < len; i++)
+      {
+         WSDLInterfaceOperationOutfault fault = faults[i];
+         String exceptionName = fault.getRef().getLocalPart();
+         if (writtenFaultMessages.contains(exceptionName))
+            continue;
+
+         WSDLInterfaceFault interfaceFault = operation.getWsdlInterface().getFault(new NCName(exceptionName));
+         QName xmlName = interfaceFault.getElement();
+
+         buffer.append("<message name='" + exceptionName + "' >");
+         String prefix = wsdl.getPrefix(xmlName.getNamespaceURI());
+         String xmlNameStr = prefix + ":" + xmlName.getLocalPart();
+         buffer.append("<part name='" + exceptionName + "' element='" + xmlNameStr + "' />");
+         buffer.append("</message>");
+
+         writtenFaultMessages.add(exceptionName);
+      }
+   }
+
+   private String getReferenceString(QName name)
+   {
+      String namespaceURI = name.getNamespaceURI();
+      String prefix = wsdl.getPrefix(namespaceURI);
+      if (prefix == null)
+         throw new WSException("Prefix not bound for namespace: " + namespaceURI);
+
+      return prefix + ":" + name.getLocalPart();
+   }
+
+   private void appendMessageParts(StringBuilder buffer, WSDLInterfaceMessageReference reference)
+   {
+      if (wsdlStyle.equals(Constants.RPC_LITERAL))
+      {
+         for (WSDLRPCPart part : reference.getChildParts())
+         {
+            buffer.append("<part name='" + part.getName()).append('\'');
+            buffer.append(" type='" + getReferenceString(part.getType()) + "'/>");
+         }
+      }
+      else
+      {
+         QName element = reference.getElement();
+         // Null represents empty message
+         if (element != null)
+         {
+            buffer.append("<part name='" + reference.getPartName() + '\'');
+            buffer.append(" element='" + getReferenceString(element) + "'/>");
+         }
+      }
+
+      WSDLBindingMessageReference bindingReference = getBindingReference(reference);
+      if (bindingReference == null)
+         return;
+
+      for (WSDLSOAPHeader header : bindingReference.getSoapHeaders())
+      {
+         if (header.isIncludeInSignature());
+         {
+            QName element = header.getElement();
+            buffer.append("<part name='" + header.getPartName() + '\'');
+            buffer.append(" element='" + getReferenceString(element) + "'/>");
+         }
+      }
+   }
+
+   private WSDLBindingMessageReference getBindingReference(WSDLInterfaceMessageReference reference)
+   {
+      WSDLInterfaceOperation operation = reference.getWsdlOperation();
+      WSDLInterface wsdlInterface = operation.getWsdlInterface();
+      WSDLBinding binding = wsdlInterface.getWsdlDefinitions().getBindingByInterfaceName(wsdlInterface.getQName());
+      WSDLBindingOperation bindingOperation = binding.getOperationByRef(operation.getQName());
+      WSDLBindingMessageReference[] bindingReferences;
+
+      if (reference instanceof WSDLInterfaceOperationInput)
+         bindingReferences = bindingOperation.getInputs();
+      else
+         bindingReferences = bindingOperation.getOutputs();
+
+      if (bindingReferences.length > 1)
+         throw new IllegalArgumentException("WSDl 1.1 only supports In-Only, and In-Out MEPS, more than reference input found");
+
+      if (bindingReferences.length == 1)
+         return bindingReferences[0];
+
+      return null;
+   }
+
+   protected void appendInterfaces(StringBuilder buffer, String namespace)
+   {
+      WSDLInterface[] intfs = wsdl.getInterfaces();
+      for (int i = 0; i < intfs.length; i++)
+      {
+         WSDLInterface intf = intfs[i];
+         if (!namespace.equals(intf.getQName().getNamespaceURI()))
+            continue;
+
+         buffer.append("<portType name='" + intf.getName() + "'>");
+         appendPortOperations(buffer, intf);
+         buffer.append("</portType>");
+      }
+   }
+
+   private String getParameterOrder(WSDLInterfaceOperation operation)
+   {
+      StringBuilder builder = new StringBuilder();
+      for (WSDLRPCSignatureItem item : operation.getRpcSignatureItems())
+      {
+         if (item.getDirection() != Direction.RETURN)
+         {
+            if (builder.length() > 0)
+               builder.append(' ');
+            builder.append(item.getName());
+         }
+      }
+
+      return builder.toString();
+   }
+
+   protected void appendPortOperations(StringBuilder buffer, WSDLInterface intf)
+   {
+      String prefix = wsdl.getPrefix(intf.getQName().getNamespaceURI());
+      WSDLInterfaceOperation[] operations = intf.getSortedOperations();
+      for (int i = 0; i < operations.length; i++)
+      {
+         WSDLInterfaceOperation operation = operations[i];
+         buffer.append("<operation name='" + operation.getName().toString() + "'");
+
+         String parameterOrder = getParameterOrder(operation);
+         if (parameterOrder.length() > 0)
+            buffer.append(" parameterOrder='").append(parameterOrder).append("'");
+         buffer.append(">");
+
+         String opname = operation.getName().toString();
+         String interfaceName = operation.getWsdlInterface().getName().toString();
+         String msgEl = prefix + ":" + interfaceName + "_" + opname;
+
+         buffer.append("<input message='" + msgEl + "'>").append("</input>");
+
+         if (! Constants.WSDL20_PATTERN_IN_ONLY.equals(operation.getPattern()))
+         {
+            buffer.append("<output message='" + msgEl + "Response'>");
+            buffer.append("</output>");
+         }
+
+         //Append the Faults
+         for (WSDLInterfaceOperationOutfault fault : operation.getOutfaults())
+         {
+            QName element = fault.getRef();
+            buffer.append("<fault  message='" + utils.getFormattedString(element));
+            buffer.append("' name='" + element.getLocalPart() + "'/>");
+         }
+
+         buffer.append("</operation>");
+      }
+   }
+
+   protected void appendBindings(StringBuilder buffer, String namespace)
+   {
+      WSDLBinding[] bindings = wsdl.getBindings();
+      for (int i = 0; i < bindings.length; i++)
+      {
+         WSDLBinding binding = bindings[i];
+         if (!namespace.equals(binding.getQName().getNamespaceURI()))
+            continue;
+         buffer.append("<binding name='" + binding.getName() + "' type='" + getQNameRef(binding.getInterfaceName()) + "'>");
+         //TODO:Need to derive the WSDLStyle from the Style attribute of InterfaceOperation
+         if (wsdlStyle == null)
+            throw new IllegalArgumentException("WSDL Style is null (should be rpc or document");
+         String style = "rpc";
+         if (wsdlStyle.equals(Constants.DOCUMENT_LITERAL))
+            style = "document";
+         buffer.append("<" + soapPrefix + ":binding transport='http://schemas.xmlsoap.org/soap/http' style='" + style + "'/>");
+         appendBindingOperations(buffer, binding);
+         buffer.append("</binding>");
+      }
+   }
+
+   protected void appendBindingOperations(StringBuilder buffer, WSDLBinding binding)
+   {
+      WSDLBindingOperation[] operations = binding.getOperations();
+      Arrays.sort(operations);
+
+      for (int i = 0; i < operations.length; i++)
+      {
+         WSDLBindingOperation operation = operations[i];
+         String interfaceName = operation.getWsdlBinding().getInterfaceName().getLocalPart();
+
+         WSDLInterface wsdlInterface = wsdl.getInterface(new NCName(interfaceName));
+         if (wsdlInterface == null)
+            throw new WSException("WSDL Interface should not be null");
+         WSDLInterfaceOperation interfaceOperation = wsdlInterface.getOperation(new NCName(operation.getRef().getLocalPart()));
+
+         buffer.append("<operation name='" + interfaceOperation.getName() + "'>");
+         String soapAction = (operation.getSOAPAction() != null ? operation.getSOAPAction() : "");
+         buffer.append("<" + soapPrefix + ":operation soapAction=\"" + soapAction + "\"/>");
+
+         WSDLBindingOperationInput[] inputs = operation.getInputs();
+         if (inputs.length != 1)
+            throw new WSException("WSDl 1.1 only supports In-Only, and In-Out MEPS.");
+
+         buffer.append("<input>");
+         appendSOAPBinding(buffer, wsdlInterface, operation, inputs);
+         buffer.append("</input>");
+
+         if (! Constants.WSDL20_PATTERN_IN_ONLY.equals(getBindingOperationPattern(operation)))
+         {
+            buffer.append("<output>");
+            WSDLBindingOperationOutput[] outputs = operation.getOutputs();
+            appendSOAPBinding(buffer, wsdlInterface, operation, outputs);
+            buffer.append("</output>");
+         }
+
+         //Append faults
+         WSDLInterfaceOperationOutfault[] faults = interfaceOperation.getOutfaults();
+         if (faults != null)
+         {
+            for (WSDLInterfaceOperationOutfault fault : faults)
+            {
+               String n = "name='" + fault.getRef().getLocalPart() + "'";
+               buffer.append("<fault  " + n + ">");
+               buffer.append("<" + soapPrefix + ":fault  " + n + " use='literal' />");
+               buffer.append("</fault>");
+            }
+            buffer.append("</operation>");
+         }
+      }
+   }
+
+   private void appendSOAPBinding(StringBuilder buffer, WSDLInterface wsdlInterface, WSDLBindingOperation operation, WSDLBindingMessageReference[] inputs)
+   {
+      String tns = wsdl.getTargetNamespace();
+      WSDLInterfaceOperation interfaceOperation = wsdlInterface.getOperation(new NCName(operation.getRef().getLocalPart()));
+      WSDLInterfaceMessageReference reference = (inputs instanceof WSDLBindingOperationInput[]) ? interfaceOperation.getInputs()[0]
+            : interfaceOperation.getOutputs()[0];
+
+      StringBuilder bodyParts = new StringBuilder();
+      if (Constants.DOCUMENT_LITERAL == wsdlStyle)
+      {
+         bodyParts.append(reference.getPartName());
+      }
+      else
+      {
+         for (WSDLRPCPart part : reference.getChildParts())
+         {
+            if (bodyParts.length() > 0)
+               bodyParts.append(" ");
+            bodyParts.append(part.getName());
+         }
+      }
+
+      StringBuilder soapHeader = new StringBuilder();
+      for (WSDLSOAPHeader header : inputs[0].getSoapHeaders())
+      {
+         if (header.isIncludeInSignature())
+         {
+            String messageName = wsdlInterface.getName() + "_" + operation.getRef().getLocalPart();
+            if (reference instanceof WSDLInterfaceOperationOutput)
+               messageName += "Response";
+            soapHeader.append("<").append(soapPrefix).append(":header use='literal' message='tns:").append(messageName);
+            soapHeader.append("' part='").append(header.getElement().getLocalPart()).append("'/>");
+         }
+      }
+
+      buffer.append("<" + soapPrefix + ":body use='literal'");
+      if (wsdlStyle != Constants.DOCUMENT_LITERAL)
+         buffer.append(" namespace='" + tns + "'");
+      if (soapHeader.length() > 0)
+      {
+         buffer.append(" parts='").append(bodyParts).append("'/>");
+         buffer.append(soapHeader);
+      }
+      else
+      {
+         buffer.append("/>");
+      }
+   }
+
+   private String getBindingOperationPattern(WSDLBindingOperation operation)
+   {
+      WSDLBinding binding = operation.getWsdlBinding();
+      String pattern = binding.getInterface().getOperation(new NCName(operation.getRef().getLocalPart())).getPattern();
+
+      return pattern;
+   }
+
+   protected void appendServices(StringBuilder buffer, String namespace)
+   {
+      WSDLService[] services = wsdl.getServices();
+      int len = services.length;
+      for (int i = 0; i < len; i++)
+      {
+
+         WSDLService service = services[i];
+         if (!namespace.equals(service.getQName().getNamespaceURI()))
+            continue;
+         buffer.append("<service name='" + service.getName() + "'>");
+         WSDLEndpoint[] endpoints = service.getEndpoints();
+         int lenend = endpoints.length;
+         for (int j = 0; j < lenend; j++)
+         {
+            WSDLEndpoint endpoint = endpoints[j];
+            appendServicePort(buffer, endpoint);
+         }
+
+         buffer.append("</service>");
+      }
+   }
+
+   protected void appendServicePort(StringBuilder buffer, WSDLEndpoint endpoint)
+   {
+      String name = endpoint.getName().toString();
+      QName endpointBinding = endpoint.getBinding();
+      String prefix = endpointBinding.getPrefix();
+      prefix = wsdl.getPrefix(endpointBinding.getNamespaceURI());
+      String ebname = prefix + ":" + endpointBinding.getLocalPart();
+      buffer.append("<port name='" + name + "' binding='" + ebname + "'>");
+      buffer.append("<" + soapPrefix + ":address location='" + endpoint.getAddress() + "'/>");
+      buffer.append("</port>");
+   }
+}
\ No newline at end of file

Deleted: branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/wsdl/WSDLDefinitionsFactory.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/wsdl/WSDLDefinitionsFactory.java	2006-12-06 14:11:26 UTC (rev 1573)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/wsdl/WSDLDefinitionsFactory.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -1,196 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.ws.tools.wsdl;
-
-// $Id$
-
-import java.io.InputStream;
-import java.io.StringWriter;
-import java.net.ConnectException;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import javax.wsdl.Definition;
-import javax.wsdl.factory.WSDLFactory;
-import javax.wsdl.xml.WSDLReader;
-import javax.xml.parsers.DocumentBuilder;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.common.Constants;
-import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.common.metadata.wsdl.WSDLException;
-import org.jboss.ws.common.utils.DOMUtils;
-import org.jboss.ws.common.utils.JBossWSEntityResolver;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.xml.sax.EntityResolver;
-
-import com.ibm.wsdl.xml.WSDLReaderImpl;
-
-/**
- * A factory that creates a <code>WSDLDefinitions</code> object from an URL.
- *
- * This implementations deals with different WSDL versions so that clients of this
- * factory do need to know about WSDL version specifics. The Java object view of the
- * WSDL document (WSDLDefinitions) is modeled on WSDL-2.0
- *
- * @author Thomas.Diesler at jboss.org
- * @since 10-Oct-2004
- */
-public class WSDLDefinitionsFactory
-{
-   // provide logging
-   private static final Logger log = Logger.getLogger(WSDLDefinitionsFactory.class);
-
-   // This feature is set by default in wsdl4j, it means the object structure contains the imported arguments
-   public static final String FEATURE_IMPORT_DOCUMENTS = "javax.wsdl.importDocuments";
-   // Set this feature for additional debugging output
-   public static final String FEATURE_VERBOSE = "javax.wsdl.verbose";
-
-   // The WSDL reader features
-   private Map features = new HashMap();
-
-   // Hide constructor
-   private WSDLDefinitionsFactory()
-   {
-   }
-
-   /**
-    * Create a new instance of a wsdl factory
-    */
-   public static WSDLDefinitionsFactory newInstance()
-   {
-      return new WSDLDefinitionsFactory();
-   }
-
-   /**
-    * Set a feature on the underlying reader
-    */
-   public void setFeature(String name, boolean value) throws IllegalArgumentException
-   {
-      features.put(name, new Boolean(value));
-   }
-
-   /**
-    * Read the wsdl document from the given URL
-    */
-   public WSDLDefinitions parse(URL wsdlLocation) throws WSDLException
-   {
-      if (wsdlLocation == null)
-         throw new IllegalArgumentException("URL cannot be null");
-
-      log.debug("parse: " + wsdlLocation.toExternalForm());
-      
-      EntityResolver entityResolver = new JBossWSEntityResolver();
-      WSDLDefinitions wsdlDefinitions = null;
-      try
-      {
-         Document wsdlDoc = getDocument(wsdlLocation);
-         String defaultNamespace = getDefaultNamespace(wsdlDoc);
-         if (Constants.NS_WSDL11.equals(defaultNamespace))
-         {
-            WSDLFactory wsdlFactory = WSDLFactory.newInstance();
-            WSDLReader wsdlReader = wsdlFactory.newWSDLReader();
-            wsdlReader.setFeature("javax.wsdl.verbose", false);
-
-            // Setup reader features
-            Iterator it = features.entrySet().iterator();
-            while (it.hasNext())
-            {
-               Map.Entry entry = (Map.Entry)it.next();
-               String key = (String)entry.getKey();
-               Boolean flag = (Boolean)entry.getValue();
-               wsdlReader.setFeature(key, flag.booleanValue());
-            }
-
-            // Set EntityResolver in patched version of wsdl4j-1.5.2jboss
-            ((WSDLReaderImpl)wsdlReader).setEntityResolver(entityResolver);            
-
-            Definition definition = wsdlReader.readWSDL(new WSDLLocatorImpl(entityResolver, wsdlLocation));
-            wsdlDefinitions = new WSDL11Reader().processDefinition(definition, wsdlLocation);
-            wsdlDefinitions.setWsdlDocument(wsdlDoc);
-         }
-         else
-            throw new WSDLException("Invalid default namespace: " + defaultNamespace);
-
-         if (log.isTraceEnabled())
-         {
-            StringWriter stwr = new StringWriter();
-            WSDL11Writer wsdlWriter = new WSDL11Writer(wsdlDefinitions);
-            wsdlWriter.write(stwr);
-            log.trace("\n" + stwr.toString());
-         }
-      }
-      catch (WSDLException e)
-      {
-         throw e;
-      }
-      catch (RuntimeException rte)
-      {
-         throw rte;
-      }
-      catch (Exception e)
-      {
-         throw new WSDLException(e);
-      }
-
-      return wsdlDefinitions;
-   }
-
-   /** Get the WSDL document.
-    */
-   private Document getDocument(URL wsdlLocation) throws WSDLException
-   {
-      try
-      {
-         InputStream wsdlInputStream = wsdlLocation.openStream();
-         try
-         {
-            DocumentBuilder builder = DOMUtils.getDocumentBuilder();
-            return builder.parse(wsdlInputStream);
-         }
-         finally
-         {
-            wsdlInputStream.close();
-         }
-      }
-      catch (ConnectException ex)
-      {
-         throw new WSDLException("Cannot connect to: " + wsdlLocation);
-      }
-      catch (Exception ex)
-      {
-         throw new WSDLException("Cannot parse wsdlLocation: " + wsdlLocation, ex);
-      }
-   }
-
-   /** Get the default namespace for the given WSDL
-    */
-   private String getDefaultNamespace(Document wsdlDoc) throws WSDLException
-   {
-      Element root = wsdlDoc.getDocumentElement();
-      String defaultNamespace = root.getNamespaceURI();
-      return defaultNamespace;
-   }
-}

Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/wsdl/WSDLDefinitionsFactory.java (from rev 1574, branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/wsdl/WSDLDefinitionsFactory.java)
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/wsdl/WSDLDefinitionsFactory.java	2006-12-06 14:12:50 UTC (rev 1574)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/wsdl/WSDLDefinitionsFactory.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -0,0 +1,196 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.ws.common.wsdl;
+
+// $Id$
+
+import java.io.InputStream;
+import java.io.StringWriter;
+import java.net.ConnectException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.wsdl.Definition;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.parsers.DocumentBuilder;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.common.Constants;
+import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
+import org.jboss.ws.common.metadata.wsdl.WSDLException;
+import org.jboss.ws.common.utils.DOMUtils;
+import org.jboss.ws.common.utils.JBossWSEntityResolver;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.xml.sax.EntityResolver;
+
+import com.ibm.wsdl.xml.WSDLReaderImpl;
+
+/**
+ * A factory that creates a <code>WSDLDefinitions</code> object from an URL.
+ *
+ * This implementations deals with different WSDL versions so that clients of this
+ * factory do need to know about WSDL version specifics. The Java object view of the
+ * WSDL document (WSDLDefinitions) is modeled on WSDL-2.0
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 10-Oct-2004
+ */
+public class WSDLDefinitionsFactory
+{
+   // provide logging
+   private static final Logger log = Logger.getLogger(WSDLDefinitionsFactory.class);
+
+   // This feature is set by default in wsdl4j, it means the object structure contains the imported arguments
+   public static final String FEATURE_IMPORT_DOCUMENTS = "javax.wsdl.importDocuments";
+   // Set this feature for additional debugging output
+   public static final String FEATURE_VERBOSE = "javax.wsdl.verbose";
+
+   // The WSDL reader features
+   private Map features = new HashMap();
+
+   // Hide constructor
+   private WSDLDefinitionsFactory()
+   {
+   }
+
+   /**
+    * Create a new instance of a wsdl factory
+    */
+   public static WSDLDefinitionsFactory newInstance()
+   {
+      return new WSDLDefinitionsFactory();
+   }
+
+   /**
+    * Set a feature on the underlying reader
+    */
+   public void setFeature(String name, boolean value) throws IllegalArgumentException
+   {
+      features.put(name, new Boolean(value));
+   }
+
+   /**
+    * Read the wsdl document from the given URL
+    */
+   public WSDLDefinitions parse(URL wsdlLocation) throws WSDLException
+   {
+      if (wsdlLocation == null)
+         throw new IllegalArgumentException("URL cannot be null");
+
+      log.debug("parse: " + wsdlLocation.toExternalForm());
+      
+      EntityResolver entityResolver = new JBossWSEntityResolver();
+      WSDLDefinitions wsdlDefinitions = null;
+      try
+      {
+         Document wsdlDoc = getDocument(wsdlLocation);
+         String defaultNamespace = getDefaultNamespace(wsdlDoc);
+         if (Constants.NS_WSDL11.equals(defaultNamespace))
+         {
+            WSDLFactory wsdlFactory = WSDLFactory.newInstance();
+            WSDLReader wsdlReader = wsdlFactory.newWSDLReader();
+            wsdlReader.setFeature("javax.wsdl.verbose", false);
+
+            // Setup reader features
+            Iterator it = features.entrySet().iterator();
+            while (it.hasNext())
+            {
+               Map.Entry entry = (Map.Entry)it.next();
+               String key = (String)entry.getKey();
+               Boolean flag = (Boolean)entry.getValue();
+               wsdlReader.setFeature(key, flag.booleanValue());
+            }
+
+            // Set EntityResolver in patched version of wsdl4j-1.5.2jboss
+            ((WSDLReaderImpl)wsdlReader).setEntityResolver(entityResolver);            
+
+            Definition definition = wsdlReader.readWSDL(new WSDLLocatorImpl(entityResolver, wsdlLocation));
+            wsdlDefinitions = new WSDL11Reader().processDefinition(definition, wsdlLocation);
+            wsdlDefinitions.setWsdlDocument(wsdlDoc);
+         }
+         else
+            throw new WSDLException("Invalid default namespace: " + defaultNamespace);
+
+         if (log.isTraceEnabled())
+         {
+            StringWriter stwr = new StringWriter();
+            WSDL11Writer wsdlWriter = new WSDL11Writer(wsdlDefinitions);
+            wsdlWriter.write(stwr);
+            log.trace("\n" + stwr.toString());
+         }
+      }
+      catch (WSDLException e)
+      {
+         throw e;
+      }
+      catch (RuntimeException rte)
+      {
+         throw rte;
+      }
+      catch (Exception e)
+      {
+         throw new WSDLException(e);
+      }
+
+      return wsdlDefinitions;
+   }
+
+   /** Get the WSDL document.
+    */
+   private Document getDocument(URL wsdlLocation) throws WSDLException
+   {
+      try
+      {
+         InputStream wsdlInputStream = wsdlLocation.openStream();
+         try
+         {
+            DocumentBuilder builder = DOMUtils.getDocumentBuilder();
+            return builder.parse(wsdlInputStream);
+         }
+         finally
+         {
+            wsdlInputStream.close();
+         }
+      }
+      catch (ConnectException ex)
+      {
+         throw new WSDLException("Cannot connect to: " + wsdlLocation);
+      }
+      catch (Exception ex)
+      {
+         throw new WSDLException("Cannot parse wsdlLocation: " + wsdlLocation, ex);
+      }
+   }
+
+   /** Get the default namespace for the given WSDL
+    */
+   private String getDefaultNamespace(Document wsdlDoc) throws WSDLException
+   {
+      Element root = wsdlDoc.getDocumentElement();
+      String defaultNamespace = root.getNamespaceURI();
+      return defaultNamespace;
+   }
+}

Deleted: branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/wsdl/WSDLLocatorImpl.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/wsdl/WSDLLocatorImpl.java	2006-12-06 14:11:26 UTC (rev 1573)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/wsdl/WSDLLocatorImpl.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -1,159 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ws.tools.wsdl;
-
-// $Id$
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import javax.wsdl.xml.WSDLLocator;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.common.WSException;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.InputSource;
-
-/* A WSDLLocator that can handle wsdl imports
- */
-class WSDLLocatorImpl implements WSDLLocator
-{
-   // provide logging
-   private static final Logger log = Logger.getLogger(WSDLDefinitionsFactory.class);
-
-   private EntityResolver entityResolver;
-   private URL wsdlURL;
-   private String latestImportURI;
-
-   public WSDLLocatorImpl(EntityResolver entityResolver, URL wsdlFile)
-   {
-      if (wsdlFile == null)
-         throw new IllegalArgumentException("WSDL file argument cannot be null");
-
-      this.entityResolver = entityResolver;
-      this.wsdlURL = wsdlFile;
-   }
-
-   public InputSource getBaseInputSource()
-   {
-      log.trace("getBaseInputSource [wsdlUrl=" + wsdlURL + "]");
-      try
-      {
-         InputStream is = wsdlURL.openStream();
-         if (is == null)
-            throw new IllegalArgumentException("Cannot obtain wsdl from [" + wsdlURL + "]");
-
-         return new InputSource(is);
-      }
-      catch (IOException e)
-      {
-         throw new RuntimeException("Cannot access wsdl from [" + wsdlURL + "], " + e.getMessage());
-      }
-   }
-
-   public String getBaseURI()
-   {
-      return wsdlURL.toExternalForm();
-   }
-
-   public InputSource getImportInputSource(String parent, String resource)
-   {
-      log.trace("getImportInputSource [parent=" + parent + ",resource=" + resource + "]");
-
-      URL parentURL = null;
-      try
-      {
-         parentURL = new URL(parent);
-      }
-      catch (MalformedURLException e)
-      {
-         log.error("Not a valid URL: " + parent);
-         return null;
-      }
-
-      String wsdlImport = null;
-      String external = parentURL.toExternalForm();
-
-      // An external URL
-      if (resource.startsWith("http://") || resource.startsWith("https://"))
-      {
-         wsdlImport = resource;
-      }
-
-      // Absolute path
-      else if (resource.startsWith("/"))
-      {
-         String beforePath = external.substring(0, external.indexOf(parentURL.getPath()));
-         wsdlImport = beforePath + resource;
-      }
-
-      // A relative path
-      else
-      {
-         String parentDir = external.substring(0, external.lastIndexOf("/"));
-
-         // remove references to current dir
-         while (resource.startsWith("./"))
-            resource = resource.substring(2);
-
-         // remove references to parentdir
-         while (resource.startsWith("../"))
-         {
-            parentDir = parentDir.substring(0, parentDir.lastIndexOf("/"));
-            resource = resource.substring(3);
-         }
-
-         wsdlImport = parentDir + "/" + resource;
-      }
-
-      try
-      {
-         log.trace("Trying to resolve: " + wsdlImport);
-         InputSource inputSource = entityResolver.resolveEntity(wsdlImport, wsdlImport);
-         if (inputSource != null)
-         {
-            latestImportURI = wsdlImport;
-         }
-         else
-         {
-            throw new IllegalArgumentException("Cannot resolve imported resource: " + wsdlImport);
-         }
-
-         return inputSource;
-      }
-      catch (RuntimeException rte)
-      {
-         throw rte;
-      }
-      catch (Exception e)
-      {
-         throw new WSException("Cannot access imported wsdl [" + wsdlImport + "], " + e.getMessage());
-      }
-   }
-
-   public String getLatestImportURI()
-   {
-      return latestImportURI;
-   }
-}

Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/wsdl/WSDLLocatorImpl.java (from rev 1574, branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/wsdl/WSDLLocatorImpl.java)
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/wsdl/WSDLLocatorImpl.java	2006-12-06 14:12:50 UTC (rev 1574)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/wsdl/WSDLLocatorImpl.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -0,0 +1,159 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ws.common.wsdl;
+
+// $Id$
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.wsdl.xml.WSDLLocator;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.common.WSException;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+
+/* A WSDLLocator that can handle wsdl imports
+ */
+class WSDLLocatorImpl implements WSDLLocator
+{
+   // provide logging
+   private static final Logger log = Logger.getLogger(WSDLDefinitionsFactory.class);
+
+   private EntityResolver entityResolver;
+   private URL wsdlURL;
+   private String latestImportURI;
+
+   public WSDLLocatorImpl(EntityResolver entityResolver, URL wsdlFile)
+   {
+      if (wsdlFile == null)
+         throw new IllegalArgumentException("WSDL file argument cannot be null");
+
+      this.entityResolver = entityResolver;
+      this.wsdlURL = wsdlFile;
+   }
+
+   public InputSource getBaseInputSource()
+   {
+      log.trace("getBaseInputSource [wsdlUrl=" + wsdlURL + "]");
+      try
+      {
+         InputStream is = wsdlURL.openStream();
+         if (is == null)
+            throw new IllegalArgumentException("Cannot obtain wsdl from [" + wsdlURL + "]");
+
+         return new InputSource(is);
+      }
+      catch (IOException e)
+      {
+         throw new RuntimeException("Cannot access wsdl from [" + wsdlURL + "], " + e.getMessage());
+      }
+   }
+
+   public String getBaseURI()
+   {
+      return wsdlURL.toExternalForm();
+   }
+
+   public InputSource getImportInputSource(String parent, String resource)
+   {
+      log.trace("getImportInputSource [parent=" + parent + ",resource=" + resource + "]");
+
+      URL parentURL = null;
+      try
+      {
+         parentURL = new URL(parent);
+      }
+      catch (MalformedURLException e)
+      {
+         log.error("Not a valid URL: " + parent);
+         return null;
+      }
+
+      String wsdlImport = null;
+      String external = parentURL.toExternalForm();
+
+      // An external URL
+      if (resource.startsWith("http://") || resource.startsWith("https://"))
+      {
+         wsdlImport = resource;
+      }
+
+      // Absolute path
+      else if (resource.startsWith("/"))
+      {
+         String beforePath = external.substring(0, external.indexOf(parentURL.getPath()));
+         wsdlImport = beforePath + resource;
+      }
+
+      // A relative path
+      else
+      {
+         String parentDir = external.substring(0, external.lastIndexOf("/"));
+
+         // remove references to current dir
+         while (resource.startsWith("./"))
+            resource = resource.substring(2);
+
+         // remove references to parentdir
+         while (resource.startsWith("../"))
+         {
+            parentDir = parentDir.substring(0, parentDir.lastIndexOf("/"));
+            resource = resource.substring(3);
+         }
+
+         wsdlImport = parentDir + "/" + resource;
+      }
+
+      try
+      {
+         log.trace("Trying to resolve: " + wsdlImport);
+         InputSource inputSource = entityResolver.resolveEntity(wsdlImport, wsdlImport);
+         if (inputSource != null)
+         {
+            latestImportURI = wsdlImport;
+         }
+         else
+         {
+            throw new IllegalArgumentException("Cannot resolve imported resource: " + wsdlImport);
+         }
+
+         return inputSource;
+      }
+      catch (RuntimeException rte)
+      {
+         throw rte;
+      }
+      catch (Exception e)
+      {
+         throw new WSException("Cannot access imported wsdl [" + wsdlImport + "], " + e.getMessage());
+      }
+   }
+
+   public String getLatestImportURI()
+   {
+      return latestImportURI;
+   }
+}

Deleted: branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/wsdl/WSDLWriter.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/wsdl/WSDLWriter.java	2006-12-06 14:11:26 UTC (rev 1573)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/wsdl/WSDLWriter.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -1,228 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ws.tools.wsdl;
-
-// $Id$
-
-import java.io.IOException;
-import java.io.Writer;
-import java.util.Iterator;
-
-import javax.xml.namespace.QName;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.common.Constants;
-import org.jboss.ws.common.WSException;
-import org.jboss.ws.common.metadata.wsdl.DOMTypes;
-import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.common.metadata.wsdl.WSDLService;
-import org.jboss.ws.common.metadata.wsdl.WSDLTypes;
-import org.jboss.ws.common.metadata.wsdl.WSDLUtils;
-import org.jboss.ws.common.metadata.wsdl.XSModelTypes;
-import org.jboss.ws.common.metadata.wsdl.xmlschema.JBossXSModel;
-import org.jboss.ws.common.utils.DOMUtils;
-import org.jboss.ws.common.utils.DOMWriter;
-import org.w3c.dom.Element;
-
-/**
- * A helper that writes out a WSDL definition
- *
- * @author Thomas.Diesler at jboss.org
- * @author Anil.Saldhana at jboss.org
- * @since 10-Oct-2004
- */
-public class WSDLWriter
-{
-   // provide logging
-   protected static final Logger log = Logger.getLogger(WSDLWriter.class);
-
-   protected WSDLDefinitions wsdl;
-   protected WSDLUtils utils = WSDLUtils.getInstance();
-
-   // The soap prefix
-   protected String soapPrefix = "soap";
-
-   /**
-    * Include or import WSDL Types
-    */
-   protected boolean includeSchemaInWSDL = true;
-
-   /** Use WSDLDefinitions.writeWSDL instead. */
-   public WSDLWriter(WSDLDefinitions wsdl)
-   {
-      if (wsdl == null)
-         throw new IllegalArgumentException("WSDL definitions is NULL");
-
-      this.wsdl = wsdl;
-   }
-
-   /** Write the wsdl definition to the given writer, clients should not care about the wsdl version. */
-   public void write(Writer writer, String charset) throws IOException
-   {
-      write(writer, charset, null);
-   }
-
-   public void write(Writer writer, String charset, WSDLWriterResolver resolver) throws IOException
-   {
-      String wsdlNamespace = wsdl.getWsdlNamespace();
-      if (Constants.NS_WSDL11.equals(wsdlNamespace))
-      {
-         WSDL11Writer wsdl11Writer = new WSDL11Writer(wsdl);
-         wsdl11Writer.write(writer, charset, resolver);
-      }
-      else
-      {
-         throw new WSException("Unsupported wsdl version: " + wsdlNamespace);
-      }
-   }
-
-   public void write(Writer writer) throws IOException
-   {
-      StringBuilder buffer = new StringBuilder();
-      buffer.append(Constants.XML_HEADER);
-
-      appendDefinitions(buffer, wsdl.getTargetNamespace());
-      appendTypes(buffer, wsdl.getTargetNamespace());
-      appendInterfaces(buffer, wsdl.getTargetNamespace());
-      appendBindings(buffer, wsdl.getTargetNamespace());
-      appendServices(buffer, wsdl.getTargetNamespace());
-
-      buffer.append("</definitions>");
-
-      Element element = DOMUtils.parse(buffer.toString());
-      new DOMWriter(writer).setPrettyprint(true).print(element);
-   }
-
-   protected void appendDefinitions(StringBuilder buffer, String namespace)
-   {
-      buffer.append("<definitions");
-      //Append service name as done by wscompile, if there is just one
-      WSDLService[] services = wsdl.getServices();
-      if (services != null && services.length == 1)
-      {
-         WSDLService ser = services[0];
-         buffer.append(" name='" + ser.getName() + "'");
-      }
-      buffer.append(" targetNamespace='" + namespace + "'");
-      buffer.append(" xmlns='" + wsdl.getWsdlNamespace() + "'");
-
-      Iterator it = wsdl.getRegisteredNamespaceURIs();
-      while (it.hasNext())
-      {
-         String namespaceURI = (String)it.next();
-         String prefix = wsdl.getPrefix(namespaceURI);
-         if (prefix.length() > 0)
-         {
-            buffer.append(" xmlns:" + prefix + "='" + namespaceURI + "'");
-            if (Constants.PREFIX_SOAP11.equals(prefix) || Constants.PREFIX_SOAP12.equals(prefix))
-               soapPrefix = prefix;
-         }
-      }
-      buffer.append(">");
-   }
-
-   protected void appendTypes(StringBuilder buffer, String namespace)
-   {
-      WSDLTypes wsdlTypes = wsdl.getWsdlTypes();
-      // If the type section is bound to a particular namespace, verify it mataches, otherwise skip
-      if (wsdlTypes.getNamespace() != null && !wsdlTypes.getNamespace().equals(namespace))
-         return;
-
-      if (wsdlTypes instanceof XSModelTypes)
-      {
-         buffer.append("<types>");
-         JBossXSModel xsM = WSDLUtils.getSchemaModel(wsdlTypes);
-         String schema = xsM.serialize();
-         buffer.append(schema);
-         buffer.append("</types>");
-      }
-      else if (wsdlTypes instanceof DOMTypes)
-      {
-         synchronized (wsdlTypes)
-         {
-            buffer.append(DOMWriter.printNode(((DOMTypes)wsdlTypes).getElement(), true));
-         }
-      }
-   }
-
-   protected void appendInterfaces(StringBuilder buffer, String namespace)
-   {
-   }
-
-   protected void appendBindings(StringBuilder buffer, String namespace)
-   {
-   }
-
-   protected void appendServices(StringBuilder buffer, String namespace)
-   {
-   }
-
-   /** Get a prefixed name of form prefix:localPart */
-   protected String getQNameRef(QName qname)
-   {
-      String retStr = qname.getLocalPart();
-
-      String prefix = qname.getPrefix();
-      String nsURI = qname.getNamespaceURI();
-      if (prefix.length() == 0 && nsURI.length() > 0)
-      {
-         qname = wsdl.registerQName(qname);
-         prefix = qname.getPrefix();
-      }
-
-      if (prefix.length() > 0)
-         retStr = prefix + ":" + retStr;
-
-      return retStr;
-   }
-
-   public WSDLDefinitions getWsdl()
-   {
-      return wsdl;
-   }
-
-   public void setWsdl(WSDLDefinitions wsdl)
-   {
-      this.wsdl = wsdl;
-   }
-
-   public boolean isIncludeTypesInWSDL()
-   {
-      return includeSchemaInWSDL;
-   }
-
-   public void logException(Exception e)
-   {
-      if (log.isTraceEnabled())
-      {
-         log.trace(e);
-      }
-   }
-
-   public void logMessage(String msg)
-   {
-      if (log.isTraceEnabled())
-      {
-         log.trace(msg);
-      }
-   }
-}

Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/wsdl/WSDLWriter.java (from rev 1574, branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/wsdl/WSDLWriter.java)
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/wsdl/WSDLWriter.java	2006-12-06 14:12:50 UTC (rev 1574)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/wsdl/WSDLWriter.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -0,0 +1,228 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ws.common.wsdl;
+
+// $Id$
+
+import java.io.IOException;
+import java.io.Writer;
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.common.Constants;
+import org.jboss.ws.common.WSException;
+import org.jboss.ws.common.metadata.wsdl.DOMTypes;
+import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
+import org.jboss.ws.common.metadata.wsdl.WSDLService;
+import org.jboss.ws.common.metadata.wsdl.WSDLTypes;
+import org.jboss.ws.common.metadata.wsdl.WSDLUtils;
+import org.jboss.ws.common.metadata.wsdl.XSModelTypes;
+import org.jboss.ws.common.metadata.wsdl.xmlschema.JBossXSModel;
+import org.jboss.ws.common.utils.DOMUtils;
+import org.jboss.ws.common.utils.DOMWriter;
+import org.w3c.dom.Element;
+
+/**
+ * A helper that writes out a WSDL definition
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @author Anil.Saldhana at jboss.org
+ * @since 10-Oct-2004
+ */
+public class WSDLWriter
+{
+   // provide logging
+   protected static final Logger log = Logger.getLogger(WSDLWriter.class);
+
+   protected WSDLDefinitions wsdl;
+   protected WSDLUtils utils = WSDLUtils.getInstance();
+
+   // The soap prefix
+   protected String soapPrefix = "soap";
+
+   /**
+    * Include or import WSDL Types
+    */
+   protected boolean includeSchemaInWSDL = true;
+
+   /** Use WSDLDefinitions.writeWSDL instead. */
+   public WSDLWriter(WSDLDefinitions wsdl)
+   {
+      if (wsdl == null)
+         throw new IllegalArgumentException("WSDL definitions is NULL");
+
+      this.wsdl = wsdl;
+   }
+
+   /** Write the wsdl definition to the given writer, clients should not care about the wsdl version. */
+   public void write(Writer writer, String charset) throws IOException
+   {
+      write(writer, charset, null);
+   }
+
+   public void write(Writer writer, String charset, WSDLWriterResolver resolver) throws IOException
+   {
+      String wsdlNamespace = wsdl.getWsdlNamespace();
+      if (Constants.NS_WSDL11.equals(wsdlNamespace))
+      {
+         WSDL11Writer wsdl11Writer = new WSDL11Writer(wsdl);
+         wsdl11Writer.write(writer, charset, resolver);
+      }
+      else
+      {
+         throw new WSException("Unsupported wsdl version: " + wsdlNamespace);
+      }
+   }
+
+   public void write(Writer writer) throws IOException
+   {
+      StringBuilder buffer = new StringBuilder();
+      buffer.append(Constants.XML_HEADER);
+
+      appendDefinitions(buffer, wsdl.getTargetNamespace());
+      appendTypes(buffer, wsdl.getTargetNamespace());
+      appendInterfaces(buffer, wsdl.getTargetNamespace());
+      appendBindings(buffer, wsdl.getTargetNamespace());
+      appendServices(buffer, wsdl.getTargetNamespace());
+
+      buffer.append("</definitions>");
+
+      Element element = DOMUtils.parse(buffer.toString());
+      new DOMWriter(writer).setPrettyprint(true).print(element);
+   }
+
+   protected void appendDefinitions(StringBuilder buffer, String namespace)
+   {
+      buffer.append("<definitions");
+      //Append service name as done by wscompile, if there is just one
+      WSDLService[] services = wsdl.getServices();
+      if (services != null && services.length == 1)
+      {
+         WSDLService ser = services[0];
+         buffer.append(" name='" + ser.getName() + "'");
+      }
+      buffer.append(" targetNamespace='" + namespace + "'");
+      buffer.append(" xmlns='" + wsdl.getWsdlNamespace() + "'");
+
+      Iterator it = wsdl.getRegisteredNamespaceURIs();
+      while (it.hasNext())
+      {
+         String namespaceURI = (String)it.next();
+         String prefix = wsdl.getPrefix(namespaceURI);
+         if (prefix.length() > 0)
+         {
+            buffer.append(" xmlns:" + prefix + "='" + namespaceURI + "'");
+            if (Constants.PREFIX_SOAP11.equals(prefix) || Constants.PREFIX_SOAP12.equals(prefix))
+               soapPrefix = prefix;
+         }
+      }
+      buffer.append(">");
+   }
+
+   protected void appendTypes(StringBuilder buffer, String namespace)
+   {
+      WSDLTypes wsdlTypes = wsdl.getWsdlTypes();
+      // If the type section is bound to a particular namespace, verify it mataches, otherwise skip
+      if (wsdlTypes.getNamespace() != null && !wsdlTypes.getNamespace().equals(namespace))
+         return;
+
+      if (wsdlTypes instanceof XSModelTypes)
+      {
+         buffer.append("<types>");
+         JBossXSModel xsM = WSDLUtils.getSchemaModel(wsdlTypes);
+         String schema = xsM.serialize();
+         buffer.append(schema);
+         buffer.append("</types>");
+      }
+      else if (wsdlTypes instanceof DOMTypes)
+      {
+         synchronized (wsdlTypes)
+         {
+            buffer.append(DOMWriter.printNode(((DOMTypes)wsdlTypes).getElement(), true));
+         }
+      }
+   }
+
+   protected void appendInterfaces(StringBuilder buffer, String namespace)
+   {
+   }
+
+   protected void appendBindings(StringBuilder buffer, String namespace)
+   {
+   }
+
+   protected void appendServices(StringBuilder buffer, String namespace)
+   {
+   }
+
+   /** Get a prefixed name of form prefix:localPart */
+   protected String getQNameRef(QName qname)
+   {
+      String retStr = qname.getLocalPart();
+
+      String prefix = qname.getPrefix();
+      String nsURI = qname.getNamespaceURI();
+      if (prefix.length() == 0 && nsURI.length() > 0)
+      {
+         qname = wsdl.registerQName(qname);
+         prefix = qname.getPrefix();
+      }
+
+      if (prefix.length() > 0)
+         retStr = prefix + ":" + retStr;
+
+      return retStr;
+   }
+
+   public WSDLDefinitions getWsdl()
+   {
+      return wsdl;
+   }
+
+   public void setWsdl(WSDLDefinitions wsdl)
+   {
+      this.wsdl = wsdl;
+   }
+
+   public boolean isIncludeTypesInWSDL()
+   {
+      return includeSchemaInWSDL;
+   }
+
+   public void logException(Exception e)
+   {
+      if (log.isTraceEnabled())
+      {
+         log.trace(e);
+      }
+   }
+
+   public void logMessage(String msg)
+   {
+      if (log.isTraceEnabled())
+      {
+         log.trace(msg);
+      }
+   }
+}

Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/wsdl/WSDLWriterResolver.java (from rev 1574, branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/wsdl/WSDLWriterResolver.java)
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/wsdl/WSDLWriterResolver.java	2006-12-06 14:12:50 UTC (rev 1574)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/wsdl/WSDLWriterResolver.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ws.common.wsdl;
+
+// $Id$
+
+import java.io.IOException;
+import java.io.Writer;
+
+/**
+ * A helper that writes out a WSDL definition
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @author Anil.Saldhana at jboss.org
+ * @since 10-Oct-2004
+ */
+public abstract class WSDLWriterResolver
+{
+   public String actualFile;
+   public String charset;
+   public Writer writer;
+
+   public abstract WSDLWriterResolver resolve(String suggestedFile) throws IOException;
+}

Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java	2006-12-06 14:12:50 UTC (rev 1574)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -86,6 +86,8 @@
 import org.jboss.ws.common.utils.IOUtils;
 import org.jboss.ws.common.utils.JBossWSEntityResolver;
 import org.jboss.ws.common.utils.JavaUtils;
+import org.jboss.ws.common.wsdl.WSDLWriter;
+import org.jboss.ws.common.wsdl.WSDLWriterResolver;
 import org.jboss.ws.core.jaxws.DynamicWrapperGenerator;
 import org.jboss.ws.core.jaxws.WrapperGenerator;
 import org.jboss.ws.core.metadata.acessor.JAXBAccessor;
@@ -96,8 +98,6 @@
 import org.jboss.ws.extras.addressing.metadata.AddressingOpMetaExt;
 import org.jboss.ws.tools.jaxws.JAXBWSDLGenerator;
 import org.jboss.ws.tools.jaxws.WSDLGenerator;
-import org.jboss.ws.tools.wsdl.WSDLWriter;
-import org.jboss.ws.tools.wsdl.WSDLWriterResolver;
 import org.jboss.xb.binding.ObjectModelFactory;
 import org.jboss.xb.binding.Unmarshaller;
 import org.jboss.xb.binding.UnmarshallerFactory;

Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/WSDLFilePublisher.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/WSDLFilePublisher.java	2006-12-06 14:12:50 UTC (rev 1574)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/WSDLFilePublisher.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -49,7 +49,7 @@
 import org.jboss.ws.common.umdm.UnifiedMetaData;
 import org.jboss.ws.common.utils.DOMUtils;
 import org.jboss.ws.common.utils.IOUtils;
-import org.jboss.ws.tools.wsdl.WSDLWriter;
+import org.jboss.ws.common.wsdl.WSDLWriter;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 

Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceRefHandler.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceRefHandler.java	2006-12-06 14:12:50 UTC (rev 1574)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceRefHandler.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -41,10 +41,10 @@
 import org.jboss.ws.common.metadata.j2ee.UnifiedServiceRefMetaData;
 import org.jboss.ws.common.metadata.jaxrpcmapping.JavaWsdlMapping;
 import org.jboss.ws.common.metadata.jaxrpcmapping.JavaWsdlMappingFactory;
+import org.jboss.ws.common.wsdl.WSDL11DefinitionFactory;
 import org.jboss.ws.core.jaxrpc.ServiceReferenceable;
 import org.jboss.ws.core.metadata.builder.jaxrpc.JAXRPCClientDeployment;
 import org.jboss.ws.core.server.UnifiedDeploymentInfo;
-import org.jboss.ws.tools.wsdl.WSDL11DefinitionFactory;
 
 /**
  * Binds a JAXRPC Service object in the client's ENC for every service-ref element in the

Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/JavaToWSDL.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/JavaToWSDL.java	2006-12-06 14:12:50 UTC (rev 1574)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/JavaToWSDL.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -40,9 +40,9 @@
 import org.jboss.ws.common.umdm.UnifiedMetaData;
 import org.jboss.ws.common.utils.DOMUtils;
 import org.jboss.ws.common.utils.DOMWriter;
+import org.jboss.ws.common.wsdl.WSDLWriter;
 import org.jboss.ws.tools.Configuration.OperationConfig;
 import org.jboss.ws.tools.metadata.ToolsUnifiedMetaDataBuilder;
-import org.jboss.ws.tools.wsdl.WSDLWriter;
 import org.w3c.dom.Element;
 
 /**

Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/WSDLToJava.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/WSDLToJava.java	2006-12-06 14:12:50 UTC (rev 1574)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/WSDLToJava.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -58,8 +58,8 @@
 import org.jboss.ws.common.metadata.wsdl.xmlschema.JBossXSModel;
 import org.jboss.ws.common.metadata.wsdl.xsd.SchemaUtils;
 import org.jboss.ws.common.utils.JavaUtils;
+import org.jboss.ws.common.wsdl.WSDLDefinitionsFactory;
 import org.jboss.ws.tools.interfaces.WSDLToJavaIntf;
-import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
 import org.w3c.dom.Element;
 
 /**

Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/helpers/ToolsHelper.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/helpers/ToolsHelper.java	2006-12-06 14:12:50 UTC (rev 1574)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/helpers/ToolsHelper.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -55,6 +55,7 @@
 import org.jboss.ws.common.utils.DOMWriter;
 import org.jboss.ws.common.utils.IOUtils;
 import org.jboss.ws.common.utils.JavaUtils;
+import org.jboss.ws.common.wsdl.WSDLWriter;
 import org.jboss.ws.tools.Configuration;
 import org.jboss.ws.tools.JavaToWSDL;
 import org.jboss.ws.tools.JavaWriter;
@@ -68,7 +69,6 @@
 import org.jboss.ws.tools.client.ServiceCreator;
 import org.jboss.ws.tools.interfaces.WSDotXMLCreatorIntf;
 import org.jboss.ws.tools.mapping.MappingFileGenerator;
-import org.jboss.ws.tools.wsdl.WSDLWriter;
 
 /**
  *  Helper class used by the command line tool "jbossws"

Modified: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/wsdl11/MicrosoftGeneratedWSDLTestCase.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/wsdl11/MicrosoftGeneratedWSDLTestCase.java	2006-12-06 14:12:50 UTC (rev 1574)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/wsdl11/MicrosoftGeneratedWSDLTestCase.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -27,7 +27,7 @@
 import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
 import org.jboss.ws.common.metadata.wsdl.WSDLTypes;
 import org.jboss.ws.common.metadata.wsdl.WSDLUtils;
-import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
+import org.jboss.ws.common.wsdl.WSDLDefinitionsFactory;
 
 /**
  * Tests WSDL11Reader ability to parse WSDL Files

Modified: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/wsdl11/MultiSchemaTestCase.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/wsdl11/MultiSchemaTestCase.java	2006-12-06 14:12:50 UTC (rev 1574)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/wsdl11/MultiSchemaTestCase.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -27,7 +27,7 @@
 import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
 import org.jboss.ws.common.metadata.wsdl.WSDLTypes;
 import org.jboss.ws.common.metadata.wsdl.WSDLUtils;
-import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
+import org.jboss.ws.common.wsdl.WSDLDefinitionsFactory;
 
 /**
  * Test the XSModel, and how it handles multiple schemas

Modified: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/wsdl11/SimpleFileImportTestCase.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/wsdl11/SimpleFileImportTestCase.java	2006-12-06 14:12:50 UTC (rev 1574)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/wsdl11/SimpleFileImportTestCase.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -31,7 +31,7 @@
 
 import org.jboss.net.protocol.URLStreamHandlerFactory;
 import org.jboss.test.ws.JBossWSTest;
-import org.jboss.ws.tools.wsdl.WSDL11DefinitionFactory;
+import org.jboss.ws.common.wsdl.WSDL11DefinitionFactory;
 
 /**
  * Test a wsdl import functionality.

Modified: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/wsdl11/WSDL11TestCase.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/wsdl11/WSDL11TestCase.java	2006-12-06 14:12:50 UTC (rev 1574)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/wsdl11/WSDL11TestCase.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -38,8 +38,8 @@
 import org.jboss.ws.common.metadata.wsdl.WSDLService;
 import org.jboss.ws.common.metadata.wsdl.WSDLTypes;
 import org.jboss.ws.common.metadata.wsdl.WSDLUtils;
+import org.jboss.ws.common.wsdl.WSDLDefinitionsFactory;
 import org.jboss.ws.extras.eventing.EventingConstants;
-import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
 
 /**
  * Test the unmarshalling of wsdl-1.1 into the unified wsdl structure

Modified: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/wsdl11/WSDLTypesTestCase.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/wsdl11/WSDLTypesTestCase.java	2006-12-06 14:12:50 UTC (rev 1574)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/wsdl11/WSDLTypesTestCase.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -28,7 +28,7 @@
 import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
 import org.jboss.ws.common.metadata.wsdl.WSDLUtils;
 import org.jboss.ws.common.metadata.wsdl.xmlschema.JBossXSModel;
-import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
+import org.jboss.ws.common.wsdl.WSDLDefinitionsFactory;
 
 /**
  * The WSDL may contain or import XSD schema definitions.

Modified: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/jbws1068/JBWS1068TestCase.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/jbws1068/JBWS1068TestCase.java	2006-12-06 14:12:50 UTC (rev 1574)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/jbws1068/JBWS1068TestCase.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -25,7 +25,7 @@
 
 import org.jboss.test.ws.JBossWSTest;
 import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
+import org.jboss.ws.common.wsdl.WSDLDefinitionsFactory;
 
 /**
  * Cannot handle xsd:import of xml schema

Modified: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/jbws1190/TestEndpointImpl.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/jbws1190/TestEndpointImpl.java	2006-12-06 14:12:50 UTC (rev 1574)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/jbws1190/TestEndpointImpl.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -30,7 +30,7 @@
 import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
 import org.jboss.ws.common.metadata.wsdl.WSDLEndpoint;
 import org.jboss.ws.common.metadata.wsdl.WSDLService;
-import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
+import org.jboss.ws.common.wsdl.WSDLDefinitionsFactory;
 
 /**
  * 

Modified: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/jbws958/JBWS958TestCase.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/jbws958/JBWS958TestCase.java	2006-12-06 14:12:50 UTC (rev 1574)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/jbws958/JBWS958TestCase.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -26,7 +26,7 @@
 
 import org.jboss.test.ws.JBossWSTest;
 import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
+import org.jboss.ws.common.wsdl.WSDLDefinitionsFactory;
 
 /**
  * XML entity usage in wsdl contained schema

Modified: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/webserviceref/WebServiceRefClientTestCase.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/webserviceref/WebServiceRefClientTestCase.java	2006-12-06 14:12:50 UTC (rev 1574)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/webserviceref/WebServiceRefClientTestCase.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -35,8 +35,8 @@
 import org.jboss.test.ws.JBossWSTest;
 import org.jboss.test.ws.JBossWSTestSetup;
 import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
+import org.jboss.ws.common.wsdl.WSDLDefinitionsFactory;
 import org.jboss.ws.core.jaxrpc.ServiceFactoryImpl;
-import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
 
 /**
  * Test the JAXRPC <service-ref>

Modified: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/webserviceref/WebServiceRefEJBTestCase.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/webserviceref/WebServiceRefEJBTestCase.java	2006-12-06 14:12:50 UTC (rev 1574)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/webserviceref/WebServiceRefEJBTestCase.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -34,8 +34,8 @@
 import org.jboss.test.ws.JBossWSTest;
 import org.jboss.test.ws.JBossWSTestSetup;
 import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
+import org.jboss.ws.common.wsdl.WSDLDefinitionsFactory;
 import org.jboss.ws.core.jaxrpc.ServiceFactoryImpl;
-import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
 
 /**
  * Test the JAXRPC <service-ref>

Modified: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/webserviceref/WebServiceRefServletTestCase.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/webserviceref/WebServiceRefServletTestCase.java	2006-12-06 14:12:50 UTC (rev 1574)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/webserviceref/WebServiceRefServletTestCase.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -35,8 +35,8 @@
 import org.jboss.test.ws.JBossWSTest;
 import org.jboss.test.ws.JBossWSTestSetup;
 import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
+import org.jboss.ws.common.wsdl.WSDLDefinitionsFactory;
 import org.jboss.ws.core.jaxrpc.ServiceFactoryImpl;
-import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
 
 /**
  * Test the JAXRPC <service-ref>

Modified: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wseventing/DIIClientTestCase.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wseventing/DIIClientTestCase.java	2006-12-06 14:12:50 UTC (rev 1574)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wseventing/DIIClientTestCase.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -44,6 +44,7 @@
 import org.jboss.test.ws.JBossWSTest;
 import org.jboss.test.ws.JBossWSTestSetup;
 import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
+import org.jboss.ws.common.wsdl.WSDLDefinitionsFactory;
 import org.jboss.ws.core.jaxrpc.ServiceExt;
 import org.jboss.ws.core.jaxrpc.ServiceFactoryImpl;
 import org.jboss.ws.core.jaxrpc.StubExt;
@@ -58,7 +59,6 @@
 import org.jboss.ws.extras.eventing.element.SubscribeRequest;
 import org.jboss.ws.extras.eventing.element.SubscribeResponse;
 import org.jboss.ws.extras.eventing.element.UnsubscribeRequest;
-import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
 
 /**
  * @author Heiko Braun, <heiko at openj.net>

Modified: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wseventing/EventingSupport.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wseventing/EventingSupport.java	2006-12-06 14:12:50 UTC (rev 1574)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wseventing/EventingSupport.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -36,6 +36,7 @@
 
 import org.jboss.test.ws.JBossWSTest;
 import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
+import org.jboss.ws.common.wsdl.WSDLDefinitionsFactory;
 import org.jboss.ws.core.jaxrpc.StubExt;
 import org.jboss.ws.extras.addressing.AddressingClientUtil;
 import org.jboss.ws.extras.eventing.EventSourceEndpoint;
@@ -46,7 +47,6 @@
 import org.jboss.ws.extras.eventing.element.FilterType;
 import org.jboss.ws.extras.eventing.element.SubscribeRequest;
 import org.jboss.ws.extras.eventing.element.SubscribeResponse;
-import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
 
 /**
  * Eventing test case support.

Modified: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/context/WebServiceContextTestCase.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/context/WebServiceContextTestCase.java	2006-12-06 14:12:50 UTC (rev 1574)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/context/WebServiceContextTestCase.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -35,7 +35,7 @@
 import org.jboss.test.ws.JBossWSTest;
 import org.jboss.test.ws.JBossWSTestSetup;
 import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
+import org.jboss.ws.common.wsdl.WSDLDefinitionsFactory;
 
 /**
  * Test JAXWS WebServiceContext

Modified: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointTestCase.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointTestCase.java	2006-12-06 14:12:50 UTC (rev 1574)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointTestCase.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -43,7 +43,7 @@
 import org.jboss.test.ws.JBossWSTest;
 import org.jboss.test.ws.JBossWSTestSetup;
 import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
+import org.jboss.ws.common.wsdl.WSDLDefinitionsFactory;
 
 /**
  * Test JAXWS Endpoint deployment

Modified: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1190/TestEndpointImpl.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1190/TestEndpointImpl.java	2006-12-06 14:12:50 UTC (rev 1574)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1190/TestEndpointImpl.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -32,7 +32,7 @@
 import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
 import org.jboss.ws.common.metadata.wsdl.WSDLEndpoint;
 import org.jboss.ws.common.metadata.wsdl.WSDLService;
-import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
+import org.jboss.ws.common.wsdl.WSDLDefinitionsFactory;
 
 /**
  *

Modified: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws860/JBWS860TestCase.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws860/JBWS860TestCase.java	2006-12-06 14:12:50 UTC (rev 1574)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws860/JBWS860TestCase.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -33,7 +33,7 @@
 import org.jboss.test.ws.JBossWSTest;
 import org.jboss.test.ws.JBossWSTestSetup;
 import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
+import org.jboss.ws.common.wsdl.WSDLDefinitionsFactory;
 
 /**
  * Investigate "Is Not A Servlet" error with multiple servlets in the web.xml

Modified: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws944/JBWS944TestCase.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws944/JBWS944TestCase.java	2006-12-06 14:12:50 UTC (rev 1574)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws944/JBWS944TestCase.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -33,7 +33,7 @@
 import org.jboss.test.ws.JBossWSTest;
 import org.jboss.test.ws.JBossWSTestSetup;
 import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
+import org.jboss.ws.common.wsdl.WSDLDefinitionsFactory;
 
 /**
  * EJB3 jmx name is incorrectly derrived

Modified: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jsr181/webservice/JSR181WebServiceBase.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jsr181/webservice/JSR181WebServiceBase.java	2006-12-06 14:12:50 UTC (rev 1574)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jsr181/webservice/JSR181WebServiceBase.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -30,7 +30,7 @@
 
 import org.jboss.test.ws.JBossWSTest;
 import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
+import org.jboss.ws.common.wsdl.WSDLDefinitionsFactory;
 
 // $Id$
 

Modified: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderJAXBTestCase.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderJAXBTestCase.java	2006-12-06 14:12:50 UTC (rev 1574)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderJAXBTestCase.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -48,7 +48,7 @@
 import org.jboss.test.ws.jaxws.jsr181.soapbinding.SubmitBareRequest;
 import org.jboss.test.ws.jaxws.jsr181.soapbinding.SubmitBareResponse;
 import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
+import org.jboss.ws.common.wsdl.WSDLDefinitionsFactory;
 import org.w3c.dom.Element;
 
 /**

Modified: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderMessageTestCase.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderMessageTestCase.java	2006-12-06 14:12:50 UTC (rev 1574)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderMessageTestCase.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -37,7 +37,7 @@
 import org.jboss.test.ws.JBossWSTest;
 import org.jboss.test.ws.JBossWSTestSetup;
 import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
+import org.jboss.ws.common.wsdl.WSDLDefinitionsFactory;
 
 /**
  * Test a Provider<SOAPMessage>

Modified: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderPayloadTestCase.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderPayloadTestCase.java	2006-12-06 14:12:50 UTC (rev 1574)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderPayloadTestCase.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -37,7 +37,7 @@
 import org.jboss.test.ws.JBossWSTest;
 import org.jboss.test.ws.JBossWSTestSetup;
 import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
+import org.jboss.ws.common.wsdl.WSDLDefinitionsFactory;
 
 /**
  * Test a Provider<SOAPMessage>

Modified: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/jsr181ejb/JSR181WebServiceEJB3TestCase.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/jsr181ejb/JSR181WebServiceEJB3TestCase.java	2006-12-06 14:12:50 UTC (rev 1574)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/jsr181ejb/JSR181WebServiceEJB3TestCase.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -35,7 +35,7 @@
 import org.jboss.test.ws.JBossWSTest;
 import org.jboss.test.ws.JBossWSTestSetup;
 import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
+import org.jboss.ws.common.wsdl.WSDLDefinitionsFactory;
 
 /**
  * Test the JSR-181 annotation: javax.jws.WebService

Modified: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/jsr181pojo/JSR181WebServiceJSETestCase.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/jsr181pojo/JSR181WebServiceJSETestCase.java	2006-12-06 14:12:50 UTC (rev 1574)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/jsr181pojo/JSR181WebServiceJSETestCase.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -34,8 +34,8 @@
 import org.jboss.test.ws.JBossWSTest;
 import org.jboss.test.ws.JBossWSTestSetup;
 import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
+import org.jboss.ws.common.wsdl.WSDLDefinitionsFactory;
 import org.jboss.ws.core.jaxrpc.ServiceFactoryImpl;
-import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
 
 /**
  * Test the JSR-181 annotation: javax.jws.WebService

Modified: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/RetailSampleTestCase.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/RetailSampleTestCase.java	2006-12-06 14:12:50 UTC (rev 1574)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/RetailSampleTestCase.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -25,7 +25,7 @@
 import org.jboss.test.ws.JBossWSTest;
 import org.jboss.test.ws.JBossWSTestSetup;
 import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
+import org.jboss.ws.common.wsdl.WSDLDefinitionsFactory;
 
 import javax.xml.namespace.QName;
 import java.net.MalformedURLException;

Modified: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/WebServiceRefClientTestCase.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/WebServiceRefClientTestCase.java	2006-12-06 14:12:50 UTC (rev 1574)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/WebServiceRefClientTestCase.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -33,7 +33,7 @@
 import org.jboss.test.ws.JBossWSTest;
 import org.jboss.test.ws.JBossWSTestSetup;
 import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
+import org.jboss.ws.common.wsdl.WSDLDefinitionsFactory;
 
 /**
  * Test the JAXWS annotation: javax.xml.ws.WebServiceref

Modified: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/WebServiceRefEJB3TestCase.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/WebServiceRefEJB3TestCase.java	2006-12-06 14:12:50 UTC (rev 1574)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/WebServiceRefEJB3TestCase.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -34,7 +34,7 @@
 import org.jboss.test.ws.JBossWSTest;
 import org.jboss.test.ws.JBossWSTestSetup;
 import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
+import org.jboss.ws.common.wsdl.WSDLDefinitionsFactory;
 
 /**
  * Test the JAXWS annotation: javax.xml.ws.WebServiceref

Modified: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/WebServiceRefServletTestCase.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/WebServiceRefServletTestCase.java	2006-12-06 14:12:50 UTC (rev 1574)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/WebServiceRefServletTestCase.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -35,7 +35,7 @@
 import org.jboss.test.ws.JBossWSTest;
 import org.jboss.test.ws.JBossWSTestSetup;
 import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
+import org.jboss.ws.common.wsdl.WSDLDefinitionsFactory;
 
 /**
  * Test the JAXWS annotation: javax.xml.ws.WebServiceref

Modified: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/tools/WSDL11ToJavaTestCase.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/tools/WSDL11ToJavaTestCase.java	2006-12-06 14:12:50 UTC (rev 1574)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/tools/WSDL11ToJavaTestCase.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -33,9 +33,9 @@
 import org.jboss.test.ws.tools.validation.WSDLValidator;
 import org.jboss.ws.common.jaxrpc.LiteralTypeMapping;
 import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
+import org.jboss.ws.common.wsdl.WSDL20Writer;
 import org.jboss.ws.tools.WSDLToJava;
 import org.jboss.ws.tools.interfaces.WSDLToJavaIntf;
-import org.jboss.ws.tools.wsdl.WSDL20Writer;
 
 /**
  * Test jbossws WSDL11 -> Java

Modified: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/tools/WSDL11ToWSDL20TestCase.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/tools/WSDL11ToWSDL20TestCase.java	2006-12-06 14:12:50 UTC (rev 1574)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/tools/WSDL11ToWSDL20TestCase.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -33,10 +33,10 @@
 import org.jboss.test.ws.tools.validation.WSDLValidator;
 import org.jboss.ws.common.jaxrpc.LiteralTypeMapping;
 import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
+import org.jboss.ws.common.wsdl.WSDL20Writer;
+import org.jboss.ws.common.wsdl.WSDLDefinitionsFactory;
 import org.jboss.ws.tools.WSDLToJava;
 import org.jboss.ws.tools.interfaces.WSDLToJavaIntf;
-import org.jboss.ws.tools.wsdl.WSDL20Writer;
-import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
 
 /**
  * Test jbossws WSDL11 -> Java -> WSDL20

Modified: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/tools/WSToolsTest.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/tools/WSToolsTest.java	2006-12-06 14:12:50 UTC (rev 1574)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/tools/WSToolsTest.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -47,13 +47,13 @@
 import org.jboss.ws.common.utils.DOMUtils;
 import org.jboss.ws.common.utils.DOMWriter;
 import org.jboss.ws.common.utils.JavaUtils;
+import org.jboss.ws.common.wsdl.WSDLDefinitionsFactory;
 import org.jboss.ws.tools.JavaToWSDL;
 import org.jboss.ws.tools.JavaToXSD;
 import org.jboss.ws.tools.WSToolsConstants;
 import org.jboss.ws.tools.client.ServiceCreator;
 import org.jboss.ws.tools.exceptions.JBossWSToolsException;
 import org.jboss.ws.tools.mapping.MappingFileGenerator;
-import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
 import org.w3c.dom.Element;
 
 /**

Modified: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/tools/holders/StandardHoldersTestCase.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/tools/holders/StandardHoldersTestCase.java	2006-12-06 14:12:50 UTC (rev 1574)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/tools/holders/StandardHoldersTestCase.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -35,12 +35,12 @@
 import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
 import org.jboss.ws.common.utils.DOMUtils;
 import org.jboss.ws.common.utils.IOUtils;
+import org.jboss.ws.common.wsdl.WSDLDefinitionsFactory;
 import org.jboss.ws.tools.JavaToWSDL;
 import org.jboss.ws.tools.WSDLToJava;
 import org.jboss.ws.tools.WSToolsConstants;
 import org.jboss.ws.tools.exceptions.JBossWSToolsException;
 import org.jboss.ws.tools.interfaces.WSDLToJavaIntf;
-import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
 import org.w3c.dom.Element;
 
 

Modified: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/tools/validation/WSDL11ValidationTestCase.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/tools/validation/WSDL11ValidationTestCase.java	2006-12-06 14:12:50 UTC (rev 1574)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/tools/validation/WSDL11ValidationTestCase.java	2006-12-06 14:17:04 UTC (rev 1575)
@@ -26,8 +26,8 @@
 import junit.framework.TestCase;
 
 import org.jboss.ws.common.metadata.wsdl.WSDLDefinitions;
+import org.jboss.ws.common.wsdl.WSDLDefinitionsFactory;
 import org.jboss.ws.tools.exceptions.JBossWSToolsException;
-import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
 
 /**
  *  Testcase to test the WSDL Validator




More information about the jbossws-commits mailing list