Author: mageshbk(a)jboss.com
Date: 2009-04-08 01:05:08 -0400 (Wed, 08 Apr 2009)
New Revision: 9758
Modified:
stack/native/branches/jbossws-native-2.0.1.SP2_CP04_JBEPP-61/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Reader.java
Log:
[JBEPP-61] Port [JBWS-2244 - EntityResolver is not used when schema imports are handled.]
to JBEPP4.3
Modified:
stack/native/branches/jbossws-native-2.0.1.SP2_CP04_JBEPP-61/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Reader.java
===================================================================
---
stack/native/branches/jbossws-native-2.0.1.SP2_CP04_JBEPP-61/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Reader.java 2009-04-07
09:20:26 UTC (rev 9757)
+++
stack/native/branches/jbossws-native-2.0.1.SP2_CP04_JBEPP-61/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Reader.java 2009-04-08
05:05:08 UTC (rev 9758)
@@ -75,6 +75,7 @@
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
import org.jboss.ws.core.soap.Style;
+import org.jboss.ws.core.utils.JBossWSEntityResolver;
import org.jboss.ws.core.utils.ResourceURL;
import org.jboss.ws.metadata.wsdl.Extendable;
import org.jboss.ws.metadata.wsdl.WSDLBinding;
@@ -111,6 +112,7 @@
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
/**
* A helper that translates a WSDL-1.1 object graph into a WSDL-2.0 object graph.
@@ -575,7 +577,24 @@
schemaLocationsMap.put(namespace, currLoc);
// Recursively handle schema imports
- Element importedSchema = DOMUtils.parse(currLoc.openStream());
+ Element importedSchema = null;
+ String schema = currLoc.toString();
+ JBossWSEntityResolver entityResolver = new JBossWSEntityResolver();
+ if (entityResolver.getEntityMap().containsKey(schema))
+ {
+ try
+ {
+ importedSchema = DOMUtils.parse(entityResolver.resolveEntity(schema,
schema).getByteStream());
+ }
+ catch (SAXException se)
+ {
+ log.error(se.getMessage(), se);
+ }
+ }
+ if (importedSchema == null)
+ {
+ importedSchema = DOMUtils.parse(currLoc.openStream());
+ }
handleSchemaImports(importedSchema, currLoc);
}
}
Show replies by date