XMLBeans
  1. XMLBeans
  2. XMLBEANS-479

XmlException occurs when call XmlBeans.compileXsd method on List of XmlObject of WSDL file where some XmlObject contains XS:INCLUDE

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: Version 2.5
    • Fix Version/s: None
    • Component/s: Compiler
    • Labels:
      None
    • Environment:
      Windows 7, Java 7

      Description

      I have WSDL file which imports XSD files and these XSD files import or include another XSD files etc.
      I call XmlBeans.compileXsd method on List of XmlObject of this WSDL file.
      If some XmlObject contains XS:INCLUDE then XmlException occurs.

      I think that in StscImporter.DownloadTable.resolveImportsAndIncludes(boolean) method should be
      Schema included = downloadSchema(includes[i], sourceNamespace, includes[i].getSchemaLocation());
      instead of
      Schema included = downloadSchema(includes[i], null, includes[i].getSchemaLocation());
      because if I make this change then it works ok.

      See attached IncludeBug.zip file - it's an Eclipse Java Project

      1. IncludeBug.zip
        2.49 MB
        Michal Láska

        Activity

        Hide
        Jacob Danner added a comment -

        When using this API, I believe you are simply missing an additional flag on the XmlOptions object
        http://xmlbeans.apache.org/docs/2.4.0/reference/org/apache/xmlbeans/XmlOptions.html#setCompileDownloadUrls()

        When I ran your code with the following:

        XmlBeans.compileXsd(schemas.toArray(new XmlObject[schemas.size()]), XmlBeans.getBuiltinTypeSystem(), new XmlOptions().setCompileNoUpaRule().setCompileDownloadUrls() );

        I got past the error noted. Instead I got the following output.

        Retrieving document at './data-in/egon/wsdl/IszrRobCtiAifo.wsdl'.
        Retrieving schema at '../xsd/IszrRobCtiAifo.xsd', relative to 'file:/D:/ide/eclipse/IncludeBug/foo/IncludeBug/./data-in/egon/wsdl/IszrRobCtiAifo.wsdl'.
        Retrieving schema at 'ref/RuianCtiProRob.xsd', relative to 'file:/D:/ide/eclipse/IncludeBug/foo/IncludeBug/data-in/egon/xsd/IszrRobCtiAifo.xsd'.
        Retrieving schema at '../../../ruian/xsd/cti_pro_rob/CtiProRob.xsd', relative to 'file:/D:/ide/eclipse/IncludeBug/foo/IncludeBug/data-in/egon/xsd/ref/RuianCtiProRob.xsd'.
        Retrieving schema at '../../../RegTypy.xsd', relative to 'file:/D:/ide/eclipse/IncludeBug/foo/IncludeBug/data-in/ruian/xsd/cti_pro_rob/CtiProRob.xsd'.
        Retrieving schema at 'XopInclude.xsd', relative to 'file:/D:/ide/eclipse/IncludeBug/foo/IncludeBug/data-in/RegTypy.xsd'.
        Retrieving schema at '../../../ruian/xsd/typy/BaseTypy.xsd', relative to 'file:/D:/ide/eclipse/IncludeBug/foo/IncludeBug/data-in/ruian/xsd/cti_pro_rob/CtiProRob.xsd'.
        Retrieving schema at '../../../ruian/xsd/cti/CtiAdresa.xsd', relative to 'file:/D:/ide/eclipse/IncludeBug/foo/IncludeBug/data-in/ruian/xsd/cti_pro_rob/CtiProRob.xsd'.
        Retrieving schema at '../../../RegTypy.xsd', relative to 'file:/D:/ide/eclipse/IncludeBug/foo/IncludeBug/data-in/ruian/xsd/cti/CtiAdresa.xsd'.
        Retrieving schema at '../../../ruian/xsd/typy/CommonTypy.xsd', relative to 'file:/D:/ide/eclipse/IncludeBug/foo/IncludeBug/data-in/ruian/xsd/cti/CtiAdresa.xsd'.
        Retrieving schema at '../../../ruian/xsd/typy/BaseTypy.xsd', relative to 'file:/D:/ide/eclipse/IncludeBug/foo/IncludeBug/data-in/ruian/xsd/typy/CommonTypy.xsd'.
        Retrieving schema at '../../../ruian/xsd/typy/BaseTypy.xsd', relative to 'file:/D:/ide/eclipse/IncludeBug/foo/IncludeBug/data-in/ruian/xsd/cti/CtiAdresa.xsd'.
        Retrieving schema at 'IszrAbstract.xsd', relative to 'file:/D:/ide/eclipse/IncludeBug/foo/IncludeBug/data-in/egon/xsd/IszrRobCtiAifo.xsd'.
        Retrieving schema at '../../RegTypy.xsd', relative to 'file:/D:/ide/eclipse/IncludeBug/foo/IncludeBug/data-in/egon/xsd/IszrAbstract.xsd'.
        Retrieving schema at '../../rob/xsd/RobDotazyData.xsd', relative to 'file:/D:/ide/eclipse/IncludeBug/foo/IncludeBug/data-in/egon/xsd/IszrRobCtiAifo.xsd'.
        Retrieving schema at '../../RegTypy.xsd', relative to 'file:/D:/ide/eclipse/IncludeBug/foo/IncludeBug/data-in/rob/xsd/RobDotazyData.xsd'.
        Retrieving schema at 'RobTypy.xsd', relative to 'file:/D:/ide/eclipse/IncludeBug/foo/IncludeBug/data-in/rob/xsd/RobDotazyData.xsd'.
        Retrieving schema at '../../RegTypy.xsd', relative to 'file:/D:/ide/eclipse/IncludeBug/foo/IncludeBug/data-in/rob/xsd/RobTypy.xsd'.
        org.apache.xmlbeans.XmlException: error: URL "XopInclude.xsd" is not well-formed
        at org.apache.xmlbeans.impl.schema.SchemaTypeSystemCompiler.compile(SchemaTypeSystemCompiler.java:226)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at org.apache.xmlbeans.XmlBeans.compileXmlBeans(XmlBeans.java:667)
        at org.apache.xmlbeans.XmlBeans.compileXsd(XmlBeans.java:553)
        at bug.Main.main(Main.java:50)

        Show
        Jacob Danner added a comment - When using this API, I believe you are simply missing an additional flag on the XmlOptions object http://xmlbeans.apache.org/docs/2.4.0/reference/org/apache/xmlbeans/XmlOptions.html#setCompileDownloadUrls( ) When I ran your code with the following: XmlBeans.compileXsd(schemas.toArray(new XmlObject [schemas.size()] ), XmlBeans.getBuiltinTypeSystem(), new XmlOptions().setCompileNoUpaRule().setCompileDownloadUrls() ); I got past the error noted. Instead I got the following output. Retrieving document at './data-in/egon/wsdl/IszrRobCtiAifo.wsdl'. Retrieving schema at '../xsd/IszrRobCtiAifo.xsd', relative to 'file:/D:/ide/eclipse/IncludeBug/foo/IncludeBug/./data-in/egon/wsdl/IszrRobCtiAifo.wsdl'. Retrieving schema at 'ref/RuianCtiProRob.xsd', relative to 'file:/D:/ide/eclipse/IncludeBug/foo/IncludeBug/data-in/egon/xsd/IszrRobCtiAifo.xsd'. Retrieving schema at '../../../ruian/xsd/cti_pro_rob/CtiProRob.xsd', relative to 'file:/D:/ide/eclipse/IncludeBug/foo/IncludeBug/data-in/egon/xsd/ref/RuianCtiProRob.xsd'. Retrieving schema at '../../../RegTypy.xsd', relative to 'file:/D:/ide/eclipse/IncludeBug/foo/IncludeBug/data-in/ruian/xsd/cti_pro_rob/CtiProRob.xsd'. Retrieving schema at 'XopInclude.xsd', relative to 'file:/D:/ide/eclipse/IncludeBug/foo/IncludeBug/data-in/RegTypy.xsd'. Retrieving schema at '../../../ruian/xsd/typy/BaseTypy.xsd', relative to 'file:/D:/ide/eclipse/IncludeBug/foo/IncludeBug/data-in/ruian/xsd/cti_pro_rob/CtiProRob.xsd'. Retrieving schema at '../../../ruian/xsd/cti/CtiAdresa.xsd', relative to 'file:/D:/ide/eclipse/IncludeBug/foo/IncludeBug/data-in/ruian/xsd/cti_pro_rob/CtiProRob.xsd'. Retrieving schema at '../../../RegTypy.xsd', relative to 'file:/D:/ide/eclipse/IncludeBug/foo/IncludeBug/data-in/ruian/xsd/cti/CtiAdresa.xsd'. Retrieving schema at '../../../ruian/xsd/typy/CommonTypy.xsd', relative to 'file:/D:/ide/eclipse/IncludeBug/foo/IncludeBug/data-in/ruian/xsd/cti/CtiAdresa.xsd'. Retrieving schema at '../../../ruian/xsd/typy/BaseTypy.xsd', relative to 'file:/D:/ide/eclipse/IncludeBug/foo/IncludeBug/data-in/ruian/xsd/typy/CommonTypy.xsd'. Retrieving schema at '../../../ruian/xsd/typy/BaseTypy.xsd', relative to 'file:/D:/ide/eclipse/IncludeBug/foo/IncludeBug/data-in/ruian/xsd/cti/CtiAdresa.xsd'. Retrieving schema at 'IszrAbstract.xsd', relative to 'file:/D:/ide/eclipse/IncludeBug/foo/IncludeBug/data-in/egon/xsd/IszrRobCtiAifo.xsd'. Retrieving schema at '../../RegTypy.xsd', relative to 'file:/D:/ide/eclipse/IncludeBug/foo/IncludeBug/data-in/egon/xsd/IszrAbstract.xsd'. Retrieving schema at '../../rob/xsd/RobDotazyData.xsd', relative to 'file:/D:/ide/eclipse/IncludeBug/foo/IncludeBug/data-in/egon/xsd/IszrRobCtiAifo.xsd'. Retrieving schema at '../../RegTypy.xsd', relative to 'file:/D:/ide/eclipse/IncludeBug/foo/IncludeBug/data-in/rob/xsd/RobDotazyData.xsd'. Retrieving schema at 'RobTypy.xsd', relative to 'file:/D:/ide/eclipse/IncludeBug/foo/IncludeBug/data-in/rob/xsd/RobDotazyData.xsd'. Retrieving schema at '../../RegTypy.xsd', relative to 'file:/D:/ide/eclipse/IncludeBug/foo/IncludeBug/data-in/rob/xsd/RobTypy.xsd'. org.apache.xmlbeans.XmlException: error: URL "XopInclude.xsd" is not well-formed at org.apache.xmlbeans.impl.schema.SchemaTypeSystemCompiler.compile(SchemaTypeSystemCompiler.java:226) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.apache.xmlbeans.XmlBeans.compileXmlBeans(XmlBeans.java:667) at org.apache.xmlbeans.XmlBeans.compileXsd(XmlBeans.java:553) at bug.Main.main(Main.java:50)
        Hide
        Michal Láska added a comment -

        to Chris White: The exception was same as yours - 'org.apache.xmlbeans.XmlException: error: Could not load resource "included.xsd" (network downloads disabled).'

        Show
        Michal Láska added a comment - to Chris White: The exception was same as yours - 'org.apache.xmlbeans.XmlException: error: Could not load resource "included.xsd" (network downloads disabled).'
        Hide
        Chris White added a comment - - edited

        I have a similar problem. It looks like the include doesn't work with local file paths. I get the an org.apache.xmlbeans.XmlException with the text: error: Could not load resource "./included.xsd" (network downloads disabled). If I enabled the XmlOption.setCompileDownloadUrls() then the code complains the I have a badly formed URI.

        xsd:import works fine with a local path; it's just xsd:include that is broken.

        What was the exception you were getting?

        Show
        Chris White added a comment - - edited I have a similar problem. It looks like the include doesn't work with local file paths. I get the an org.apache.xmlbeans.XmlException with the text: error: Could not load resource "./included.xsd" (network downloads disabled). If I enabled the XmlOption.setCompileDownloadUrls() then the code complains the I have a badly formed URI. xsd:import works fine with a local path; it's just xsd:include that is broken. What was the exception you were getting?

          People

          • Assignee:
            Unassigned
            Reporter:
            Michal Láska
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development