Uploaded image for project: 'Spring Web Services'
  1. Spring Web Services
  2. SWS-861

wsdl generation issue with CommonsXsdSchemaCollection

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Cannot Reproduce
    • Affects Version/s: 2.1.3
    • Fix Version/s: 2.2.RC1
    • Component/s: XML
    • Labels:
      None

      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

        Activity

        Hide
        arjen.poutsma Arjen Poutsma added a comment -

        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.

        Show
        arjen.poutsma Arjen Poutsma added a comment - 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.
        Hide
        stasilla Stanislaw Hein added a comment -

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

        Show
        stasilla Stanislaw Hein added a comment - Sorry for bad example. I tried with nillable="true" and it didn't work too. Also minOccurs and maxOccurs didn't work.
        Hide
        arjen.poutsma Arjen Poutsma added a comment -

        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.

        Show
        arjen.poutsma Arjen Poutsma added a comment - 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.

          People

          • Assignee:
            arjen.poutsma Arjen Poutsma
            Reporter:
            stasilla Stanislaw Hein
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: