[ 
https://issues.apache.org/jira/browse/CXF-2687?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Yogesh updated CXF-2687:
------------------------

             Description: 
Hi I have configured one webservice using following xml configuration

<jaxws:endpoint address="/PersonService" implementor="#personServiceBean" 
id="personService">
        <jaxws:schemaLocations >
                
<jaxws:schemaLocation>WEB-INF/classes/app/valueobjects/RequestResponse.xsd</jaxws:schemaLocation>
        </jaxws:schemaLocations>
        <jaxws:properties>
                <entry key="schema-validation-enabled" value="true"/>
        </jaxws:properties>
</jaxws:endpoint>

CXF generates WSDL at runtime but generateds WSDL looks like

<?xml version='1.0' encoding='UTF-8'?><wsdl:definitions name="PersonService" 
targetNamespace="http://www.webservice.com/ws"; 
xmlns:ns1="http://cxf.apache.org/bindings/xformat"; 
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"; 
xmlns:tns="http://www.webservice.com/ws"; 
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
  <wsdl:types>
<schema attributeFormDefault="unqualified" elementFormDefault="qualified" 
targetNamespace="http://www.webservice.com/ws"; 
xmlns="http://www.w3.org/2001/XMLSchema"; 
xmlns:tns="http://www.webservice.com/ws";>
<include schemaLocation="valueobjects.xsd" />
<complexType name="GetPersonDetails">
<sequence>
<element minOccurs="0" ref="tns:Person" />
</sequence>
</complexType>
<complexType name="GetPersonDetailsResponse">
<sequence>
<element minOccurs="0" ref="tns:Person" />
</sequence>
</complexType>
<element name="GetPersonDetails" nillable="true" type="tns:GetPersonDetails" />
<element name="GetPersonDetailsResponse" nillable="true" 
type="tns:GetPersonDetailsResponse" />
</schema>
  </wsdl:types>
...........


The include element in schema doesn't contain entire path and hence the clients 
are not able to retrieve related elements.

  was:
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.


       Affects Version/s:     (was: 2.1.2)
                          2.2.5
                  Labels: SchemaValidation SchemaGeneration  (was: )
    Estimated Complexity: Moderate  (was: Unknown)

> CLONE -WSDL Schema Imports - include schema location doesnt have full path
> --------------------------------------------------------------------------
>
>                 Key: CXF-2687
>                 URL: https://issues.apache.org/jira/browse/CXF-2687
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.2.5
>            Reporter: Yogesh
>            Assignee: Daniel Kulp
>            Priority: Minor
>             Fix For: 2.1.6, 2.2.3
>
>
> Hi I have configured one webservice using following xml configuration
> <jaxws:endpoint address="/PersonService" implementor="#personServiceBean" 
> id="personService">
>       <jaxws:schemaLocations >
>               
> <jaxws:schemaLocation>WEB-INF/classes/app/valueobjects/RequestResponse.xsd</jaxws:schemaLocation>
>       </jaxws:schemaLocations>
>       <jaxws:properties>
>               <entry key="schema-validation-enabled" value="true"/>
>       </jaxws:properties>
> </jaxws:endpoint>
> CXF generates WSDL at runtime but generateds WSDL looks like
> <?xml version='1.0' encoding='UTF-8'?><wsdl:definitions name="PersonService" 
> targetNamespace="http://www.webservice.com/ws"; 
> xmlns:ns1="http://cxf.apache.org/bindings/xformat"; 
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"; 
> xmlns:tns="http://www.webservice.com/ws"; 
> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; 
> xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
>   <wsdl:types>
> <schema attributeFormDefault="unqualified" elementFormDefault="qualified" 
> targetNamespace="http://www.webservice.com/ws"; 
> xmlns="http://www.w3.org/2001/XMLSchema"; 
> xmlns:tns="http://www.webservice.com/ws";>
> <include schemaLocation="valueobjects.xsd" />
> <complexType name="GetPersonDetails">
> <sequence>
> <element minOccurs="0" ref="tns:Person" />
> </sequence>
> </complexType>
> <complexType name="GetPersonDetailsResponse">
> <sequence>
> <element minOccurs="0" ref="tns:Person" />
> </sequence>
> </complexType>
> <element name="GetPersonDetails" nillable="true" type="tns:GetPersonDetails" 
> />
> <element name="GetPersonDetailsResponse" nillable="true" 
> type="tns:GetPersonDetailsResponse" />
> </schema>
>   </wsdl:types>
> ...........
> The include element in schema doesn't contain entire path and hence the 
> clients are not able to retrieve related elements.

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

Reply via email to