axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chath...@apache.org
Subject svn commit: r226351 - in /webservices/axis/trunk/java/modules/wsdl: src/org/apache/axis2/wsdl/builder/ src/org/apache/axis2/wsdl/builder/wsdl4j/ src/org/apache/axis2/wsdl/codegen/ src/org/apache/axis2/wsdl/util/ test/org/apache/wsdl/
Date Fri, 29 Jul 2005 11:53:27 GMT
Author: chathura
Date: Fri Jul 29 04:51:56 2005
New Revision: 226351

URL: http://svn.apache.org/viewcvs?rev=226351&view=rev
Log:
The network downloding of the WSDL is enabled.WSDL2Java tool is now capable of downloading WSDLs that are available online. The Code was taken from the Axis1.1. Thank you note to Fellow Axissers

Added:
    webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/util/DefaultEntityResolver.java
    webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/util/XMLUtils.java
Modified:
    webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/WOMBuilder.java
    webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/WSDL2ToWOMBuilder.java
    webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/wsdl4j/WSDL1ToWOMBuilder.java
    webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java
    webservices/axis/trunk/java/modules/wsdl/test/org/apache/wsdl/BindingOperationTest.java
    webservices/axis/trunk/java/modules/wsdl/test/org/apache/wsdl/CreateSchemaTest.java
    webservices/axis/trunk/java/modules/wsdl/test/org/apache/wsdl/MessageReuseTest.java
    webservices/axis/trunk/java/modules/wsdl/test/org/apache/wsdl/SOAPActionTest.java
    webservices/axis/trunk/java/modules/wsdl/test/org/apache/wsdl/WOMBuilderTest.java

Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/WOMBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/WOMBuilder.java?rev=226351&r1=226350&r2=226351&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/WOMBuilder.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/WOMBuilder.java Fri Jul 29 04:51:56 2005
@@ -15,18 +15,74 @@
  */
 package org.apache.axis2.wsdl.builder;
 
-import org.apache.axis2.wsdl.WSDLVersionWrapper;
+import java.io.InputStream;
 
 import javax.wsdl.WSDLException;
-import java.io.InputStream;
+
+import org.apache.axis2.wsdl.WSDLVersionWrapper;
 
 /**
  * @author chathura@opensource.lk
  */
 public interface WOMBuilder {
 
-    public WSDLVersionWrapper build(InputStream in) throws WSDLException;
-    public WSDLVersionWrapper build(InputStream in,String baseURI) throws WSDLException;
-    public WSDLVersionWrapper build(InputStream in,
+	/**
+	 * Buils a WOM and a WSDL4J object model from given the URI of the WSDL file and
+	 * will be returned as a wrapper object WSDLVersionWrapper.
+	 * @param uri URI pointing to the WSDL document.
+	 * @return WSDLVersionWrapper which contains both the WSDL 2.0 and WSDL 1.1 
+	 * object models.
+	 * @throws WSDLException
+	 */
+    public WSDLVersionWrapper build(String uri) throws WSDLException;
+    
+    /**
+	 * Buils a WOM and a WSDL4J object model from given the URI of the WSDL file and
+	 * will be returned as a wrapper object WSDLVersionWrapper. A WSDL Component Factory
+	 * can be passed into the builder using which the WOM component can be built out of.
+	 * For example: The Enigne uses the WOM's components in the context hierarchy but 
+	 * those are extended components. 
+	 * (<code>ServiceDescription</code> extends <code>WSDLService</code>.)
+	 * So when deployment build the WOM it would prefer to get a <code>ServiceDescription</code>
+	 * built in place of a <code>WSDLService</code>. This can be achieved by passing the 
+	 * correct Component Factory that will instanciate the correct object for the WOM builder.
+	 * @param uri URI pointing to the WSDL document.
+	 * @param wsdlComponentFactory The ComponentFactory that will be used to create the
+	 * WOm components out of.
+	 * @return WSDLVersionWrapper which contains both the WSDL 2.0 and WSDL 1.1 
+	 * object models.
+	 * @throws WSDLException
+	 */
+    public WSDLVersionWrapper build(String uri,
                                     WSDLComponentFactory wsdlComponentFactory) throws WSDLException;
+    
+    /**
+	 * Buils a WOM and a WSDL4J object model from given the URI of the WSDL file and
+	 * will be returned as a wrapper object WSDLVersionWrapper.
+	 * @param in InputStream from which the WSDL document can be read in.
+	 * @return WSDLVersionWrapper which contains both the WSDL 2.0 and WSDL 1.1 
+	 * object models.
+	 * @throws WSDLException
+	 */
+    public WSDLVersionWrapper build(InputStream in) throws WSDLException ;
+    
+    /**
+	 * Buils a WOM and a WSDL4J object model from given the URI of the WSDL file and
+	 * will be returned as a wrapper object WSDLVersionWrapper. A WSDL Component Factory
+	 * can be passed into the builder using which the WOM component can be built out of.
+	 * For example: The Enigne uses the WOM's components in the context hierarchy but 
+	 * those are extended components. 
+	 * (<code>ServiceDescription</code> extends <code>WSDLService</code>.)
+	 * So when deployment build the WOM it would prefer to get a <code>ServiceDescription</code>
+	 * built in place of a <code>WSDLService</code>. This can be achieved by passing the 
+	 * correct Component Factory that will instanciate the correct object for the WOM builder.
+	 * @param in InputStream from which the WSDL document can be read in.
+	 * @param wsdlComponentFactory The ComponentFactory that will be used to create the
+	 * WOm components out of.
+	 * @return WSDLVersionWrapper which contains both the WSDL 2.0 and WSDL 1.1 
+	 * object models.
+	 * @throws WSDLException
+	 */
+    public WSDLVersionWrapper build(InputStream in, 
+			WSDLComponentFactory wsdlComponentFactory) throws WSDLException;
 }

Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/WSDL2ToWOMBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/WSDL2ToWOMBuilder.java?rev=226351&r1=226350&r2=226351&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/WSDL2ToWOMBuilder.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/WSDL2ToWOMBuilder.java Fri Jul 29 04:51:56 2005
@@ -15,29 +15,85 @@
  */
 package org.apache.axis2.wsdl.builder;
 
-import org.apache.axis2.wsdl.WSDLVersionWrapper;
+import java.io.InputStream;
 
 import javax.wsdl.WSDLException;
-import java.io.InputStream;
+
+import org.apache.axis2.wsdl.WSDLVersionWrapper;
 
 /**
  * @author chathura@opensource.lk
  */
 public class WSDL2ToWOMBuilder implements WOMBuilder {
 
+	/**
+	 * Buils a WOM and a WSDL4J object model from given the URI of the WSDL file and
+	 * will be returned as a wrapper object WSDLVersionWrapper.
+	 * @param uri URI pointing to the WSDL document.
+	 * @return WSDLVersionWrapper which contains both the WSDL 2.0 and WSDL 1.1 
+	 * object models.
+	 * @throws WSDLException
+	 */
+    public WSDLVersionWrapper build(String uri) throws WSDLException{
+    	throw new UnsupportedOperationException("Not implemented as yet");
+    }
+    
+    /**
+	 * Buils a WOM and a WSDL4J object model from given the URI of the WSDL file and
+	 * will be returned as a wrapper object WSDLVersionWrapper. A WSDL Component Factory
+	 * can be passed into the builder using which the WOM component can be built out of.
+	 * For example: The Enigne uses the WOM's components in the context hierarchy but 
+	 * those are extended components. 
+	 * (<code>ServiceDescription</code> extends <code>WSDLService</code>.)
+	 * So when deployment build the WOM it would prefer to get a <code>ServiceDescription</code>
+	 * built in place of a <code>WSDLService</code>. This can be achieved by passing the 
+	 * correct Component Factory that will instanciate the correct object for the WOM builder.
+	 * @param uri URI pointing to the WSDL document.
+	 * @param wsdlComponentFactory The ComponentFactory that will be used to create the
+	 * WOm components out of.
+	 * @return WSDLVersionWrapper which contains both the WSDL 2.0 and WSDL 1.1 
+	 * object models.
+	 * @throws WSDLException
+	 */
+    public WSDLVersionWrapper build(String uri,
+                                    WSDLComponentFactory wsdlComponentFactory) throws WSDLException{
+    	throw new UnsupportedOperationException("Not implemented as yet");
+    }
+    
+    /**
+	 * Buils a WOM and a WSDL4J object model from given the URI of the WSDL file and
+	 * will be returned as a wrapper object WSDLVersionWrapper.
+	 * @param in InputStream from which the WSDL document can be read in.
+	 * @return WSDLVersionWrapper which contains both the WSDL 2.0 and WSDL 1.1 
+	 * object models.
+	 * @throws WSDLException
+	 */
     public WSDLVersionWrapper build(InputStream in) throws WSDLException {
-        throw new UnsupportedOperationException("Not Implemented");
+    	throw new UnsupportedOperationException("Not implemented as yet");
     }
+    
+    /**
+	 * Buils a WOM and a WSDL4J object model from given the URI of the WSDL file and
+	 * will be returned as a wrapper object WSDLVersionWrapper. A WSDL Component Factory
+	 * can be passed into the builder using which the WOM component can be built out of.
+	 * For example: The Enigne uses the WOM's components in the context hierarchy but 
+	 * those are extended components. 
+	 * (<code>ServiceDescription</code> extends <code>WSDLService</code>.)
+	 * So when deployment build the WOM it would prefer to get a <code>ServiceDescription</code>
+	 * built in place of a <code>WSDLService</code>. This can be achieved by passing the 
+	 * correct Component Factory that will instanciate the correct object for the WOM builder.
+	 * @param in InputStream from which the WSDL document can be read in.
+	 * @param wsdlComponentFactory The ComponentFactory that will be used to create the
+	 * WOm components out of.
+	 * @return WSDLVersionWrapper which contains both the WSDL 2.0 and WSDL 1.1 
+	 * object models.
+	 * @throws WSDLException
+	 */
+    public WSDLVersionWrapper build(InputStream in, 
+			WSDLComponentFactory wsdlComponentFactory) throws WSDLException{
+		    	throw new UnsupportedOperationException("Not implemented as yet");
+		    }
 
-    public WSDLVersionWrapper build(InputStream in,
-                                    WSDLComponentFactory wsdlComponenetFactory) throws WSDLException {
-        throw new UnsupportedOperationException("Not Implemented");
 
-    }
 
-    public WSDLVersionWrapper build(InputStream in,
-                                    String baseURI) throws WSDLException {
-        throw new UnsupportedOperationException("Not Implemented");
-
-    }
 }

Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/wsdl4j/WSDL1ToWOMBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/wsdl4j/WSDL1ToWOMBuilder.java?rev=226351&r1=226350&r2=226351&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/wsdl4j/WSDL1ToWOMBuilder.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/wsdl4j/WSDL1ToWOMBuilder.java Fri Jul 29 04:51:56 2005
@@ -15,53 +15,111 @@
  */
 package org.apache.axis2.wsdl.builder.wsdl4j;
 
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.wsdl.Definition;
+import javax.wsdl.WSDLException;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.parsers.ParserConfigurationException;
+
 import org.apache.axis2.wsdl.WSDLVersionWrapper;
 import org.apache.axis2.wsdl.builder.WOMBuilder;
 import org.apache.axis2.wsdl.builder.WSDLComponentFactory;
+import org.apache.axis2.wsdl.util.XMLUtils;
 import org.apache.wsdl.WSDLDescription;
 import org.apache.wsdl.impl.WSDLDescriptionImpl;
-import org.apache.wsdl.util.Utils;
 import org.w3c.dom.Document;
 import org.xml.sax.SAXException;
 
-import javax.wsdl.Definition;
-import javax.wsdl.WSDLException;
-import javax.wsdl.factory.WSDLFactory;
-import javax.wsdl.xml.WSDLReader;
-import javax.xml.parsers.ParserConfigurationException;
-import java.io.IOException;
-import java.io.InputStream;
-
 /**
  * @author chathura@opensource.lk
  */
 public class WSDL1ToWOMBuilder implements WOMBuilder {
 
+	/**
+	 * Buils a WOM and a WSDL4J object model from given the URI of the WSDL file and
+	 * will be returned as a wrapper object WSDLVersionWrapper.
+	 * @param in InputStream from which the WSDL document can be read in.
+	 * @return WSDLVersionWrapper which contains both the WSDL 2.0 and WSDL 1.1 
+	 * object models.
+	 * @throws WSDLException
+	 */
     public WSDLVersionWrapper build(InputStream in) throws WSDLException {
+    	return build(in, null);
+    }
+    
+    /**
+	 * Buils a WOM and a WSDL4J object model from given the URI of the WSDL file and
+	 * will be returned as a wrapper object WSDLVersionWrapper. A WSDL Component Factory
+	 * can be passed into the builder using which the WOM component can be built out of.
+	 * For example: The Enigne uses the WOM's components in the context hierarchy but 
+	 * those are extended components. 
+	 * (<code>ServiceDescription</code> extends <code>WSDLService</code>.)
+	 * So when deployment build the WOM it would prefer to get a <code>ServiceDescription</code>
+	 * built in place of a <code>WSDLService</code>. This can be achieved by passing the 
+	 * correct Component Factory that will instanciate the correct object for the WOM builder.
+	 * @param in InputStream from which the WSDL document can be read in.
+	 * @param wsdlComponentFactory The ComponentFactory that will be used to create the
+	 * WOm components out of.
+	 * @return WSDLVersionWrapper which contains both the WSDL 2.0 and WSDL 1.1 
+	 * object models.
+	 * @throws WSDLException
+	 */
+    public WSDLVersionWrapper build(InputStream in, 
+    								WSDLComponentFactory wsdlComponentFactory) throws WSDLException {
+    	if(null == wsdlComponentFactory){
+    		wsdlComponentFactory = new WSDLDescriptionImpl();
+    	}
+    	WSDLDescription wsdlDescription = wsdlComponentFactory.createDescription();
 
-        WSDLDescription wsdlDescription = new WSDLDescriptionImpl();
-
-        Definition wsdl1Definition = this.readInTheWSDLFile(in,null);
+        Definition wsdl1Definition = this.readInTheWSDLFile(in);
         WSDLPump pump = new WSDLPump(wsdlDescription, wsdl1Definition);
         pump.pump();
 
         return new WSDLVersionWrapper(wsdlDescription, wsdl1Definition);
     }
+    
 
-     public WSDLVersionWrapper build(InputStream wsdlSource, String baseUri) throws WSDLException {
-        WSDLDescription wsdlDescription = new WSDLDescriptionImpl();
-        Definition wsdl1Definition = this.readInTheWSDLFile(wsdlSource,baseUri);
-        WSDLPump pump = new WSDLPump(wsdlDescription, wsdl1Definition);
-        pump.pump();
-
-        return new WSDLVersionWrapper(wsdlDescription, wsdl1Definition);
+    /**
+	 * Buils a WOM and a WSDL4J object model from given the URI of the WSDL file and
+	 * will be returned as a wrapper object WSDLVersionWrapper.
+	 * @param uri URI pointing to the WSDL document.
+	 * @return WSDLVersionWrapper which contains both the WSDL 2.0 and WSDL 1.1 
+	 * object models.
+	 * @throws WSDLException
+	 */
+     public WSDLVersionWrapper build(String uri) throws WSDLException {
+        return build(uri, null);
     }
 
-    public WSDLVersionWrapper build(InputStream in,
+     /**
+ 	 * Buils a WOM and a WSDL4J object model from given the URI of the WSDL file and
+ 	 * will be returned as a wrapper object WSDLVersionWrapper. A WSDL Component Factory
+ 	 * can be passed into the builder using which the WOM component can be built out of.
+ 	 * For example: The Enigne uses the WOM's components in the context hierarchy but 
+ 	 * those are extended components. 
+ 	 * (<code>ServiceDescription</code> extends <code>WSDLService</code>.)
+ 	 * So when deployment build the WOM it would prefer to get a <code>ServiceDescription</code>
+ 	 * built in place of a <code>WSDLService</code>. This can be achieved by passing the 
+ 	 * correct Component Factory that will instanciate the correct object for the WOM builder.
+ 	 * @param uri URI pointing to the WSDL document.
+ 	 * @param wsdlComponentFactory The ComponentFactory that will be used to create the
+ 	 * WOm components out of.
+ 	 * @return WSDLVersionWrapper which contains both the WSDL 2.0 and WSDL 1.1 
+ 	 * object models.
+ 	 * @throws WSDLException
+ 	 */
+    public WSDLVersionWrapper build(String uri,
                                     WSDLComponentFactory wsdlComponentFactory) throws WSDLException {
+    	if(null == wsdlComponentFactory){
+    		wsdlComponentFactory = new WSDLDescriptionImpl();
+    	}
         WSDLDescription wsdlDescription = wsdlComponentFactory.createDescription();
 
-        Definition wsdl1Definition = this.readInTheWSDLFile(in,null);
+        Definition wsdl1Definition = this.readInTheWSDLFile(uri);
         WSDLPump pump = new WSDLPump(wsdlDescription,
                 wsdl1Definition,
                 wsdlComponentFactory);
@@ -71,14 +129,16 @@
 
     }
 
-    private Definition readInTheWSDLFile(InputStream in, String baseURI) throws WSDLException {
+    private Definition readInTheWSDLFile(String uri) throws WSDLException {
 
         WSDLReader reader =
                 WSDLFactory.newInstance().newWSDLReader();
+        File file = new File(uri);
+        String baseURI = file.getParentFile()!=null?file.getParentFile().toURI().toString():null;
 
         Document doc;
         try {
-            doc = Utils.newDocument(in);
+            doc = XMLUtils.newDocument(uri);
         } catch (ParserConfigurationException e) {
             throw new WSDLException(WSDLException.PARSER_ERROR,
                     "Parser Configuration Error",
@@ -93,6 +153,30 @@
         }
 
         return reader.readWSDL(baseURI, doc);
+    }
+    
+    private Definition readInTheWSDLFile(InputStream in) throws WSDLException {
+    	
+        WSDLReader reader =
+                WSDLFactory.newInstance().newWSDLReader();
+
+        Document doc;
+        try {
+            doc = XMLUtils.newDocument(in);
+        } catch (ParserConfigurationException e) {
+            throw new WSDLException(WSDLException.PARSER_ERROR,
+                    "Parser Configuration Error",
+                    e);
+        } catch (SAXException e) {
+            throw new WSDLException(WSDLException.PARSER_ERROR,
+                    "Parser SAX Error",
+                    e);
+
+        } catch (IOException e) {
+            throw new WSDLException(WSDLException.INVALID_WSDL, "IO Error", e);
+        }
+
+        return reader.readWSDL(null, doc);
     }
 
 

Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java?rev=226351&r1=226350&r2=226351&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java Fri Jul 29 04:51:56 2005
@@ -16,6 +16,12 @@
 
 package org.apache.axis2.wsdl.codegen;
 
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.wsdl.WSDLException;
+
 import org.apache.axis2.wsdl.builder.WOMBuilderFactory;
 import org.apache.axis2.wsdl.codegen.emitter.CSharpEmitter;
 import org.apache.axis2.wsdl.codegen.emitter.Emitter;
@@ -28,14 +34,6 @@
 import org.apache.axis2.wsdl.databinding.TypeMapper;
 import org.apache.wsdl.WSDLDescription;
 
-import javax.wsdl.WSDLException;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-
 /**
  * @author chathura@opensource.lk
  */
@@ -127,10 +125,7 @@
             IOException {
         String uri = ((CommandLineOption) parser.getAllOptions().get(
                 CommandLineOptionConstants.WSDL_LOCATION_URI_OPTION)).getOptionValue();
-        File file = new File(uri);
-        InputStream in = new FileInputStream(file);
-        String baseURI = file.getParentFile()!=null?file.getParentFile().toURI().toString():null;
-        return WOMBuilderFactory.getBuilder(WOMBuilderFactory.WSDL11).build(in,baseURI)
+        return WOMBuilderFactory.getBuilder(WOMBuilderFactory.WSDL11).build(uri)
                 .getDescription();
     }
 

Added: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/util/DefaultEntityResolver.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/util/DefaultEntityResolver.java?rev=226351&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/util/DefaultEntityResolver.java (added)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/util/DefaultEntityResolver.java Fri Jul 29 04:51:56 2005
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis2.wsdl.util;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.xml.sax.InputSource;
+
+public class DefaultEntityResolver implements org.xml.sax.EntityResolver {
+    protected static Log log =
+        LogFactory.getLog(XMLUtils.class.getName());
+
+    public DefaultEntityResolver() {
+    }
+
+    public InputSource resolveEntity(String publicId, String systemId) {
+        return XMLUtils.getEmptyInputSource();
+    }
+}

Added: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/util/XMLUtils.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/util/XMLUtils.java?rev=226351&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/util/XMLUtils.java (added)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/util/XMLUtils.java Fri Jul 29 04:51:56 2005
@@ -0,0 +1,584 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis2.wsdl.util;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.ProtocolException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.Stack;
+
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.apache.axis2.attachments.Base64;
+import org.apache.axis2.i18n.Messages;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.w3c.dom.Attr;
+import org.w3c.dom.CharacterData;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.XMLReader;
+
+import com.ibm.wsdl.Constants;
+
+
+public class XMLUtils {
+    protected static Log log =
+        LogFactory.getLog(XMLUtils.class.getName());
+        
+    public static final String charEncoding = "ISO-8859-1";
+    private static final String saxParserFactoryProperty =
+        "javax.xml.parsers.SAXParserFactory";
+
+    private static DocumentBuilderFactory dbf = getDOMFactory();
+    private static SAXParserFactory       saxFactory;
+    private static Stack                  saxParsers = new Stack();
+
+    private static String empty = new String("");
+    private static ByteArrayInputStream bais = new ByteArrayInputStream(empty.getBytes());
+
+    static {
+        // Initialize SAX Parser factory defaults
+        initSAXFactory(null, true, false);
+    }
+
+    /** Encode a string appropriately for XML.
+     *
+     * Lifted from ApacheSOAP 2.2 (org.apache.soap.Utils)
+     *
+     * @param orig the String to encode
+     * @return a String in which XML special chars are repalced by entities
+     */
+    public static String xmlEncodeString(String orig)
+    {
+        if (orig == null)
+        {
+            return "";
+        }
+
+        char[] chars = orig.toCharArray();
+
+        // if the string doesn't have any of the magic characters, leave
+        // it alone.
+        boolean needsEncoding = false;
+
+        search:
+        for(int i = 0; i < chars.length; i++) {
+            switch(chars[i]) {
+            case '&': case '"': case '\'': case '<': case '>':
+                needsEncoding = true;
+                break search;
+            }
+        }
+
+        if (!needsEncoding) return orig;
+
+        StringBuffer strBuf = new StringBuffer();
+        for (int i = 0; i < chars.length; i++)
+        {
+            switch (chars[i])
+            {
+            case '&'  : strBuf.append("&amp;");
+                        break;
+            case '\"' : strBuf.append("&quot;");
+                        break;
+            case '\'' : strBuf.append("&apos;");
+                        break;
+            case '<'  : strBuf.append("&lt;");
+                        break;
+            case '\r' : strBuf.append("&#xd;");
+                        break;
+            case '>'  : strBuf.append("&gt;");
+                        break;
+            default   : 
+                if (((int)chars[i]) > 127) {
+                        strBuf.append("&#");
+                        strBuf.append((int)chars[i]);
+                        strBuf.append(";");
+                } else {
+                        strBuf.append(chars[i]);
+                }
+            }
+        }
+
+        return strBuf.toString();
+    }
+
+    /** Initialize the SAX parser factory.
+     *
+     * @param factoryClassName The (optional) class name of the desired
+     *                         SAXParserFactory implementation. Will be
+     *                         assigned to the system property
+     *                         <b>javax.xml.parsers.SAXParserFactory</b>
+     *                         unless this property is already set.
+     *                         If <code>null</code>, leaves current setting
+     *                         alone.
+     * @param namespaceAware true if we want a namespace-aware parser
+     * @param validating true if we want a validating parser
+     *
+     */
+    public static void initSAXFactory(String factoryClassName,
+                                      boolean namespaceAware,
+                                      boolean validating)
+    {
+        if (factoryClassName != null) {
+            try {
+                saxFactory = (SAXParserFactory)Class.forName(factoryClassName).
+                    newInstance();
+                /*
+                 * Set the system property only if it is not already set to
+                 * avoid corrupting environments in which Axis is embedded.
+                 */
+                if (System.getProperty(saxParserFactoryProperty) == null) {
+                    System.setProperty(saxParserFactoryProperty,
+                                       factoryClassName);
+                }
+            } catch (Exception e) {
+                log.error(Messages.getMessage("exception00"), e);
+                saxFactory = null;
+            }
+       } else {
+            saxFactory = SAXParserFactory.newInstance();
+        }
+        saxFactory.setNamespaceAware(namespaceAware);
+        saxFactory.setValidating(validating);
+
+        // Discard existing parsers
+        saxParsers.clear();
+    }
+
+    private static DocumentBuilderFactory getDOMFactory() {
+        DocumentBuilderFactory dbf;
+        try {
+            dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+        }
+        catch( Exception e ) {
+            log.error(Messages.getMessage("exception00"), e );
+            dbf = null;
+        }
+        return( dbf );
+    }
+    
+    private static boolean tryReset= true;
+
+//    /** Get a SAX parser instance from the JAXP factory.
+//     *
+//     * @return a SAXParser instance.
+//     */
+//    public static synchronized SAXParser getSAXParser() {
+//        if(!saxParsers.empty()) {
+//            return (SAXParser )saxParsers.pop();
+//        }
+//
+//        try {
+//            SAXParser parser = saxFactory.newSAXParser();
+//            parser.getParser().setEntityResolver(new DefaultEntityResolver());
+//            XMLReader reader = parser.getXMLReader(); 
+//            reader.setEntityResolver(new DefaultEntityResolver());
+//            reader.setFeature("http://xml.org/sax/features/namespace-prefixes", false);
+//            return parser;
+//        } catch (ParserConfigurationException e) {
+//            log.error(Messages.getMessage("parserConfigurationException00"), e);
+//            return null;
+//        } catch (SAXException se) {
+//            log.error(Messages.getMessage("SAXException00"), se);
+//            return null;
+//        }
+//    }
+
+
+    /** Return a SAX parser for reuse.
+     * @param parser A SAX parser that is available for reuse
+     */
+    public static void releaseSAXParser(SAXParser parser) {
+        if(!tryReset) return;
+
+        //Free up possible ref. held by past contenthandler.
+        try{
+            XMLReader xmlReader= parser.getXMLReader();
+            if(null != xmlReader){
+//                xmlReader.setContentHandler(doNothingContentHandler);
+//                xmlReader.setDTDHandler(doNothingContentHandler);
+//                xmlReader.setEntityResolver(doNothingContentHandler);
+//                xmlReader.setErrorHandler(doNothingContentHandler);
+                synchronized (XMLUtils.class ) {
+                    saxParsers.push(parser);
+                }
+            }
+            else {
+                tryReset= false;
+            }
+        } catch (org.xml.sax.SAXException e) {
+            tryReset= false;
+        }
+    }
+    /**
+     * Get an empty new Document
+     * @return Document
+     * @throws ParserConfigurationException if construction problems occur
+     */
+    public static Document newDocument() 
+         throws ParserConfigurationException
+    {
+        synchronized (dbf) {
+            return dbf.newDocumentBuilder().newDocument();
+        }
+    }
+
+    /**
+     * Get a new Document read from the input source
+     * @return Document
+     * @throws ParserConfigurationException if construction problems occur
+     * @throws SAXException if the document has xml sax problems
+     * @throws IOException if i/o exceptions occur
+     */
+    public static Document newDocument(InputSource inp)
+        throws ParserConfigurationException, SAXException, IOException
+    {
+        DocumentBuilder db;
+        synchronized (dbf) {
+            db = dbf.newDocumentBuilder();
+        }
+        db.setEntityResolver(new DefaultEntityResolver());
+        db.setErrorHandler( new ParserErrorHandler() );
+        return( db.parse( inp ) );
+    }
+
+    /**
+     * Get a new Document read from the input stream
+     * @return Document
+     * @throws ParserConfigurationException if construction problems occur
+     * @throws SAXException if the document has xml sax problems
+     * @throws IOException if i/o exceptions occur
+     */
+    public static Document newDocument(InputStream inp) 
+        throws ParserConfigurationException, SAXException, IOException 
+    {
+        return XMLUtils.newDocument(new InputSource(inp));
+    } 
+
+    /**
+     * Get a new Document read from the indicated uri
+     * @return Document
+     * @throws ParserConfigurationException if construction problems occur
+     * @throws SAXException if the document has xml sax problems
+     * @throws IOException if i/o exceptions occur
+     */
+    public static Document newDocument(String uri) 
+        throws ParserConfigurationException, SAXException, IOException 
+    {
+        // call the authenticated version as there might be 
+        // username/password info embeded in the uri.
+        return XMLUtils.newDocument(uri, null, null);
+    }
+    
+    /**
+     * Create a new document from the given URI, use the username and password
+     * if the URI requires authentication.
+     * @param uri the resource to get
+     * @param username basic auth username
+     * @param password basic auth password
+     * @throws ParserConfigurationException if construction problems occur
+     * @throws SAXException if the document has xml sax problems
+     * @throws IOException if i/o exceptions occur
+     */ 
+    public static Document newDocument(String uri, String username, String password)
+        throws ParserConfigurationException, SAXException, IOException
+     {
+         InputSource ins = XMLUtils.getInputSourceFromURI(uri, username, password);
+         Document doc = XMLUtils.newDocument(ins);
+         // Close the Stream
+         if (ins.getByteStream() != null) {
+             ins.getByteStream().close();
+         } else if (ins.getCharacterStream() != null) {
+             ins.getCharacterStream().close();
+         }
+         return doc;
+     }
+
+
+
+    public static String getPrefix(String uri, Node e) {
+        while (e != null && (e.getNodeType() == Element.ELEMENT_NODE)) {
+            NamedNodeMap attrs = e.getAttributes();
+            for (int n = 0; n < attrs.getLength(); n++) {
+                Attr a = (Attr)attrs.item(n);
+                String name;
+                if ((name = a.getName()).startsWith("xmlns:") &&
+                    a.getNodeValue().equals(uri)) {
+                    return name.substring(6);
+                }
+            }
+            e = e.getParentNode();
+        }
+        return null;
+    }
+
+    public static String getNamespace(String prefix, Node e) {
+        while (e != null && (e.getNodeType() == Node.ELEMENT_NODE)) {
+            Attr attr =
+                ((Element)e).getAttributeNodeNS(Constants.NS_URI_XMLNS, prefix);
+            if (attr != null) return attr.getValue();
+            e = e.getParentNode();
+        }
+        return null;
+    }
+
+    /**
+     * Return a QName when passed a string like "foo:bar" by mapping
+     * the "foo" prefix to a namespace in the context of the given Node.
+     *
+     * @return a QName generated from the given string representation
+     */
+    public static QName getQNameFromString(String str, Node e) {
+        if (str == null || e == null)
+            return null;
+
+        int idx = str.indexOf(':');
+        if (idx > -1) {
+            String prefix = str.substring(0, idx);
+            String ns = getNamespace(prefix, e);
+            if (ns == null)
+                return null;
+            return new QName(ns, str.substring(idx + 1));
+        } else {
+            return new QName("", str);
+        }
+    }
+
+    /**
+     * Return a string for a particular QName, mapping a new prefix
+     * if necessary.
+     */
+    public static String getStringForQName(QName qname, Element e)
+    {
+        String uri = qname.getNamespaceURI();
+        String prefix = getPrefix(uri, e);
+        if (prefix == null) {
+            int i = 1;
+            prefix = "ns" + i;
+            while (getNamespace(prefix, e) != null) {
+                i++;
+                prefix = "ns" + i;
+            }
+            e.setAttributeNS(Constants.NS_URI_XMLNS,
+                        "xmlns:" + prefix, uri);
+        }
+        return prefix + ":" + qname.getLocalPart();
+    }
+
+  /**
+   * Concat all the text and cdata node children of this elem and return
+   * the resulting text.
+   * (by Matt Duftler)
+   *
+   * @param parentEl the element whose cdata/text node values are to
+   *                 be combined.
+   * @return the concatanated string.
+   */
+  public static String getChildCharacterData (Element parentEl) {
+    if (parentEl == null) {
+      return null;
+    }
+    Node          tempNode = parentEl.getFirstChild();
+    StringBuffer  strBuf   = new StringBuffer();
+    CharacterData charData;
+
+    while (tempNode != null) {
+      switch (tempNode.getNodeType()) {
+        case Node.TEXT_NODE :
+        case Node.CDATA_SECTION_NODE : charData = (CharacterData)tempNode;
+                                       strBuf.append(charData.getData());
+                                       break;
+      }
+      tempNode = tempNode.getNextSibling();
+    }
+    return strBuf.toString();
+  }
+    
+    public static class ParserErrorHandler implements ErrorHandler
+    {
+        protected static Log log =
+            LogFactory.getLog(ParserErrorHandler.class.getName());
+        /**
+         * Returns a string describing parse exception details
+         */
+        private String getParseExceptionInfo(SAXParseException spe) {
+            String systemId = spe.getSystemId();
+            if (systemId == null) {
+                systemId = "null";
+            }
+            String info = "URI=" + systemId +
+                " Line=" + spe.getLineNumber() +
+                ": " + spe.getMessage();
+            return info;
+        }
+
+        // The following methods are standard SAX ErrorHandler methods.
+        // See SAX documentation for more info.
+
+        public void warning(SAXParseException spe) throws SAXException {
+            if (log.isDebugEnabled())
+                log.debug( Messages.getMessage("warning00", getParseExceptionInfo(spe)));
+        }
+        
+        public void error(SAXParseException spe) throws SAXException {
+            String message = "Error: " + getParseExceptionInfo(spe);
+            throw new SAXException(message);
+        }
+
+        public void fatalError(SAXParseException spe) throws SAXException {
+            String message = "Fatal Error: " + getParseExceptionInfo(spe);
+            throw new SAXException(message);
+        }
+    }
+
+
+    /**
+     * Utility to get the bytes uri.
+     * Does NOT handle authenticated URLs, 
+     * use getInputSourceFromURI(uri, username, password)
+     *
+     * @param uri the resource to get
+     * @see #getInputSourceFromURI(String uri, String username, String password)
+     */
+    public static InputSource getInputSourceFromURI(String uri) {
+        return new InputSource(uri);
+    }
+
+
+
+    /**
+     * Utility to get the bytes at a protected uri
+     * 
+     * This will retrieve the URL if a username and password are provided.
+     * The java.net.URL class does not do Basic Authentication, so we have to
+     * do it manually in this routine.
+     * 
+     * If no username is provided, we create an InputSource from the uri
+     * and let the InputSource go fetch the contents.
+     * 
+     * @param uri the resource to get
+     * @param username basic auth username
+     * @param password basic auth password
+     */ 
+    private static InputSource getInputSourceFromURI(String uri,
+                                                     String username,
+                                                     String password)
+        throws IOException, ProtocolException, UnsupportedEncodingException
+    {
+        URL wsdlurl = null;
+        try {
+            wsdlurl = new URL(uri);
+        } catch (MalformedURLException e) {
+            // we can't process it, it might be a 'simple' foo.wsdl
+            // let InputSource deal with it
+            return new InputSource(uri);
+        }
+        
+        // if no authentication, just let InputSource deal with it
+        if (username == null && wsdlurl.getUserInfo() == null) {
+            return new InputSource(uri);
+        }
+        
+        // if this is not an HTTP{S} url, let InputSource deal with it
+        if (!wsdlurl.getProtocol().startsWith("http")) {
+            return new InputSource(uri);
+        }
+
+        URLConnection connection = wsdlurl.openConnection();
+        // Does this work for https???
+        if (!(connection instanceof HttpURLConnection)) {
+            // can't do http with this URL, let InputSource deal with it
+            return new InputSource(uri);
+        }
+        HttpURLConnection uconn = (HttpURLConnection) connection;
+        String userinfo = wsdlurl.getUserInfo();
+        uconn.setRequestMethod("GET");
+        uconn.setAllowUserInteraction(false);
+        uconn.setDefaultUseCaches(false);
+        uconn.setDoInput(true);
+        uconn.setDoOutput(false);
+        uconn.setInstanceFollowRedirects(true);
+        uconn.setUseCaches(false);
+
+        // username/password info in the URL overrides passed in values 
+        String auth = null;
+        if (userinfo != null) {
+            auth = userinfo;
+        } else if (username != null) {
+            auth = (password == null) ? username : username + ":" + password;
+        }
+        
+        if (auth != null) {
+            uconn.setRequestProperty("Authorization",
+                                     "Basic " + 
+                                     base64encode(auth.getBytes(charEncoding)));
+        }
+        
+        uconn.connect();
+
+        return new InputSource(uconn.getInputStream());
+    }
+
+    public static final String base64encode(byte[] bytes) {
+        return new String(Base64.encode(bytes));
+    }
+
+    public static InputSource getEmptyInputSource() {
+        return new InputSource(bais);
+    }
+    
+    /**
+     * Find a Node with a given QNameb
+     * 
+     * @param node parent node
+     * @param name QName of the child we need to find
+     * @return child node
+     */ 
+    public static Node findNode(Node node, QName name){
+        if(name.getNamespaceURI().equals(node.getNamespaceURI()) && 
+           name.getLocalPart().equals(node.getLocalName()))
+            return node;
+        NodeList children = node.getChildNodes();
+        for(int i=0;i<children.getLength();i++){
+            Node ret = findNode(children.item(i), name);
+            if(ret != null)
+                return ret;
+        }
+        return null;
+    }
+}

Modified: webservices/axis/trunk/java/modules/wsdl/test/org/apache/wsdl/BindingOperationTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/test/org/apache/wsdl/BindingOperationTest.java?rev=226351&r1=226350&r2=226351&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/test/org/apache/wsdl/BindingOperationTest.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/test/org/apache/wsdl/BindingOperationTest.java Fri Jul 29 04:51:56 2005
@@ -16,11 +16,9 @@
 
 package org.apache.wsdl;
 
-import org.apache.axis2.wsdl.builder.WOMBuilderFactory;
-
 import javax.xml.namespace.QName;
-import java.io.FileInputStream;
-import java.io.InputStream;
+
+import org.apache.axis2.wsdl.builder.WOMBuilderFactory;
 
 /**
  * @author chathura@opensource.lk
@@ -40,10 +38,9 @@
     public void testBindingOperation() throws Exception {
         WSDLDescription womDescription;
 
-        InputStream in = new FileInputStream(
-                getTestResourceFile("BookQuote.wsdl"));
+        String path = getTestResourceFile("BookQuote.wsdl").getAbsolutePath();
         womDescription = WOMBuilderFactory.getBuilder(WOMBuilderFactory.WSDL11)
-                .build(in).getDescription();
+                .build(path).getDescription();
 
         assertNotNull(womDescription);
         if (null != womDescription) {

Modified: webservices/axis/trunk/java/modules/wsdl/test/org/apache/wsdl/CreateSchemaTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/test/org/apache/wsdl/CreateSchemaTest.java?rev=226351&r1=226350&r2=226351&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/test/org/apache/wsdl/CreateSchemaTest.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/test/org/apache/wsdl/CreateSchemaTest.java Fri Jul 29 04:51:56 2005
@@ -16,6 +16,10 @@
 
 package org.apache.wsdl;
 
+import java.util.Iterator;
+
+import javax.wsdl.Definition;
+
 import org.apache.axis2.wsdl.WSDLVersionWrapper;
 import org.apache.axis2.wsdl.builder.WOMBuilderFactory;
 import org.apache.wsdl.extensions.ExtensionConstants;
@@ -24,11 +28,6 @@
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
-import javax.wsdl.Definition;
-import java.io.FileInputStream;
-import java.io.InputStream;
-import java.util.Iterator;
-
 /**
  * @author chathura@opensource.lk
  */
@@ -45,11 +44,10 @@
     protected void setUp() throws Exception {
         WSDLVersionWrapper wsdlVersionWrapper = null;
         if (null == this.womDescription) {
-            InputStream in = new FileInputStream(
-                    getTestResourceFile("BookQuote.wsdl"));
+            String path = getTestResourceFile("BookQuote.wsdl").getAbsolutePath();
             wsdlVersionWrapper =
                     WOMBuilderFactory.getBuilder(WOMBuilderFactory.WSDL11)
-                    .build(in);
+                    .build(path);
             this.womDescription = wsdlVersionWrapper.getDescription();
         }
         if (null == wsdl4jDefinition) {

Modified: webservices/axis/trunk/java/modules/wsdl/test/org/apache/wsdl/MessageReuseTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/test/org/apache/wsdl/MessageReuseTest.java?rev=226351&r1=226350&r2=226351&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/test/org/apache/wsdl/MessageReuseTest.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/test/org/apache/wsdl/MessageReuseTest.java Fri Jul 29 04:51:56 2005
@@ -16,6 +16,11 @@
 
 package org.apache.wsdl;
 
+import java.util.Iterator;
+
+import javax.wsdl.Definition;
+import javax.xml.namespace.QName;
+
 import org.apache.axis2.wsdl.WSDLVersionWrapper;
 import org.apache.axis2.wsdl.builder.WOMBuilderFactory;
 import org.apache.wsdl.extensions.ExtensionConstants;
@@ -24,12 +29,6 @@
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
-import javax.wsdl.Definition;
-import javax.xml.namespace.QName;
-import java.io.FileInputStream;
-import java.io.InputStream;
-import java.util.Iterator;
-
 /**
  * @author chathura@opensource.lk
  */
@@ -47,11 +46,10 @@
 
         WSDLVersionWrapper wsdlVersionWrapper = null;
         if (null == this.womDescription) {
-            InputStream in = new FileInputStream(
-                    getTestResourceFile("BookQuote.wsdl"));
+            String path = getTestResourceFile("BookQuote.wsdl").getAbsolutePath();
             wsdlVersionWrapper =
                     WOMBuilderFactory.getBuilder(WOMBuilderFactory.WSDL11)
-                    .build(in);
+                    .build(path);
             this.womDescription = wsdlVersionWrapper.getDescription();
         }
         if (null == wsdl4jDefinition) {

Modified: webservices/axis/trunk/java/modules/wsdl/test/org/apache/wsdl/SOAPActionTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/test/org/apache/wsdl/SOAPActionTest.java?rev=226351&r1=226350&r2=226351&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/test/org/apache/wsdl/SOAPActionTest.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/test/org/apache/wsdl/SOAPActionTest.java Fri Jul 29 04:51:56 2005
@@ -16,17 +16,16 @@
 
 package org.apache.wsdl;
 
+import java.util.Iterator;
+
+import javax.wsdl.Definition;
+import javax.xml.namespace.QName;
+
 import org.apache.axis2.wsdl.WSDLVersionWrapper;
 import org.apache.axis2.wsdl.builder.WOMBuilderFactory;
 import org.apache.wsdl.extensions.ExtensionConstants;
 import org.apache.wsdl.extensions.SOAPOperation;
 
-import javax.wsdl.Definition;
-import javax.xml.namespace.QName;
-import java.io.FileInputStream;
-import java.io.InputStream;
-import java.util.Iterator;
-
 /**
  * @author chathura@opensource.lk
  */
@@ -44,11 +43,10 @@
         super.setUp();
         WSDLVersionWrapper wsdlVersionWrapper = null;
         if (null == this.womDescription) {
-            InputStream in = new FileInputStream(
-                    getTestResourceFile("InteropTestDocLit2.wsdl"));
+            String path = getTestResourceFile("InteropTestDocLit2.wsdl").getAbsolutePath();
             wsdlVersionWrapper =
                     WOMBuilderFactory.getBuilder(WOMBuilderFactory.WSDL11)
-                    .build(in);
+                    .build(path);
             this.womDescription = wsdlVersionWrapper.getDescription();
 
         }

Modified: webservices/axis/trunk/java/modules/wsdl/test/org/apache/wsdl/WOMBuilderTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/test/org/apache/wsdl/WOMBuilderTest.java?rev=226351&r1=226350&r2=226351&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/test/org/apache/wsdl/WOMBuilderTest.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/test/org/apache/wsdl/WOMBuilderTest.java Fri Jul 29 04:51:56 2005
@@ -16,16 +16,15 @@
 package org.apache.wsdl;
 
 
-import org.apache.axis2.wsdl.WSDLVersionWrapper;
-import org.apache.axis2.wsdl.builder.WOMBuilderFactory;
+import java.util.Iterator;
 
 import javax.wsdl.Definition;
 import javax.wsdl.Operation;
 import javax.wsdl.PortType;
 import javax.wsdl.Service;
-import java.io.FileInputStream;
-import java.io.InputStream;
-import java.util.Iterator;
+
+import org.apache.axis2.wsdl.WSDLVersionWrapper;
+import org.apache.axis2.wsdl.builder.WOMBuilderFactory;
 
 /**
  * @author chathura@opensource.lk
@@ -44,12 +43,10 @@
 
         WSDLVersionWrapper wsdlVersionWrapper = null;
         if (null == this.womDescription) {
-            InputStream in = new FileInputStream(
-                    getTestResourceFile("InteropTest.wsdl"));
-//            InputStream in = new FileInputStream(new File("E:/temp/service.wsdl"));
-            wsdlVersionWrapper =
+            String path = getTestResourceFile("InteropTest.wsdl").getAbsolutePath();
+			wsdlVersionWrapper =
                     WOMBuilderFactory.getBuilder(WOMBuilderFactory.WSDL11)
-                    .build(in);
+                    .build(path);
             this.womDescription = wsdlVersionWrapper.getDescription();
         }
         if (null == wsdl4jDefinition) {



Mime
View raw message