[SWS-861] wsdl generation issue with CommonsXsdSchemaCollection Created: 17/Jan/14  Updated: 20/Mar/14  Resolved: 10/Feb/14

Status: Resolved
Project: Spring Web Services
Component/s: XML
Affects Version/s: 2.1.3
Fix Version/s: 2.2.RC1

Type: Bug Priority: Minor
Reporter: Stanislaw Hein Assignee: Arjen Poutsma
Resolution: Cannot Reproduce Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

while trying to generate wsdl from xsd the attributes minOccurs, maxOccurs, nillable and etc. are getting lost:
xsd:

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://services.webservices.customerapi.de" xmlns:objects="http://objects.webservices.customerapi.de"
  targetNamespace="http://services.webservices.customerapi.de" elementFormDefault="qualified" attributeFormDefault="qualified">
  <xsd:import namespace="http://objects.webservices.customerapi.de" schemaLocation="Hello.xsd" />
  <xsd:element name="HelloRequest">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element nillable="false" name="name" type="xsd:string"  />
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="HelloResponse">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="Hello" type="objects:Hello" />
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>

with such defined DefaultWsdl11Definition bean:

  <bean id="HelloService" class="org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition" lazy-init="true">
    <property name="schemaCollection">
      <bean class="org.springframework.xml.xsd.commons.CommonsXsdSchemaCollection">
        <property name="inline" value="true" />
        <property name="xsds">
          <list>
            <value>schemas/HelloService.xsd</value>
          </list>
        </property>
      </bean>
    </property>
    <property name="portTypeName" value="HelloService" />
    <property name="serviceName" value="HelloService" />
    <property name="locationUri" value="/endpoints" />
  </bean>

as a result am receiving wsdl (here only part of it):

  <xsd:element name="HelloRequest">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="name" type="xsd:string" /> <!-- here was "nillable" attr lost-->
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="HelloResponse">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="Hello" type="objects:Hello" />
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>

could you please check this issue, because it is very important for contract-data-first approach.

regards



 Comments   
Comment by Arjen Poutsma [ 03/Feb/14 ]

Can you elaborate on which specific attributes were lost? You mention that nillable="false" was lost, but that is not a problem, because nillable is false by default (see http://www.w3schools.com/schema/el_element.asp) and does not need to be specified.

Comment by Stanislaw Hein [ 03/Feb/14 ]

Sorry for bad example. I tried with nillable="true" and it didn't work too. Also minOccurs and maxOccurs didn't work.

Comment by Arjen Poutsma [ 10/Feb/14 ]

I'm afraid I can't reproduce this. I've added additional tests for this purpose (see https://github.com/spring-projects/spring-ws/commit/ea9e2d1d2d35e8f588bd09bd9571ad86894953b3) but it works fine for me.

Generated at Thu Dec 14 04:25:31 UTC 2017 using JIRA 6.4.14#64029-sha1:ae256fe0fbb912241490ff1cecfb323ea0905ca5.