Author: veithen
Date: Tue Oct 16 20:42:02 2012
New Revision: 1398987
URL: http://svn.apache.org/viewvc?rev=1398987&view=rev
Log:
AXIS-1984: Added XML catalog support to maven-wsdl2java-plugin.
Added:
axis/axis1/java/trunk/axis-rt-core/src/main/java/org/apache/axis/wsdl/symbolTable/NullEntityResolver.java
- copied unchanged from r1398984,
axis/axis1/java/branches/AXIS-1984/axis-rt-core/src/main/java/org/apache/axis/wsdl/symbolTable/NullEntityResolver.java
axis/axis1/java/trunk/axis-rt-core/src/main/java/org/apache/axis/wsdl/symbolTable/WSDLLocatorAdapter.java
- copied unchanged from r1398984,
axis/axis1/java/branches/AXIS-1984/axis-rt-core/src/main/java/org/apache/axis/wsdl/symbolTable/WSDLLocatorAdapter.java
axis/axis1/java/trunk/maven/maven-wsdl2java-plugin/src/it/wsrf/
- copied from r1398984,
axis/axis1/java/branches/AXIS-1984/maven/maven-wsdl2java-plugin/src/it/wsrf/
axis/axis1/java/trunk/maven/maven-wsdl2java-plugin/src/it/wsrf/pom.xml
- copied unchanged from r1398984,
axis/axis1/java/branches/AXIS-1984/maven/maven-wsdl2java-plugin/src/it/wsrf/pom.xml
axis/axis1/java/trunk/maven/maven-wsdl2java-plugin/src/it/wsrf/src/
- copied from r1398984,
axis/axis1/java/branches/AXIS-1984/maven/maven-wsdl2java-plugin/src/it/wsrf/src/
axis/axis1/java/trunk/maven/maven-wsdl2java-plugin/src/it/wsrf/src/main/
- copied from r1398984,
axis/axis1/java/branches/AXIS-1984/maven/maven-wsdl2java-plugin/src/it/wsrf/src/main/
axis/axis1/java/trunk/maven/maven-wsdl2java-plugin/src/it/wsrf/src/main/wsdl/
- copied from r1398984,
axis/axis1/java/branches/AXIS-1984/maven/maven-wsdl2java-plugin/src/it/wsrf/src/main/wsdl/
axis/axis1/java/trunk/maven/maven-wsdl2java-plugin/src/it/wsrf/src/main/wsdl/addressing.xsd
- copied unchanged from r1398984,
axis/axis1/java/branches/AXIS-1984/maven/maven-wsdl2java-plugin/src/it/wsrf/src/main/wsdl/addressing.xsd
axis/axis1/java/trunk/maven/maven-wsdl2java-plugin/src/it/wsrf/src/main/wsdl/catalog.xml
- copied unchanged from r1398984,
axis/axis1/java/branches/AXIS-1984/maven/maven-wsdl2java-plugin/src/it/wsrf/src/main/wsdl/catalog.xml
axis/axis1/java/trunk/maven/maven-wsdl2java-plugin/src/it/wsrf/src/main/wsdl/wsrf-WS-BaseFaults-1.2-draft-01.xsd
- copied unchanged from r1398984,
axis/axis1/java/branches/AXIS-1984/maven/maven-wsdl2java-plugin/src/it/wsrf/src/main/wsdl/wsrf-WS-BaseFaults-1.2-draft-01.xsd
axis/axis1/java/trunk/maven/maven-wsdl2java-plugin/src/it/wsrf/src/main/wsdl/wsrf-WS-ResourceProperties-1.2-draft-01-impl.wsdl
- copied unchanged from r1398984,
axis/axis1/java/branches/AXIS-1984/maven/maven-wsdl2java-plugin/src/it/wsrf/src/main/wsdl/wsrf-WS-ResourceProperties-1.2-draft-01-impl.wsdl
axis/axis1/java/trunk/maven/maven-wsdl2java-plugin/src/it/wsrf/src/main/wsdl/wsrf-WS-ResourceProperties-1.2-draft-01.wsdl
- copied unchanged from r1398984,
axis/axis1/java/branches/AXIS-1984/maven/maven-wsdl2java-plugin/src/it/wsrf/src/main/wsdl/wsrf-WS-ResourceProperties-1.2-draft-01.wsdl
axis/axis1/java/trunk/maven/maven-wsdl2java-plugin/src/it/wsrf/src/main/wsdl/wsrf-WS-ResourceProperties-1.2-draft-01.xsd
- copied unchanged from r1398984,
axis/axis1/java/branches/AXIS-1984/maven/maven-wsdl2java-plugin/src/it/wsrf/src/main/wsdl/wsrf-WS-ResourceProperties-1.2-draft-01.xsd
axis/axis1/java/trunk/maven/maven-wsdl2java-plugin/src/it/wsrf/src/main/wsdl/xml.xsd
- copied unchanged from r1398984,
axis/axis1/java/branches/AXIS-1984/maven/maven-wsdl2java-plugin/src/it/wsrf/src/main/wsdl/xml.xsd
axis/axis1/java/trunk/maven/maven-wsdl2java-plugin/src/it/wsrf/verify.bsh
- copied unchanged from r1398984,
axis/axis1/java/branches/AXIS-1984/maven/maven-wsdl2java-plugin/src/it/wsrf/verify.bsh
Removed:
axis/axis1/java/trunk/test/wsdl/wsrf/
Modified:
axis/axis1/java/trunk/ (props changed)
axis/axis1/java/trunk/axis-rt-core/src/main/java/ (props changed)
axis/axis1/java/trunk/axis-rt-core/src/main/java/org/apache/axis/wsdl/gen/Parser.java
axis/axis1/java/trunk/axis-rt-core/src/main/java/org/apache/axis/wsdl/symbolTable/SymbolTable.java
axis/axis1/java/trunk/maven/maven-wsdl2java-plugin/pom.xml
axis/axis1/java/trunk/maven/maven-wsdl2java-plugin/src/main/java/org/apache/axis/tools/maven/wsdl2java/AbstractWsdl2JavaMojo.java
axis/axis1/java/trunk/test/wsdl/interop/ (props changed)
Propchange: axis/axis1/java/trunk/
------------------------------------------------------------------------------
Merged /axis/axis1/java/branches/AXIS-1984:r1398421-1398984
Propchange: axis/axis1/java/trunk/axis-rt-core/src/main/java/
------------------------------------------------------------------------------
Merged
/axis/axis1/java/branches/AXIS-1984/axis-rt-core/src/main/java:r1398421-1398984
Modified:
axis/axis1/java/trunk/axis-rt-core/src/main/java/org/apache/axis/wsdl/gen/Parser.java
URL:
http://svn.apache.org/viewvc/axis/axis1/java/trunk/axis-rt-core/src/main/java/org/apache/axis/wsdl/gen/Parser.java?rev=1398987&r1=1398986&r2=1398987&view=diff
==============================================================================
---
axis/axis1/java/trunk/axis-rt-core/src/main/java/org/apache/axis/wsdl/gen/Parser.java
(original)
+++
axis/axis1/java/trunk/axis-rt-core/src/main/java/org/apache/axis/wsdl/gen/Parser.java
Tue Oct 16 20:42:02 2012
@@ -27,6 +27,7 @@ import org.apache.axis.wsdl.symbolTable.
import org.apache.axis.wsdl.symbolTable.TypeEntry;
import org.apache.axis.wsdl.symbolTable.Utils;
import org.w3c.dom.Document;
+import org.xml.sax.EntityResolver;
import org.xml.sax.SAXException;
import javax.wsdl.Binding;
@@ -70,6 +71,8 @@ public class Parser {
/** If this is false, we'll prefer "String[]" to "ArrayOfString" for
literal wrapped arrays */
protected boolean wrapArrays = false;
+ protected EntityResolver entityResolver;
+
// Timeout, in milliseconds, to let the Emitter do its work
/** Field timeoutms */
@@ -172,6 +175,26 @@ public class Parser {
}
/**
+ * Get the entity resolver configured for this parser.
+ *
+ * @return the entity resolver, or <code>null</code> if no entity resolver
is configured
+ */
+ public EntityResolver getEntityResolver() {
+ return entityResolver;
+ }
+
+ /**
+ * Set the entity resolver for this parser. This is used to load the WSDL
file (unless it is
+ * supplied as a {@link Document}) and all imported WSDL and schema
documents.
+ *
+ * @param entityResolver
+ * the entity resolver, or <code>null</code> to use a default
entity resolver
+ */
+ public void setEntityResolver(EntityResolver entityResolver) {
+ this.entityResolver = entityResolver;
+ }
+
+ /**
* Return the current timeout setting
*
* @return
@@ -298,6 +321,7 @@ public class Parser {
verbose, nowrap);
symbolTable.setQuiet(quiet);
symbolTable.setWrapArrays(wrapArrays);
+ symbolTable.setEntityResolver(entityResolver);
// We run the actual Emitter in a thread that we can kill
WSDLRunnable runnable = new WSDLRunnable(symbolTable, wsdlURI);
@@ -395,6 +419,7 @@ public class Parser {
symbolTable = new SymbolTable(genFactory.getBaseTypeMapping(), imports,
verbose, nowrap);
+ symbolTable.setEntityResolver(entityResolver);
symbolTable.populate(context, doc);
generate(symbolTable);
Modified:
axis/axis1/java/trunk/axis-rt-core/src/main/java/org/apache/axis/wsdl/symbolTable/SymbolTable.java
URL:
http://svn.apache.org/viewvc/axis/axis1/java/trunk/axis-rt-core/src/main/java/org/apache/axis/wsdl/symbolTable/SymbolTable.java?rev=1398987&r1=1398986&r2=1398987&view=diff
==============================================================================
---
axis/axis1/java/trunk/axis-rt-core/src/main/java/org/apache/axis/wsdl/symbolTable/SymbolTable.java
(original)
+++
axis/axis1/java/trunk/axis-rt-core/src/main/java/org/apache/axis/wsdl/symbolTable/SymbolTable.java
Tue Oct 16 20:42:02 2012
@@ -27,6 +27,8 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import javax.wsdl.Binding;
@@ -175,6 +177,8 @@ public class SymbolTable {
/** Field wsdlURI */
private String wsdlURI = null;
+ private EntityResolver entityResolver;
+
/** If this is false, we will "unwrap" literal arrays, generating a plan
"String[]" instead
* of "ArrayOfString" when encountering an element containing a single
maxOccurs="unbounded"
* inner element.
@@ -429,6 +433,26 @@ public class SymbolTable {
}
/**
+ * Get the entity resolver.
+ *
+ * @return the entity resolver, or <code>null</code> if no entity resolver
is configured
+ */
+ public EntityResolver getEntityResolver() {
+ return entityResolver;
+ }
+
+ /**
+ * Set the entity resolver. This is used to load the WSDL file (unless it
is supplied as a
+ * {@link Document}) and all imported WSDL and schema documents.
+ *
+ * @param entityResolver
+ * the entity resolver, or <code>null</code> to use a default
entity resolver
+ */
+ public void setEntityResolver(EntityResolver entityResolver) {
+ this.entityResolver = entityResolver;
+ }
+
+ /**
* Dump the contents of the symbol table. For debugging purposes only.
*
* @param out
@@ -521,7 +545,9 @@ public class SymbolTable {
reader.setFeature("javax.wsdl.verbose", verbose);
- this.def = reader.readWSDL(context, doc);
+ this.def = reader.readWSDL(new WSDLLocatorAdapter(context,
+ entityResolver != null ? entityResolver :
NullEntityResolver.INSTANCE),
+ doc.getDocumentElement());
add(context, def, doc);
} // populate
@@ -683,6 +709,17 @@ public class SymbolTable {
}
} // checkForUndefined
+ private Document newDocument(String systemId) throws SAXException,
IOException, ParserConfigurationException {
+ InputSource is = null;
+ if (entityResolver != null) {
+ is = entityResolver.resolveEntity(null, systemId);
+ }
+ if (is == null) {
+ is = new InputSource(systemId);
+ }
+ return XMLUtils.newDocument(is);
+ }
+
/**
* Add the given Definition and Document information to the symbol table
(including imported
* symbols), populating it with SymTabEntries for each of the top-level
symbols.
@@ -740,7 +777,7 @@ public class SymbolTable {
URL url = getURL(context, imp.getLocationURI());
populate(url, imp.getDefinition(),
- XMLUtils.newDocument(url.toString()),
+ newDocument(url.toString()),
url.toString());
}
}
@@ -864,7 +901,7 @@ public class SymbolTable {
String filename = url.toString();
- populate(url, null, XMLUtils.newDocument(filename),
+ populate(url, null, newDocument(filename),
filename);
}
}
@@ -1074,7 +1111,7 @@ public class SymbolTable {
if (includeName != null) {
URL url = getURL(context, includeName);
- Document includeDoc = XMLUtils.newDocument(url.toString());
+ Document includeDoc = newDocument(url.toString());
// Vidyanand : Fix for Bug #15124
org.w3c.dom.Element schemaEl =
Modified: axis/axis1/java/trunk/maven/maven-wsdl2java-plugin/pom.xml
URL:
http://svn.apache.org/viewvc/axis/axis1/java/trunk/maven/maven-wsdl2java-plugin/pom.xml?rev=1398987&r1=1398986&r2=1398987&view=diff
==============================================================================
--- axis/axis1/java/trunk/maven/maven-wsdl2java-plugin/pom.xml (original)
+++ axis/axis1/java/trunk/maven/maven-wsdl2java-plugin/pom.xml Tue Oct 16
20:42:02 2012
@@ -65,6 +65,11 @@
<groupId>com.github.veithen.ulog</groupId>
<artifactId>ulog</artifactId>
</dependency>
+ <dependency>
+ <groupId>xml-resolver</groupId>
+ <artifactId>xml-resolver</artifactId>
+ <version>1.2</version>
+ </dependency>
</dependencies>
<profiles>
<profile>
Modified:
axis/axis1/java/trunk/maven/maven-wsdl2java-plugin/src/main/java/org/apache/axis/tools/maven/wsdl2java/AbstractWsdl2JavaMojo.java
URL:
http://svn.apache.org/viewvc/axis/axis1/java/trunk/maven/maven-wsdl2java-plugin/src/main/java/org/apache/axis/tools/maven/wsdl2java/AbstractWsdl2JavaMojo.java?rev=1398987&r1=1398986&r2=1398987&view=diff
==============================================================================
---
axis/axis1/java/trunk/maven/maven-wsdl2java-plugin/src/main/java/org/apache/axis/tools/maven/wsdl2java/AbstractWsdl2JavaMojo.java
(original)
+++
axis/axis1/java/trunk/maven/maven-wsdl2java-plugin/src/main/java/org/apache/axis/tools/maven/wsdl2java/AbstractWsdl2JavaMojo.java
Tue Oct 16 20:42:02 2012
@@ -32,6 +32,8 @@ import org.apache.maven.plugin.AbstractM
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.project.MavenProject;
+import org.apache.xml.resolver.CatalogManager;
+import org.apache.xml.resolver.tools.CatalogResolver;
import com.github.veithen.ulog.PlexusLoggerInjector;
@@ -68,6 +70,15 @@ public abstract class AbstractWsdl2JavaM
private String url;
/**
+ * The catalog file to resolve external entity references. This can be any
type of catalog
+ * supported by <a
+ *
href="http://xerces.apache.org/xml-commons/components/resolver/">xml-resolver</a>.
+ *
+ * @parameter
+ */
+ private File catalog;
+
+ /**
* Determines the scope that will be specified for the service in the
deployment WSDD. Valid
* values are <code>application</code>, <code>request</code> and
<code>session</code>. This
* parameter has no effect if {@link #generate} is set to
<code>client</code> or if
@@ -297,6 +308,12 @@ public abstract class AbstractWsdl2JavaM
configureEmitter(emitter);
+ if (catalog != null) {
+ CatalogManager catalogManager = new CatalogManager();
+ catalogManager.setCatalogFiles(catalog.getAbsolutePath());
+ emitter.setEntityResolver(new CatalogResolver(catalogManager));
+ }
+
getLog().info("Processing " + wsdlUrl);
try {
Propchange: axis/axis1/java/trunk/test/wsdl/interop/
------------------------------------------------------------------------------
Merged /webservices/axis/branches/AXIS_1_4_FINAL/test/wsdl/interop:r356166
Merged /axis/axis1/java/branches/AXIS-1984/test/wsdl/interop:r1398421-1398984
Merged /axis/axis1/java/tags/1.4/test/wsdl/interop:r396062-1225644