Author: isurues
Date: Tue Jan 18 10:46:36 2011
New Revision: 1060294
URL: http://svn.apache.org/viewvc?rev=1060294&view=rev
Log:
fixing https://issues.apache.org/jira/browse/AXIS2-4929. Using a unique id when
reading a schema using the SchemaCollection
Modified:
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/JAXWSRIWSDLGenerator.java
Modified:
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/JAXWSRIWSDLGenerator.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/JAXWSRIWSDLGenerator.java?rev=1060294&r1=1060293&r2=1060294&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/JAXWSRIWSDLGenerator.java
(original)
+++
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/JAXWSRIWSDLGenerator.java
Tue Jan 18 10:46:36 2011
@@ -39,6 +39,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.ws.commons.schema.XmlSchema;
import org.apache.ws.commons.schema.XmlSchemaCollection;
+import org.w3c.dom.Document;
import org.xml.sax.InputSource;
import javax.servlet.ServletConfig;
@@ -47,6 +48,7 @@ import javax.wsdl.Definition;
import javax.wsdl.WSDLException;
import javax.wsdl.factory.WSDLFactory;
import javax.wsdl.xml.WSDLReader;
+import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.ws.WebServiceException;
import javax.xml.ws.soap.SOAPBinding;
import java.io.ByteArrayOutputStream;
@@ -321,9 +323,18 @@ public class JAXWSRIWSDLGenerator implem
schemaCollection.setBaseUri(new
File(localOutputDirectory).getAbsolutePath());
HashMap<String, XmlSchema> docMap = new HashMap<String,
XmlSchema>();
+
+ // Doc factory to read schema files
+ DocumentBuilderFactory fac = DocumentBuilderFactory.newInstance();
+ fac.setNamespaceAware(true);
+
List<File> schemaFiles = getSchemaFiles(localOutputDirectory);
for (File schemaFile : schemaFiles) {
- XmlSchema doc = schemaCollection.read(new
InputSource(schemaFile.toURL().toString()), null);
+ // generate dom document for current schema file
+ Document parsedDoc =
fac.newDocumentBuilder().parse(schemaFile.toURL().toString());
+ // read the schema through XmlSchema
+ XmlSchema doc =
schemaCollection.read(parsedDoc.getDocumentElement(),
+ "id-" + System.currentTimeMillis());
if (log.isDebugEnabled()) {
log.debug("Read in schema file: " + schemaFile.getName());
}