Repository: ode Updated Branches: refs/heads/ode-1.3.x f82281446 -> daa933610
fixing ODE-1031, thanks to Igor Vorobiov for the patch. Project: http://git-wip-us.apache.org/repos/asf/ode/repo Commit: http://git-wip-us.apache.org/repos/asf/ode/commit/daa93361 Tree: http://git-wip-us.apache.org/repos/asf/ode/tree/daa93361 Diff: http://git-wip-us.apache.org/repos/asf/ode/diff/daa93361 Branch: refs/heads/ode-1.3.x Commit: daa933610f61ce53fa2a200b119ea4792055fa21 Parents: f822814 Author: Tammo van Lessen <[email protected]> Authored: Tue Jun 9 19:46:41 2015 +0200 Committer: Tammo van Lessen <[email protected]> Committed: Tue Jun 9 19:46:41 2015 +0200 ---------------------------------------------------------------------- .../apache/ode/bpel/compiler/WSDLRegistry.java | 58 +++++++++++++++----- 1 file changed, 45 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ode/blob/daa93361/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/WSDLRegistry.java ---------------------------------------------------------------------- diff --git a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/WSDLRegistry.java b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/WSDLRegistry.java index 319666d..6f0ae26 100644 --- a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/WSDLRegistry.java +++ b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/WSDLRegistry.java @@ -18,6 +18,28 @@ */ package org.apache.ode.bpel.compiler; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.net.URI; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import javax.wsdl.Definition; +import javax.wsdl.Import; +import javax.wsdl.Message; +import javax.wsdl.PortType; +import javax.wsdl.Types; +import javax.wsdl.extensions.ExtensibilityElement; +import javax.xml.namespace.QName; +import javax.xml.transform.Source; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamSource; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.ode.bpel.compiler.api.CompilationException; @@ -37,19 +59,6 @@ import org.apache.ode.utils.xsd.XsdException; import org.w3c.dom.Document; import org.xml.sax.InputSource; -import javax.wsdl.*; -import javax.wsdl.extensions.ExtensibilityElement; -import javax.xml.namespace.QName; -import javax.xml.transform.Source; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamSource; - -import java.io.ByteArrayInputStream; -import java.io.StringReader; -import java.io.IOException; -import java.net.URI; -import java.util.*; - /** * A parsed collection of WSDL definitions, including BPEL-specific extensions. @@ -213,6 +222,8 @@ class WSDLRegistry { Types types = def.getTypes(); if (types != null) { + addAllInternalSchemas(def); + int localSchemaId = 0; for (Iterator<ExtensibilityElement> iter = ((List<ExtensibilityElement>)def.getTypes().getExtensibilityElements()).iterator(); @@ -270,6 +281,27 @@ class WSDLRegistry { } } + @SuppressWarnings("unchecked") + private void addAllInternalSchemas(Definition def) { + for (Iterator<ExtensibilityElement> iter = ((List<ExtensibilityElement>) def.getTypes().getExtensibilityElements()).iterator(); iter.hasNext();) { + ExtensibilityElement ee = iter.next(); + + if (ee instanceof XMLSchemaType) { + byte[] schema = ((XMLSchemaType) ee).getXMLSchema(); + try { + Document doc = DOMUtils.parse(new InputSource(new ByteArrayInputStream(schema))); + String schemaTargetNS = doc.getDocumentElement().getAttribute("targetNamespace"); + if (schemaTargetNS != null && schemaTargetNS.length() > 0) { + _internalSchemas.put(new URI(schemaTargetNS), schema); + _documentSchemas.put(new URI(schemaTargetNS), doc); + } + } catch (Exception e) { + throw new RuntimeException("Couldn't parse schema in " + def.getTargetNamespace(), e); + } + } + } + } + public org.apache.ode.bpel.compiler.bom.Property getProperty(QName name) { ArrayList<Definition4BPEL> defs = _definitions.get(name.getNamespaceURI()); if (defs == null) return null;
