Hello,

recently I've come across this problem:

We use a WSDL-first approach with endpoints defined so that our hand-written WSDL is served to the clients when asking via "?wsdl" URL (not the generated one). Moreover, we use jax-ws-catalog to map "logical" URLs like "http://midpoint.evolveum.com/xml/ns/public/common/common-3"; to concrete ones, pointing to appropriate WSDL/XSD files in our directory structure.

However, sometimes the WSDL given out to clients via "?wsdl" URL is incorrect.

Specifically, having entries in jax-ws-catalog like these

<public  publicId="http://test.com/main/schema";  uri="../main/schema.xsd"  />
<system systemId="http://test.com/main/schema";  uri="../main/schema.xsd"  />

<public  publicId="http://test.com/auxiliary/schema";  
uri="../auxiliary/auxiliary.xsd"  />
<system systemId="http://test.com/auxiliary/schema";  
uri="../auxiliary/auxiliary.xsd"  />

And having XSD imports in your types section of WSDL like these:

<xs:schema targetNamespace="http://test.com/main/customer-service";  ...>
    <!--this  fails -->
    <xsd:import  namespace="http://test.com/main/schema";  
schemaLocation="http://test.com/main/schema"/>
    <!--this  works -->
    <xsd:import  namespace="http://test.com/auxiliary/schema";  
schemaLocation="http://test.com/auxiliary/schema"/>
</xs:schema>

The resulting WSDL is like this (showing only the relevant part):

<xs:schema targetNamespace="http://test.com/main/customer-service";  ...>
    <!--this  fails -->
    <xsd:import  namespace="http://test.com/main/schema";  
schemaLocation="*http://test.com/main/schema*"/>
    <!--this  works -->
    <xsd:import  namespace="http://test.com/auxiliary/schema";  
schemaLocation="*http://localhost:9090/CustomerServicePort?xsd=http://test.com/auxiliary/schema*"/
</xs:schema>

(note the wrong schemaLocation attribute in the first import; the second one is correct)

The problem occurs when the URI of the resource being imported is the same as (except for its last segment) the URI of the WSDL itself.

Is there any fix or workaround known? I've been able to cope with that only by disabling "URL optimization" code in WSDLGetUtils.findSchemaLocation (see here <https://github.com/Evolveum/cxf/commit/db271307765939ee40b7f7f0b25ec6d7ae02052a#diff-91>) but I'm unsure of possible side effects of this change.

I've opened CXF-6034 <https://issues.apache.org/jira/browse/CXF-6034>, there is also a demonstration code attached.

Thank you in advance.
Pavol


Reply via email to