ode-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Guillaume Nodet" <gno...@gmail.com>
Subject Resolving imported documents from wsdl / xsds
Date Mon, 08 Jan 2007 16:20:25 GMT
I'm trying to deploy a JBI service unit wich has the following struture:

  - deploy.xml
  - process.bpel
  - svc1/svc1-abstract.wsdl
  - svc1/svc1-plinks.wsdl
  - svc1/svc1-types.xsd
  - common/common-msgs.wsdl
  - common/common-types.xsd

The wsdl are importing wsdls and xsds with relative URI
with a "../common/common-msgs.wsdl".
There are several bugs in the deployment where documents
are resolved incorrectly, because all relative URIs are
resolved from the root folder, instead of being resolved
from the importing document.

I have a small patch that fixed some of these problems
that I will check in if nobody objects, but I don't think
this is the best solution.
The patch for the WSDLLocatorImpl is good imho, but
the one for the WsdlFindXMLEntityResolver is a bit of a hack.
The problem is that in the failing case, the
 literalSystemId = "../common/common-types.xsd"
which is loaded from the svc1/svc1-types.xsd file.
But when no baseUri is set, xerces assumes that files
are loaded from the current directory, so the
expandedSystemId are invalid absolute URIs.
So this patch relativize the uri wrt to the current dir,
so that the files can be found.

I think it may be more robust to use absolute URIs everywhere,
starting from the bpel file.  I think it would ease the process.
It could also support jar resources.  Would it be a problem ?

Index: src/main/java/org/apache/ode/bpel/compiler/WsdlFinderXMLEntityResolver.java
--- src/main/java/org/apache/ode/bpel/compiler/WsdlFinderXMLEntityResolver.java	(revision
+++ src/main/java/org/apache/ode/bpel/compiler/WsdlFinderXMLEntityResolver.java	(working
@@ -27,6 +27,7 @@
 import org.apache.xerces.xni.parser.XMLInputSource;

 import java.io.ByteArrayInputStream;
+import java.io.File;
 import java.io.IOException;
 import java.net.URI;
 import java.net.URISyntaxException;
@@ -64,7 +65,9 @@
         try {
             if (resourceIdentifier.getLiteralSystemId() == null)
                 location = new URI(resourceIdentifier.getNamespace());
-            else
+            else if (resourceIdentifier.getExpandedSystemId() != null
&& resourceIdentifier.getExpandedSystemId().startsWith("file:")) {
+                location = new
+            } else
                 location = new
         } catch (URISyntaxException e) {
             __log.debug("resolveEntity: URI syntax error", e);
Index: src/main/java/org/apache/ode/bpel/compiler/WSDLLocatorImpl.java
--- src/main/java/org/apache/ode/bpel/compiler/WSDLLocatorImpl.java	(revision
+++ src/main/java/org/apache/ode/bpel/compiler/WSDLLocatorImpl.java	(working
@@ -33,7 +33,7 @@

     public InputSource getImportInputSource(String parent, String imprt) {
-        URI uri = parent == null ? _base.resolve(imprt) :
+        URI uri = (parent == null || parent.equals(_base.toString()))
? _base.resolve(imprt) : URI.create(parent).resolve(imprt);
         InputSource is = new InputSource();
         try {

Guillaume Nodet

View raw message