You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Rajesh <gh...@gmail.com> on 2016/03/02 08:39:26 UTC

Issue with generated schemas in SEI-first approach

I have 2 services in a package and they are quite disjoint i.e. they do not
share common parameter / return type objects.

1. When I try to generate the wsdl with Java2ws in maven, the unrelated
schemas are imported into each other. Thereby the wsdl cannot be parsed by
tools like SOAP UI

2. By default the schema element corresponding to a List return type
contains maxOccurs="unbounded" . And the container type is a collection with
xs:all . This is causing clients with older xsd processor to fail, as they
cannot parse the WSDL. SOAP UI also fails to parse.

Any help would be highly appreciated.



--
View this message in context: http://cxf.547215.n5.nabble.com/Issue-with-generated-schemas-in-SEI-first-approach-tp5766499.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Issue with generated schemas in SEI-first approach

Posted by Rajesh <gh...@gmail.com>.
The SEIs -- 

@NoRepositoryBean
@WebService(targetNamespace="http://mycompany.com/webservices/entity/ut/ut-dept-service/")
public interface DeptWebService {
    
    @WebMethod(operationName="listAllDepts")
    public @WebResult(name="deptsResponse") List<DeptBeanPub> findAll();
    
    @WebMethod(operationName="findDeptById")
    public @WebResult(name="deptResponse") DeptBeanPub
findOne(@WebParam(name="deptIdReq") Long id);
    
    @WebMethod(operationName="findByDeptCode")
    public @WebResult(name="deptResponse") DeptBeanPub
findByDeptCode(@WebParam(name="deptCodeReq") String deptCode);
    
    @WebMethod(operationName="addDept")
    public @WebResult(name="deptResponse") DeptBeanPub
add(@WebParam(name="deptReq") DeptBeanPub dept);
    
}

------------

@NoRepositoryBean
@WebService(targetNamespace="http://mycompany.com/webservices/entity/ut/ut-person-service/")
public interface PersonWebService {
    
    @WebMethod(operationName="listAllPersons")
    public @WebResult(name="personsResponse") List<PersonEntityPub>
findAll();
    
    @WebMethod(operationName="findPerson")
    public @WebResult(name="personResponse") PersonEntityPub
findOne(@WebParam(name="personId") Long id);
    
    @WebMethod(operationName="addPerson")
    public @WebResult(name="personResponse") PersonEntityPub
add(@WebParam(name="person") PersonEntityPub person);
    
}

------------------------

Snippet from the WSDL file for PersonService 

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="PersonService"
targetNamespace="http://mycompany.com/webservices/entity/ut/ut-person-service/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://mycompany.com/webservices/entity/ut/ut-person-service/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
  <wsdl:types>
<xs:schema xmlns:ns1="http://mycompany.com/schema/entity/ut/ut-person/"
xmlns:tns="http://mycompany.com/webservices/entity/ut/ut-person-service/"
xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified"
targetNamespace="http://mycompany.com/webservices/entity/ut/ut-person-service/"
version="1.0">

  <xs:import namespace="http://mycompany.com/schema/entity/ut/ut-person/"/>

  <xs:element name="addPerson" type="tns:addPerson"/>

  <xs:element name="addPersonResponse" type="tns:addPersonResponse"/>

  <xs:element name="findPerson" type="tns:findPerson"/>

  <xs:element name="findPersonResponse" type="tns:findPersonResponse"/>

  <xs:element name="listAllPersons" type="tns:listAllPersons"/>

  <xs:element name="listAllPersonsResponse"
type="tns:listAllPersonsResponse"/>

  <xs:element name="revision-control" type="tns:revisionControlBean"/>

  <xs:complexType name="addPerson">
    <xs:sequence>
      <xs:element minOccurs="0" name="person" type="tns:personEntityPub"/>
    </xs:sequence>
  </xs:complexType>



  <xs:complexType name="deptBeanPub">
    <xs:all>
      <xs:element minOccurs="0" name="deptId" type="xs:long"/>
      <xs:element minOccurs="0" name="deptCode" type="xs:string"/>
      <xs:element minOccurs="0" name="deptName" type="xs:string"/>
      <xs:element minOccurs="0" name="description" type="xs:string"/>
      <xs:element maxOccurs="unbounded" minOccurs="0" name="employee"
type="xs:string"/>
      <xs:element minOccurs="0" name="revisionControl"
type="tns:revisionControlBean"/>
    </xs:all>
  </xs:complexType>

  <xs:complexType name="revisionControlBean">
    <xs:all>
      <xs:element minOccurs="0" name="createdBy" type="xs:string"/>
      <xs:element name="createdById" type="xs:int"/>
      <xs:element minOccurs="0" name="creationDate" type="xs:dateTime"/>
      <xs:element minOccurs="0" name="objectVersionNumber"
type="xs:string"/>
      <xs:element minOccurs="0" name="revisedBy" type="xs:string"/>
      <xs:element name="revisedById" type="xs:int"/>
      <xs:element minOccurs="0" name="revisionDate" type="xs:dateTime"/>
    </xs:all>
  </xs:complexType>

</xs:schema>

<xs:schema
xmlns:ns1="http://mycompany.com/webservices/entity/ut/ut-person-service/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://mycompany.com/schema/entity/ut/ut-dept/"
version="1.0">

  <xs:import
namespace="http://mycompany.com/webservices/entity/ut/ut-person-service/"/>

  <xs:element name="department" type="ns1:deptBeanPub"/>


</xs:schema>

....

As you can see that the PersonService wsdl is containing the unrelated type
& schema definitions e.g. "revision-control"  , "deptBeanPub" ,  although it
doesn't reference them directly.





--
View this message in context: http://cxf.547215.n5.nabble.com/Issue-with-generated-schemas-in-SEI-first-approach-tp5766499p5766522.html
Sent from the cxf-user mailing list archive at Nabble.com.