You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by "Matthieu Riou (JIRA)" <ji...@apache.org> on 2007/10/18 01:46:50 UTC

[jira] Created: (WSCOMMONS-265) WSDL importing XSD importing another XSD isn't properly resolved for relative imports

WSDL importing XSD importing another XSD isn't properly resolved for relative imports
-------------------------------------------------------------------------------------

                 Key: WSCOMMONS-265
                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-265
             Project: WS-Commons
          Issue Type: Bug
          Components: XmlSchema
            Reporter: Matthieu Riou


I have to following situation (where -> means import and the relative location of each file is between parentheses):

WSDL (/) -> XSD1(/schema) -> XSD2 (/schema)

I'm using Axis2 which loads the WSDL for me. I also have my own URIResolver. For the first import, I get the proper baseUri in my resolver (it's the URI of the WSDL). However for XSD2 the baseUri I'm getting is still the one of the WSDL instead, which can't be found properly when different relative locations.

Apparently imports within a WSDL document (including transitive ones like we have here) seem to be associated to a single XmlSchemaCollection. And the baseUri used for all resolving is the one of the collection. They should either have a collection per document or associate a baseUri with the document instead of the collection.

For reference the source of my resolve is the following:

    public InputSource resolveEntity(String targetNamespace, String schemaLocation, String baseUri) {
        if (LOG.isDebugEnabled()) {
            LOG.debug("resolveEntity: targetNamespace=" + targetNamespace + " schemaLocation=" + schemaLocation
                      + " baseUri=" + baseUri);
        }
        InputStream is;
        try {
            URI base = new URI(baseUri);
            URI uri = base.resolve(schemaLocation);
            is = uri.toURL().openStream();
            if (is == null) {
                LOG.error("Exception resolving entity: schemaLocation=" + schemaLocation + " baseUri=" + baseUri);
                return null;
            }
            InputSource source = new InputSource(is);
            source.setSystemId(uri.toString());
            source.setPublicId(schemaLocation);
            return new InputSource(is);
        } catch (Exception e) {
            LOG.error("Exception resolving entity: schemaLocation=" + schemaLocation + " baseUri=" + baseUri, e);
            return null;
        }
    }

The stacktrace that I get is:

ERROR - GeronimoLog.error(108) | Exception resolving entity: schemaLocation=ListeProduit.xsd baseUri=file:/home/mriou/dev/tools/platform/apache-tomcat-5.5.23/webapps/ode/WEB-INF/processes/TestXSD/BPMN/NewDiagram2-Pool0.wsdl
java.io.FileNotFoundException: /home/mriou/dev/tools/platform/apache-tomcat-5.5.23/webapps/ode/WEB-INF/processes/TestXSD/BPMN/ListeProduit.xsd (No such file or directory)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(FileInputStream.java:106)
        at java.io.FileInputStream.<init>(FileInputStream.java:66)
        at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:70)
        at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:161)
        at java.net.URL.openStream(URL.java:1007)
        at org.apache.ode.axis2.util.Axis2UriResolver.resolveEntity(Axis2UriResolver.java:41)
        at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1872)
        at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1902)
        at org.apache.ws.commons.schema.SchemaBuilder.handleInclude(SchemaBuilder.java:1674)
        at org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:169)
        at org.apache.ws.commons.schema.SchemaBuilder.build(SchemaBuilder.java:82)
        at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:359)
        at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:304)
        at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1884)
        at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1902)
        at org.apache.ws.commons.schema.SchemaBuilder.handleInclude(SchemaBuilder.java:1674)
        at org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:169)
        at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:347)
        at org.apache.axis2.description.WSDLToAxisServiceBuilder.getXMLSchema(WSDLToAxisServiceBuilder.java:140)

And I'm going to attach a zip containing the wsdl and the two xsds to illustrate the situation.

Thanks!

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org


[jira] Commented: (WSCOMMONS-265) WSDL importing XSD importing another XSD isn't properly resolved for relative imports

Posted by "Ajith Harshana Ranabahu (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WSCOMMONS-265?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12536895 ] 

Ajith Harshana Ranabahu commented on WSCOMMONS-265:
---------------------------------------------------

This seems to be a specific integration issue with WSDL2Java in Axis2 ? We need to have a discussion with the Axis2 community about this. Frankly I do not see what we can do with XMLSchema for this one.

> WSDL importing XSD importing another XSD isn't properly resolved for relative imports
> -------------------------------------------------------------------------------------
>
>                 Key: WSCOMMONS-265
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-265
>             Project: WS-Commons
>          Issue Type: Bug
>          Components: XmlSchema
>            Reporter: Matthieu Riou
>         Attachments: relative-double-import.zip
>
>
> I have to following situation (where -> means import and the relative location of each file is between parentheses):
> WSDL (/) -> XSD1(/schema) -> XSD2 (/schema)
> I'm using Axis2 which loads the WSDL for me. I also have my own URIResolver. For the first import, I get the proper baseUri in my resolver (it's the URI of the WSDL). However for XSD2 the baseUri I'm getting is still the one of the WSDL instead, which can't be found properly when different relative locations.
> Apparently imports within a WSDL document (including transitive ones like we have here) seem to be associated to a single XmlSchemaCollection. And the baseUri used for all resolving is the one of the collection. They should either have a collection per document or associate a baseUri with the document instead of the collection.
> For reference the source of my resolve is the following:
>     public InputSource resolveEntity(String targetNamespace, String schemaLocation, String baseUri) {
>         if (LOG.isDebugEnabled()) {
>             LOG.debug("resolveEntity: targetNamespace=" + targetNamespace + " schemaLocation=" + schemaLocation
>                       + " baseUri=" + baseUri);
>         }
>         InputStream is;
>         try {
>             URI base = new URI(baseUri);
>             URI uri = base.resolve(schemaLocation);
>             is = uri.toURL().openStream();
>             if (is == null) {
>                 LOG.error("Exception resolving entity: schemaLocation=" + schemaLocation + " baseUri=" + baseUri);
>                 return null;
>             }
>             InputSource source = new InputSource(is);
>             source.setSystemId(uri.toString());
>             source.setPublicId(schemaLocation);
>             return new InputSource(is);
>         } catch (Exception e) {
>             LOG.error("Exception resolving entity: schemaLocation=" + schemaLocation + " baseUri=" + baseUri, e);
>             return null;
>         }
>     }
> The stacktrace that I get is:
> ERROR - GeronimoLog.error(108) | Exception resolving entity: schemaLocation=ListeProduit.xsd baseUri=file:/home/mriou/dev/tools/platform/apache-tomcat-5.5.23/webapps/ode/WEB-INF/processes/TestXSD/BPMN/NewDiagram2-Pool0.wsdl
> java.io.FileNotFoundException: /home/mriou/dev/tools/platform/apache-tomcat-5.5.23/webapps/ode/WEB-INF/processes/TestXSD/BPMN/ListeProduit.xsd (No such file or directory)
>         at java.io.FileInputStream.open(Native Method)
>         at java.io.FileInputStream.<init>(FileInputStream.java:106)
>         at java.io.FileInputStream.<init>(FileInputStream.java:66)
>         at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:70)
>         at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:161)
>         at java.net.URL.openStream(URL.java:1007)
>         at org.apache.ode.axis2.util.Axis2UriResolver.resolveEntity(Axis2UriResolver.java:41)
>         at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1872)
>         at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1902)
>         at org.apache.ws.commons.schema.SchemaBuilder.handleInclude(SchemaBuilder.java:1674)
>         at org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:169)
>         at org.apache.ws.commons.schema.SchemaBuilder.build(SchemaBuilder.java:82)
>         at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:359)
>         at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:304)
>         at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1884)
>         at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1902)
>         at org.apache.ws.commons.schema.SchemaBuilder.handleInclude(SchemaBuilder.java:1674)
>         at org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:169)
>         at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:347)
>         at org.apache.axis2.description.WSDLToAxisServiceBuilder.getXMLSchema(WSDLToAxisServiceBuilder.java:140)
> And I'm going to attach a zip containing the wsdl and the two xsds to illustrate the situation.
> Thanks!

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org


[jira] Updated: (WSCOMMONS-265) WSDL importing XSD importing another XSD isn't properly resolved for relative imports

Posted by "Matthieu Riou (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WSCOMMONS-265?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Matthieu Riou updated WSCOMMONS-265:
------------------------------------

    Attachment: relative-double-import.zip

The WSDL importing relatively on XSD that in turn imports another XSD.

> WSDL importing XSD importing another XSD isn't properly resolved for relative imports
> -------------------------------------------------------------------------------------
>
>                 Key: WSCOMMONS-265
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-265
>             Project: WS-Commons
>          Issue Type: Bug
>          Components: XmlSchema
>            Reporter: Matthieu Riou
>         Attachments: relative-double-import.zip
>
>
> I have to following situation (where -> means import and the relative location of each file is between parentheses):
> WSDL (/) -> XSD1(/schema) -> XSD2 (/schema)
> I'm using Axis2 which loads the WSDL for me. I also have my own URIResolver. For the first import, I get the proper baseUri in my resolver (it's the URI of the WSDL). However for XSD2 the baseUri I'm getting is still the one of the WSDL instead, which can't be found properly when different relative locations.
> Apparently imports within a WSDL document (including transitive ones like we have here) seem to be associated to a single XmlSchemaCollection. And the baseUri used for all resolving is the one of the collection. They should either have a collection per document or associate a baseUri with the document instead of the collection.
> For reference the source of my resolve is the following:
>     public InputSource resolveEntity(String targetNamespace, String schemaLocation, String baseUri) {
>         if (LOG.isDebugEnabled()) {
>             LOG.debug("resolveEntity: targetNamespace=" + targetNamespace + " schemaLocation=" + schemaLocation
>                       + " baseUri=" + baseUri);
>         }
>         InputStream is;
>         try {
>             URI base = new URI(baseUri);
>             URI uri = base.resolve(schemaLocation);
>             is = uri.toURL().openStream();
>             if (is == null) {
>                 LOG.error("Exception resolving entity: schemaLocation=" + schemaLocation + " baseUri=" + baseUri);
>                 return null;
>             }
>             InputSource source = new InputSource(is);
>             source.setSystemId(uri.toString());
>             source.setPublicId(schemaLocation);
>             return new InputSource(is);
>         } catch (Exception e) {
>             LOG.error("Exception resolving entity: schemaLocation=" + schemaLocation + " baseUri=" + baseUri, e);
>             return null;
>         }
>     }
> The stacktrace that I get is:
> ERROR - GeronimoLog.error(108) | Exception resolving entity: schemaLocation=ListeProduit.xsd baseUri=file:/home/mriou/dev/tools/platform/apache-tomcat-5.5.23/webapps/ode/WEB-INF/processes/TestXSD/BPMN/NewDiagram2-Pool0.wsdl
> java.io.FileNotFoundException: /home/mriou/dev/tools/platform/apache-tomcat-5.5.23/webapps/ode/WEB-INF/processes/TestXSD/BPMN/ListeProduit.xsd (No such file or directory)
>         at java.io.FileInputStream.open(Native Method)
>         at java.io.FileInputStream.<init>(FileInputStream.java:106)
>         at java.io.FileInputStream.<init>(FileInputStream.java:66)
>         at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:70)
>         at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:161)
>         at java.net.URL.openStream(URL.java:1007)
>         at org.apache.ode.axis2.util.Axis2UriResolver.resolveEntity(Axis2UriResolver.java:41)
>         at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1872)
>         at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1902)
>         at org.apache.ws.commons.schema.SchemaBuilder.handleInclude(SchemaBuilder.java:1674)
>         at org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:169)
>         at org.apache.ws.commons.schema.SchemaBuilder.build(SchemaBuilder.java:82)
>         at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:359)
>         at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:304)
>         at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1884)
>         at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1902)
>         at org.apache.ws.commons.schema.SchemaBuilder.handleInclude(SchemaBuilder.java:1674)
>         at org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:169)
>         at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:347)
>         at org.apache.axis2.description.WSDLToAxisServiceBuilder.getXMLSchema(WSDLToAxisServiceBuilder.java:140)
> And I'm going to attach a zip containing the wsdl and the two xsds to illustrate the situation.
> Thanks!

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org


[jira] Commented: (WSCOMMONS-265) WSDL importing XSD importing another XSD isn't properly resolved for relative imports

Posted by "Matthieu Riou (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WSCOMMONS-265?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12549065 ] 

Matthieu Riou commented on WSCOMMONS-265:
-----------------------------------------

Any news on that problem? It's a bit annoying in Apache ODE as we have to ask our users to work this around.

> WSDL importing XSD importing another XSD isn't properly resolved for relative imports
> -------------------------------------------------------------------------------------
>
>                 Key: WSCOMMONS-265
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-265
>             Project: WS-Commons
>          Issue Type: Bug
>          Components: XmlSchema
>            Reporter: Matthieu Riou
>         Attachments: relative-double-import.zip
>
>
> I have to following situation (where -> means import and the relative location of each file is between parentheses):
> WSDL (/) -> XSD1(/schema) -> XSD2 (/schema)
> I'm using Axis2 which loads the WSDL for me. I also have my own URIResolver. For the first import, I get the proper baseUri in my resolver (it's the URI of the WSDL). However for XSD2 the baseUri I'm getting is still the one of the WSDL instead, which can't be found properly when different relative locations.
> Apparently imports within a WSDL document (including transitive ones like we have here) seem to be associated to a single XmlSchemaCollection. And the baseUri used for all resolving is the one of the collection. They should either have a collection per document or associate a baseUri with the document instead of the collection.
> For reference the source of my resolve is the following:
>     public InputSource resolveEntity(String targetNamespace, String schemaLocation, String baseUri) {
>         if (LOG.isDebugEnabled()) {
>             LOG.debug("resolveEntity: targetNamespace=" + targetNamespace + " schemaLocation=" + schemaLocation
>                       + " baseUri=" + baseUri);
>         }
>         InputStream is;
>         try {
>             URI base = new URI(baseUri);
>             URI uri = base.resolve(schemaLocation);
>             is = uri.toURL().openStream();
>             if (is == null) {
>                 LOG.error("Exception resolving entity: schemaLocation=" + schemaLocation + " baseUri=" + baseUri);
>                 return null;
>             }
>             InputSource source = new InputSource(is);
>             source.setSystemId(uri.toString());
>             source.setPublicId(schemaLocation);
>             return new InputSource(is);
>         } catch (Exception e) {
>             LOG.error("Exception resolving entity: schemaLocation=" + schemaLocation + " baseUri=" + baseUri, e);
>             return null;
>         }
>     }
> The stacktrace that I get is:
> ERROR - GeronimoLog.error(108) | Exception resolving entity: schemaLocation=ListeProduit.xsd baseUri=file:/home/mriou/dev/tools/platform/apache-tomcat-5.5.23/webapps/ode/WEB-INF/processes/TestXSD/BPMN/NewDiagram2-Pool0.wsdl
> java.io.FileNotFoundException: /home/mriou/dev/tools/platform/apache-tomcat-5.5.23/webapps/ode/WEB-INF/processes/TestXSD/BPMN/ListeProduit.xsd (No such file or directory)
>         at java.io.FileInputStream.open(Native Method)
>         at java.io.FileInputStream.<init>(FileInputStream.java:106)
>         at java.io.FileInputStream.<init>(FileInputStream.java:66)
>         at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:70)
>         at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:161)
>         at java.net.URL.openStream(URL.java:1007)
>         at org.apache.ode.axis2.util.Axis2UriResolver.resolveEntity(Axis2UriResolver.java:41)
>         at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1872)
>         at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1902)
>         at org.apache.ws.commons.schema.SchemaBuilder.handleInclude(SchemaBuilder.java:1674)
>         at org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:169)
>         at org.apache.ws.commons.schema.SchemaBuilder.build(SchemaBuilder.java:82)
>         at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:359)
>         at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:304)
>         at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1884)
>         at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1902)
>         at org.apache.ws.commons.schema.SchemaBuilder.handleInclude(SchemaBuilder.java:1674)
>         at org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:169)
>         at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:347)
>         at org.apache.axis2.description.WSDLToAxisServiceBuilder.getXMLSchema(WSDLToAxisServiceBuilder.java:140)
> And I'm going to attach a zip containing the wsdl and the two xsds to illustrate the situation.
> Thanks!

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org


[jira] Commented: (WSCOMMONS-265) WSDL importing XSD importing another XSD isn't properly resolved for relative imports

Posted by "Matthieu Riou (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WSCOMMONS-265?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12538623 ] 

Matthieu Riou commented on WSCOMMONS-265:
-----------------------------------------

Why does it make you think it would be specific to WSDL2Java? The tool isn't used at all in that case. We're using WSDLToAxisServiceBuilder directly and AFAIK it doesn't deal with the resolving. Here it's XmlSchema that tries to resolve another imported schema..

> WSDL importing XSD importing another XSD isn't properly resolved for relative imports
> -------------------------------------------------------------------------------------
>
>                 Key: WSCOMMONS-265
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-265
>             Project: WS-Commons
>          Issue Type: Bug
>          Components: XmlSchema
>            Reporter: Matthieu Riou
>         Attachments: relative-double-import.zip
>
>
> I have to following situation (where -> means import and the relative location of each file is between parentheses):
> WSDL (/) -> XSD1(/schema) -> XSD2 (/schema)
> I'm using Axis2 which loads the WSDL for me. I also have my own URIResolver. For the first import, I get the proper baseUri in my resolver (it's the URI of the WSDL). However for XSD2 the baseUri I'm getting is still the one of the WSDL instead, which can't be found properly when different relative locations.
> Apparently imports within a WSDL document (including transitive ones like we have here) seem to be associated to a single XmlSchemaCollection. And the baseUri used for all resolving is the one of the collection. They should either have a collection per document or associate a baseUri with the document instead of the collection.
> For reference the source of my resolve is the following:
>     public InputSource resolveEntity(String targetNamespace, String schemaLocation, String baseUri) {
>         if (LOG.isDebugEnabled()) {
>             LOG.debug("resolveEntity: targetNamespace=" + targetNamespace + " schemaLocation=" + schemaLocation
>                       + " baseUri=" + baseUri);
>         }
>         InputStream is;
>         try {
>             URI base = new URI(baseUri);
>             URI uri = base.resolve(schemaLocation);
>             is = uri.toURL().openStream();
>             if (is == null) {
>                 LOG.error("Exception resolving entity: schemaLocation=" + schemaLocation + " baseUri=" + baseUri);
>                 return null;
>             }
>             InputSource source = new InputSource(is);
>             source.setSystemId(uri.toString());
>             source.setPublicId(schemaLocation);
>             return new InputSource(is);
>         } catch (Exception e) {
>             LOG.error("Exception resolving entity: schemaLocation=" + schemaLocation + " baseUri=" + baseUri, e);
>             return null;
>         }
>     }
> The stacktrace that I get is:
> ERROR - GeronimoLog.error(108) | Exception resolving entity: schemaLocation=ListeProduit.xsd baseUri=file:/home/mriou/dev/tools/platform/apache-tomcat-5.5.23/webapps/ode/WEB-INF/processes/TestXSD/BPMN/NewDiagram2-Pool0.wsdl
> java.io.FileNotFoundException: /home/mriou/dev/tools/platform/apache-tomcat-5.5.23/webapps/ode/WEB-INF/processes/TestXSD/BPMN/ListeProduit.xsd (No such file or directory)
>         at java.io.FileInputStream.open(Native Method)
>         at java.io.FileInputStream.<init>(FileInputStream.java:106)
>         at java.io.FileInputStream.<init>(FileInputStream.java:66)
>         at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:70)
>         at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:161)
>         at java.net.URL.openStream(URL.java:1007)
>         at org.apache.ode.axis2.util.Axis2UriResolver.resolveEntity(Axis2UriResolver.java:41)
>         at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1872)
>         at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1902)
>         at org.apache.ws.commons.schema.SchemaBuilder.handleInclude(SchemaBuilder.java:1674)
>         at org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:169)
>         at org.apache.ws.commons.schema.SchemaBuilder.build(SchemaBuilder.java:82)
>         at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:359)
>         at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:304)
>         at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1884)
>         at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1902)
>         at org.apache.ws.commons.schema.SchemaBuilder.handleInclude(SchemaBuilder.java:1674)
>         at org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:169)
>         at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:347)
>         at org.apache.axis2.description.WSDLToAxisServiceBuilder.getXMLSchema(WSDLToAxisServiceBuilder.java:140)
> And I'm going to attach a zip containing the wsdl and the two xsds to illustrate the situation.
> Thanks!

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org


[jira] Resolved: (WSCOMMONS-265) WSDL importing XSD importing another XSD isn't properly resolved for relative imports

Posted by "Ajith Harshana Ranabahu (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WSCOMMONS-265?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ajith Harshana Ranabahu resolved WSCOMMONS-265.
-----------------------------------------------

    Resolution: Fixed
      Assignee: Ajith Harshana Ranabahu

I am marking this as resolved since Matthieu has noted that they found the issue and it is not with XmlSchema

> WSDL importing XSD importing another XSD isn't properly resolved for relative imports
> -------------------------------------------------------------------------------------
>
>                 Key: WSCOMMONS-265
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-265
>             Project: WS-Commons
>          Issue Type: Bug
>          Components: XmlSchema
>            Reporter: Matthieu Riou
>            Assignee: Ajith Harshana Ranabahu
>         Attachments: relative-double-import.zip
>
>
> I have to following situation (where -> means import and the relative location of each file is between parentheses):
> WSDL (/) -> XSD1(/schema) -> XSD2 (/schema)
> I'm using Axis2 which loads the WSDL for me. I also have my own URIResolver. For the first import, I get the proper baseUri in my resolver (it's the URI of the WSDL). However for XSD2 the baseUri I'm getting is still the one of the WSDL instead, which can't be found properly when different relative locations.
> Apparently imports within a WSDL document (including transitive ones like we have here) seem to be associated to a single XmlSchemaCollection. And the baseUri used for all resolving is the one of the collection. They should either have a collection per document or associate a baseUri with the document instead of the collection.
> For reference the source of my resolve is the following:
>     public InputSource resolveEntity(String targetNamespace, String schemaLocation, String baseUri) {
>         if (LOG.isDebugEnabled()) {
>             LOG.debug("resolveEntity: targetNamespace=" + targetNamespace + " schemaLocation=" + schemaLocation
>                       + " baseUri=" + baseUri);
>         }
>         InputStream is;
>         try {
>             URI base = new URI(baseUri);
>             URI uri = base.resolve(schemaLocation);
>             is = uri.toURL().openStream();
>             if (is == null) {
>                 LOG.error("Exception resolving entity: schemaLocation=" + schemaLocation + " baseUri=" + baseUri);
>                 return null;
>             }
>             InputSource source = new InputSource(is);
>             source.setSystemId(uri.toString());
>             source.setPublicId(schemaLocation);
>             return new InputSource(is);
>         } catch (Exception e) {
>             LOG.error("Exception resolving entity: schemaLocation=" + schemaLocation + " baseUri=" + baseUri, e);
>             return null;
>         }
>     }
> The stacktrace that I get is:
> ERROR - GeronimoLog.error(108) | Exception resolving entity: schemaLocation=ListeProduit.xsd baseUri=file:/home/mriou/dev/tools/platform/apache-tomcat-5.5.23/webapps/ode/WEB-INF/processes/TestXSD/BPMN/NewDiagram2-Pool0.wsdl
> java.io.FileNotFoundException: /home/mriou/dev/tools/platform/apache-tomcat-5.5.23/webapps/ode/WEB-INF/processes/TestXSD/BPMN/ListeProduit.xsd (No such file or directory)
>         at java.io.FileInputStream.open(Native Method)
>         at java.io.FileInputStream.<init>(FileInputStream.java:106)
>         at java.io.FileInputStream.<init>(FileInputStream.java:66)
>         at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:70)
>         at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:161)
>         at java.net.URL.openStream(URL.java:1007)
>         at org.apache.ode.axis2.util.Axis2UriResolver.resolveEntity(Axis2UriResolver.java:41)
>         at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1872)
>         at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1902)
>         at org.apache.ws.commons.schema.SchemaBuilder.handleInclude(SchemaBuilder.java:1674)
>         at org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:169)
>         at org.apache.ws.commons.schema.SchemaBuilder.build(SchemaBuilder.java:82)
>         at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:359)
>         at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:304)
>         at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1884)
>         at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1902)
>         at org.apache.ws.commons.schema.SchemaBuilder.handleInclude(SchemaBuilder.java:1674)
>         at org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:169)
>         at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:347)
>         at org.apache.axis2.description.WSDLToAxisServiceBuilder.getXMLSchema(WSDLToAxisServiceBuilder.java:140)
> And I'm going to attach a zip containing the wsdl and the two xsds to illustrate the situation.
> Thanks!

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org


[jira] Commented: (WSCOMMONS-265) WSDL importing XSD importing another XSD isn't properly resolved for relative imports

Posted by "Hugues Malphettes (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WSCOMMONS-265?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12567171#action_12567171 ] 

Hugues Malphettes commented on WSCOMMONS-265:
---------------------------------------------

Ajith, we have done some investigation and indeed it is not a problem with XmlSchema.

It is WSDLToAxisServiceBuilder#getXMLSchema(Element element, String baseUri)
It calls XmlSchemaCollection#read(Element elem)
But it should be calling: XmlSchemaCollection#read(Element elem, String baseUri)

Matthieu confirms that overriding the method to do that fixes the issue.

I am curious: what is the usage of XmlSchemaCollection#read(Element elem)
and when is it appropriate to call: XmlSchemaCollection#getBaseUri()?

Thanks for your attention.

> WSDL importing XSD importing another XSD isn't properly resolved for relative imports
> -------------------------------------------------------------------------------------
>
>                 Key: WSCOMMONS-265
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-265
>             Project: WS-Commons
>          Issue Type: Bug
>          Components: XmlSchema
>            Reporter: Matthieu Riou
>         Attachments: relative-double-import.zip
>
>
> I have to following situation (where -> means import and the relative location of each file is between parentheses):
> WSDL (/) -> XSD1(/schema) -> XSD2 (/schema)
> I'm using Axis2 which loads the WSDL for me. I also have my own URIResolver. For the first import, I get the proper baseUri in my resolver (it's the URI of the WSDL). However for XSD2 the baseUri I'm getting is still the one of the WSDL instead, which can't be found properly when different relative locations.
> Apparently imports within a WSDL document (including transitive ones like we have here) seem to be associated to a single XmlSchemaCollection. And the baseUri used for all resolving is the one of the collection. They should either have a collection per document or associate a baseUri with the document instead of the collection.
> For reference the source of my resolve is the following:
>     public InputSource resolveEntity(String targetNamespace, String schemaLocation, String baseUri) {
>         if (LOG.isDebugEnabled()) {
>             LOG.debug("resolveEntity: targetNamespace=" + targetNamespace + " schemaLocation=" + schemaLocation
>                       + " baseUri=" + baseUri);
>         }
>         InputStream is;
>         try {
>             URI base = new URI(baseUri);
>             URI uri = base.resolve(schemaLocation);
>             is = uri.toURL().openStream();
>             if (is == null) {
>                 LOG.error("Exception resolving entity: schemaLocation=" + schemaLocation + " baseUri=" + baseUri);
>                 return null;
>             }
>             InputSource source = new InputSource(is);
>             source.setSystemId(uri.toString());
>             source.setPublicId(schemaLocation);
>             return new InputSource(is);
>         } catch (Exception e) {
>             LOG.error("Exception resolving entity: schemaLocation=" + schemaLocation + " baseUri=" + baseUri, e);
>             return null;
>         }
>     }
> The stacktrace that I get is:
> ERROR - GeronimoLog.error(108) | Exception resolving entity: schemaLocation=ListeProduit.xsd baseUri=file:/home/mriou/dev/tools/platform/apache-tomcat-5.5.23/webapps/ode/WEB-INF/processes/TestXSD/BPMN/NewDiagram2-Pool0.wsdl
> java.io.FileNotFoundException: /home/mriou/dev/tools/platform/apache-tomcat-5.5.23/webapps/ode/WEB-INF/processes/TestXSD/BPMN/ListeProduit.xsd (No such file or directory)
>         at java.io.FileInputStream.open(Native Method)
>         at java.io.FileInputStream.<init>(FileInputStream.java:106)
>         at java.io.FileInputStream.<init>(FileInputStream.java:66)
>         at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:70)
>         at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:161)
>         at java.net.URL.openStream(URL.java:1007)
>         at org.apache.ode.axis2.util.Axis2UriResolver.resolveEntity(Axis2UriResolver.java:41)
>         at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1872)
>         at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1902)
>         at org.apache.ws.commons.schema.SchemaBuilder.handleInclude(SchemaBuilder.java:1674)
>         at org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:169)
>         at org.apache.ws.commons.schema.SchemaBuilder.build(SchemaBuilder.java:82)
>         at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:359)
>         at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:304)
>         at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1884)
>         at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1902)
>         at org.apache.ws.commons.schema.SchemaBuilder.handleInclude(SchemaBuilder.java:1674)
>         at org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:169)
>         at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:347)
>         at org.apache.axis2.description.WSDLToAxisServiceBuilder.getXMLSchema(WSDLToAxisServiceBuilder.java:140)
> And I'm going to attach a zip containing the wsdl and the two xsds to illustrate the situation.
> Thanks!

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org


[jira] Commented: (WSCOMMONS-265) WSDL importing XSD importing another XSD isn't properly resolved for relative imports

Posted by "Ajith Harshana Ranabahu (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WSCOMMONS-265?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12569744#action_12569744 ] 

Ajith Harshana Ranabahu commented on WSCOMMONS-265:
---------------------------------------------------

AFAIK when you already have a reference to a DOM element (which may well be a completely programmatically built - not read from a file or a URL) it is hard to tell what is the baseURI to use for resolving imports. So when only a dom element is provided it just defaults to the current directory as the base for schema resolving. When you pass an explicit reference of the base URI it uses that as the base for resolving imports

> WSDL importing XSD importing another XSD isn't properly resolved for relative imports
> -------------------------------------------------------------------------------------
>
>                 Key: WSCOMMONS-265
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-265
>             Project: WS-Commons
>          Issue Type: Bug
>          Components: XmlSchema
>            Reporter: Matthieu Riou
>         Attachments: relative-double-import.zip
>
>
> I have to following situation (where -> means import and the relative location of each file is between parentheses):
> WSDL (/) -> XSD1(/schema) -> XSD2 (/schema)
> I'm using Axis2 which loads the WSDL for me. I also have my own URIResolver. For the first import, I get the proper baseUri in my resolver (it's the URI of the WSDL). However for XSD2 the baseUri I'm getting is still the one of the WSDL instead, which can't be found properly when different relative locations.
> Apparently imports within a WSDL document (including transitive ones like we have here) seem to be associated to a single XmlSchemaCollection. And the baseUri used for all resolving is the one of the collection. They should either have a collection per document or associate a baseUri with the document instead of the collection.
> For reference the source of my resolve is the following:
>     public InputSource resolveEntity(String targetNamespace, String schemaLocation, String baseUri) {
>         if (LOG.isDebugEnabled()) {
>             LOG.debug("resolveEntity: targetNamespace=" + targetNamespace + " schemaLocation=" + schemaLocation
>                       + " baseUri=" + baseUri);
>         }
>         InputStream is;
>         try {
>             URI base = new URI(baseUri);
>             URI uri = base.resolve(schemaLocation);
>             is = uri.toURL().openStream();
>             if (is == null) {
>                 LOG.error("Exception resolving entity: schemaLocation=" + schemaLocation + " baseUri=" + baseUri);
>                 return null;
>             }
>             InputSource source = new InputSource(is);
>             source.setSystemId(uri.toString());
>             source.setPublicId(schemaLocation);
>             return new InputSource(is);
>         } catch (Exception e) {
>             LOG.error("Exception resolving entity: schemaLocation=" + schemaLocation + " baseUri=" + baseUri, e);
>             return null;
>         }
>     }
> The stacktrace that I get is:
> ERROR - GeronimoLog.error(108) | Exception resolving entity: schemaLocation=ListeProduit.xsd baseUri=file:/home/mriou/dev/tools/platform/apache-tomcat-5.5.23/webapps/ode/WEB-INF/processes/TestXSD/BPMN/NewDiagram2-Pool0.wsdl
> java.io.FileNotFoundException: /home/mriou/dev/tools/platform/apache-tomcat-5.5.23/webapps/ode/WEB-INF/processes/TestXSD/BPMN/ListeProduit.xsd (No such file or directory)
>         at java.io.FileInputStream.open(Native Method)
>         at java.io.FileInputStream.<init>(FileInputStream.java:106)
>         at java.io.FileInputStream.<init>(FileInputStream.java:66)
>         at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:70)
>         at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:161)
>         at java.net.URL.openStream(URL.java:1007)
>         at org.apache.ode.axis2.util.Axis2UriResolver.resolveEntity(Axis2UriResolver.java:41)
>         at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1872)
>         at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1902)
>         at org.apache.ws.commons.schema.SchemaBuilder.handleInclude(SchemaBuilder.java:1674)
>         at org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:169)
>         at org.apache.ws.commons.schema.SchemaBuilder.build(SchemaBuilder.java:82)
>         at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:359)
>         at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:304)
>         at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1884)
>         at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1902)
>         at org.apache.ws.commons.schema.SchemaBuilder.handleInclude(SchemaBuilder.java:1674)
>         at org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:169)
>         at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:347)
>         at org.apache.axis2.description.WSDLToAxisServiceBuilder.getXMLSchema(WSDLToAxisServiceBuilder.java:140)
> And I'm going to attach a zip containing the wsdl and the two xsds to illustrate the situation.
> Thanks!

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org