You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Joshua Shannon (JIRA)" <ji...@apache.org> on 2013/06/06 15:26:20 UTC

[jira] [Updated] (CXF-5061) Invalid WSDL generated created for List of Complex Type

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

Joshua Shannon updated CXF-5061:
--------------------------------

    Description: 
We are using CXF to do Code First development of both SOAP and REST web services. Here is our interface for the web service:

{noformat}
@Path("/test")
@Produces(BaseMediaType.APPLICATION_JSON)
@Consumes(BaseMediaType.APPLICATION_JSON)
@WebService(name = "TestService",
		portName = "TestServicePort",
		serviceName = "TestService",
		targetNamespace = "http://enterprise.ltcourttech.com/services/test")
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
public interface TestService
{
	@Path("/list")
	@GET
	@Produces(BaseMediaType.MULTIPART_RELATED)
	@WebMethod(operationName = "getList")
	public List<WrapperString> getList();
}
{noformat}

Whenever CXF creates the WSDL for the implementing class, the WSDL is invalid. Here is the WSDL that is created:

{noformat}
<?xml version='1.0' encoding='UTF-8'?><wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://enterprise.ltcourttech.com/services/test" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" name="TestService" targetNamespace="http://enterprise.ltcourttech.com/services/test">
  <wsdl:types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns0="http://enterprise.ltcourttech.com/services/base" elementFormDefault="qualified" targetNamespace="http://enterprise.ltcourttech.com/services/base">
  <xsd:complexType name="wrapperStringArray">
    <xsd:sequence>
      <xsd:element maxOccurs="unbounded" minOccurs="0" name="item" nillable="true" type="ns0:WrapperString"/>
    </xsd:sequence>
  </xsd:complexType>
  <xsd:complexType name="WrapperString">
    <xsd:sequence>
      <xsd:element minOccurs="0" name="value" type="xsd:string"/>
    </xsd:sequence>
  </xsd:complexType>
  <xsd:element name="wrapperString" type="ns0:WrapperString"/>
</xsd:schema>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://enterprise.ltcourttech.com/services/test" xmlns:ns0="http://enterprise.ltcourttech.com/services/base" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://enterprise.ltcourttech.com/services/test">
  <xsd:import namespace="http://enterprise.ltcourttech.com/services/base"/>
  <xsd:element name="getListResponse" nillable="true" type="ns0:WrapperStringArray"/>
</xsd:schema>
  </wsdl:types>
  <wsdl:message name="getListResponse">
    <wsdl:part element="tns:getListResponse" name="getListResponse">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="getList">
  </wsdl:message>
  <wsdl:portType name="TestService">
    <wsdl:operation name="getList">
      <wsdl:input message="tns:getList" name="getList">
    </wsdl:input>
      <wsdl:output message="tns:getListResponse" name="getListResponse">
    </wsdl:output>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="TestServiceSoapBinding" type="tns:TestService">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="getList">
      <soap:operation soapAction="" style="document"/>
      <wsdl:input name="getList">
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output name="getListResponse">
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="TestService">
    <wsdl:port binding="tns:TestServiceSoapBinding" name="TestServicePort">
      <soap:address location="http://mtefile/services/soap/test"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>
{noformat}

Notice that the complexType is named "wrapperStringArray" yet the getListResponse is trying to use the type of "ns0:WrapperStringArray". The bug is that the case of the types does not match. I think the getListResponse type should be a lowercase "w". I ran another test with a List<String> and the types were correctly generated to "stringArray". It seems like CXF is messing the capitalization of the type when using complex objects. This is quite a high priority issue so we can get SOAP services to work correctly with a valid WSDL.

  was:
We are using CXF to do Code First development of both SOAP and REST web services. Here is our interface for the web service:

@Path("/test")
@Produces(BaseMediaType.APPLICATION_JSON)
@Consumes(BaseMediaType.APPLICATION_JSON)
@WebService(name = "TestService",
		portName = "TestServicePort",
		serviceName = "TestService",
		targetNamespace = "http://enterprise.ltcourttech.com/services/test")
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
public interface TestService
{
	@Path("/list")
	@GET
	@Produces(BaseMediaType.MULTIPART_RELATED)
	@WebMethod(operationName = "getList")
	public List<WrapperString> getList();
}

Whenever CXF creates the WSDL for the implementing class, the WSDL is invalid. Here is the WSDL that is created:

<?xml version='1.0' encoding='UTF-8'?><wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://enterprise.ltcourttech.com/services/test" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" name="TestService" targetNamespace="http://enterprise.ltcourttech.com/services/test">
  <wsdl:types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns0="http://enterprise.ltcourttech.com/services/base" elementFormDefault="qualified" targetNamespace="http://enterprise.ltcourttech.com/services/base">
  <xsd:complexType name="wrapperStringArray">
    <xsd:sequence>
      <xsd:element maxOccurs="unbounded" minOccurs="0" name="item" nillable="true" type="ns0:WrapperString"/>
    </xsd:sequence>
  </xsd:complexType>
  <xsd:complexType name="WrapperString">
    <xsd:sequence>
      <xsd:element minOccurs="0" name="value" type="xsd:string"/>
    </xsd:sequence>
  </xsd:complexType>
  <xsd:element name="wrapperString" type="ns0:WrapperString"/>
</xsd:schema>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://enterprise.ltcourttech.com/services/test" xmlns:ns0="http://enterprise.ltcourttech.com/services/base" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://enterprise.ltcourttech.com/services/test">
  <xsd:import namespace="http://enterprise.ltcourttech.com/services/base"/>
  <xsd:element name="getListResponse" nillable="true" type="ns0:WrapperStringArray"/>
</xsd:schema>
  </wsdl:types>
  <wsdl:message name="getListResponse">
    <wsdl:part element="tns:getListResponse" name="getListResponse">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="getList">
  </wsdl:message>
  <wsdl:portType name="TestService">
    <wsdl:operation name="getList">
      <wsdl:input message="tns:getList" name="getList">
    </wsdl:input>
      <wsdl:output message="tns:getListResponse" name="getListResponse">
    </wsdl:output>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="TestServiceSoapBinding" type="tns:TestService">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="getList">
      <soap:operation soapAction="" style="document"/>
      <wsdl:input name="getList">
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output name="getListResponse">
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="TestService">
    <wsdl:port binding="tns:TestServiceSoapBinding" name="TestServicePort">
      <soap:address location="http://mtefile/services/soap/test"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>


Notice that the complexType is named "wrapperStringArray" yet the getListResponse is trying to use the type of "ns0:WrapperStringArray". The bug is that the case of the types does not match. I think the getListResponse type should be a lowercase "w". I ran another test with a List<String> and the types were correctly generated to "stringArray". It seems like CXF is messing the capitalization of the type when using complex objects. This is quite a high priority issue so we can get SOAP services to work correctly with a valid WSDL.

    
> Invalid WSDL generated created for List of Complex Type
> -------------------------------------------------------
>
>                 Key: CXF-5061
>                 URL: https://issues.apache.org/jira/browse/CXF-5061
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-WS Runtime, JAXB Databinding
>    Affects Versions: 2.7.5
>         Environment: Windows 7, Tomcat 7.0.30, Java 1.7.0_07
>            Reporter: Joshua Shannon
>
> We are using CXF to do Code First development of both SOAP and REST web services. Here is our interface for the web service:
> {noformat}
> @Path("/test")
> @Produces(BaseMediaType.APPLICATION_JSON)
> @Consumes(BaseMediaType.APPLICATION_JSON)
> @WebService(name = "TestService",
> 		portName = "TestServicePort",
> 		serviceName = "TestService",
> 		targetNamespace = "http://enterprise.ltcourttech.com/services/test")
> @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
> public interface TestService
> {
> 	@Path("/list")
> 	@GET
> 	@Produces(BaseMediaType.MULTIPART_RELATED)
> 	@WebMethod(operationName = "getList")
> 	public List<WrapperString> getList();
> }
> {noformat}
> Whenever CXF creates the WSDL for the implementing class, the WSDL is invalid. Here is the WSDL that is created:
> {noformat}
> <?xml version='1.0' encoding='UTF-8'?><wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://enterprise.ltcourttech.com/services/test" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" name="TestService" targetNamespace="http://enterprise.ltcourttech.com/services/test">
>   <wsdl:types>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns0="http://enterprise.ltcourttech.com/services/base" elementFormDefault="qualified" targetNamespace="http://enterprise.ltcourttech.com/services/base">
>   <xsd:complexType name="wrapperStringArray">
>     <xsd:sequence>
>       <xsd:element maxOccurs="unbounded" minOccurs="0" name="item" nillable="true" type="ns0:WrapperString"/>
>     </xsd:sequence>
>   </xsd:complexType>
>   <xsd:complexType name="WrapperString">
>     <xsd:sequence>
>       <xsd:element minOccurs="0" name="value" type="xsd:string"/>
>     </xsd:sequence>
>   </xsd:complexType>
>   <xsd:element name="wrapperString" type="ns0:WrapperString"/>
> </xsd:schema>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://enterprise.ltcourttech.com/services/test" xmlns:ns0="http://enterprise.ltcourttech.com/services/base" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://enterprise.ltcourttech.com/services/test">
>   <xsd:import namespace="http://enterprise.ltcourttech.com/services/base"/>
>   <xsd:element name="getListResponse" nillable="true" type="ns0:WrapperStringArray"/>
> </xsd:schema>
>   </wsdl:types>
>   <wsdl:message name="getListResponse">
>     <wsdl:part element="tns:getListResponse" name="getListResponse">
>     </wsdl:part>
>   </wsdl:message>
>   <wsdl:message name="getList">
>   </wsdl:message>
>   <wsdl:portType name="TestService">
>     <wsdl:operation name="getList">
>       <wsdl:input message="tns:getList" name="getList">
>     </wsdl:input>
>       <wsdl:output message="tns:getListResponse" name="getListResponse">
>     </wsdl:output>
>     </wsdl:operation>
>   </wsdl:portType>
>   <wsdl:binding name="TestServiceSoapBinding" type="tns:TestService">
>     <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
>     <wsdl:operation name="getList">
>       <soap:operation soapAction="" style="document"/>
>       <wsdl:input name="getList">
>         <soap:body use="literal"/>
>       </wsdl:input>
>       <wsdl:output name="getListResponse">
>         <soap:body use="literal"/>
>       </wsdl:output>
>     </wsdl:operation>
>   </wsdl:binding>
>   <wsdl:service name="TestService">
>     <wsdl:port binding="tns:TestServiceSoapBinding" name="TestServicePort">
>       <soap:address location="http://mtefile/services/soap/test"/>
>     </wsdl:port>
>   </wsdl:service>
> </wsdl:definitions>
> {noformat}
> Notice that the complexType is named "wrapperStringArray" yet the getListResponse is trying to use the type of "ns0:WrapperStringArray". The bug is that the case of the types does not match. I think the getListResponse type should be a lowercase "w". I ran another test with a List<String> and the types were correctly generated to "stringArray". It seems like CXF is messing the capitalization of the type when using complex objects. This is quite a high priority issue so we can get SOAP services to work correctly with a valid WSDL.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira