Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-6392

Schema imports are not handled correctly in generated WSDL and XSD files

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.1, 2.7.16
    • 3.1.1, 3.0.6, 2.7.17
    • JAX-WS Runtime
    • None

    Description

      1) XSD files cannot be accessed by URLs that should be enabled by XML catalog rules.
      2) Under some circumstances, schema location attributes in <include> elements are not rewritten to "?xsd=location" form

      Situation:

      • We have following rule in jax-ws-catalog.xml:
           <rewriteSystem systemIdStartString="http://apache.org/hello_world/types2/" rewritePrefix="/wsdl/schemata/"/>
        
      • We have WSDL file importing an XSD file, which in turn is including another XSD file, all located in /wsdl/ directory on classpath:
        /wsdl/service.wsdl
        /wsdl/schemata/schema.xsd
        /wsdl/schemata/included_schema.xsd
        
      • WSDL file contains import like this, with relative path:
        <import namespace="http://apache.org/hello_world/types2" 
                schemaLocation="schemata/schema.xsd"/>
        
      • schema.xsd file contains following include, again with relative path:
        <xsd:include schemaLocation="included_schema.xsd"/>
        

      Problem 1:

      XSD file cannot be accessed by URL http://localhost:PORT/SoapContext/SoapPort?xsd=http://apache.org/hello_world/types2/schema.xsd, which is supposed to be working due to rewriteSystem rule.

      It can only be accessed with relative path URL: "?xsd=schemata/schema.xsd".

      This (meaning the first URL http://localhost:PORT/SoapContext/SoapPort?xsd=http://apache.org/hello_world/types2/schema.xsd) starts working when import in WSDL file is modified to use full URL instead of relative path:

      <import namespace="http://apache.org/hello_world/types2" 
              schemaLocation="http://apache.org/hello_world/types2/schema.xsd"/>
      

      Problem 2:

      When schema.xsd is accessed by request using full url like "?xsd=http://apache.org/hello_world/types2/schema.xsd", instead of relative url, schemaLocation attribute in <import> and <include> elements in that file are not rewritten into "?xsd=..." form, so those schemaLocations cannot be followed by client.

      I'm attaching also a PR with a test case demonstrating described behaviour, and proposed fix.

      Attachments

        Issue Links

          Activity

            People

              dkulp Daniel Kulp
              thofman Tomas Hofman
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: