Description
The endpoint and the CXFServlet cannot be configured in such a way that a client consuming a dynamically generated WSDL receives all the imported
and included schemas.
The generated WSDL only generates the schema import with the namespace without the schemaLocation. The WSDL writer and WSDL query handler do not render the schemaLocation value relatvie to the Servlet so that the client consuming the WSDL can look it up.
Example configruation below:
End Configuration:
<jaxws:endpoint
id="helloWorld"
implementor="com.sandbox.service.HelloWorldImpl"
address="/HelloWorld">
<jaxws:schemaLocations>
<jaxws:schemaLocation>file:///D:/apps/CXFProto/schemas/domain.xsd</jaxws:schemaLocation>
</jaxws:schemaLocations>
</jaxws:endpoint>
WSDL Generated:
<wsdl:definitions name="HelloWorldImplService"
targetNamespace="http://service.sandbox.com/"
xmlns:ns1="http://cxf.apache.org/bindings/xformat"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://service.sandbox.com/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:types>
<xsd:schema
attributeFormDefault="unqualified"
elementFormDefault="qualified"
targetNamespace="http://service.sandbox.com/"
xmlns:cs="http://www.sandbox.com/components"
xmlns:sb="http://service.sandbox.com/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import namespace="http://www.sandbox.com/components"/>
<xsd:include schemaLocation="fields.xsd"/>
<xsd:complexType name="domainType">
<xsd:complexContent>
<xsd:extension base="cs:componentType">
<xsd:sequence>
<xsd:element minOccurs="0" name="foo" type="xsd:string"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="sayHi" type="sb:sayHi"/>
<xsd:complexType name="sayHi">
<xsd:sequence>
<xsd:element minOccurs="0" name="arg0" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="sayHiResponse" type="sb:sayHiResponse"/>
<xsd:complexType name="sayHiResponse">
<xsd:sequence>
<xsd:element minOccurs="0" name="return" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</wsdl:types>
...
</wsdl:definitions>
The WSDL generator consumes the domain.xsd specified at the endpoint configuration in Spring and renders it in the WSDL. However the schemaLocation attribute does not contain the path to the components.xsd imported.
The import should look something like this:
<xsd:import namespace="http://www.sandbox.com/components" schemaLocation="http://localhost:8080/CXFProto/services/HelloWorldServicexsd='components.xsd' " />
Thus a client consuming the WSDL can lookup components.xsd. Same issue with the xsd:include element. A configuration option to get this behavior would be appropriate or the default behavior changed.