Nullable property of structured type in RODLToWSDL

Hello

I have such a fragment in my RODL:

<Struct name="MySubStruct">
  <Elements>
    <Element Name="X" DataType="Double" />
    <Element Name="Y" DataType="Double" />
  </Elements>
</Struct>
<Struct name="MyStruct">
  <Elements>
    <Element name="OptionalField" DataType="MySubStruct">
      <CustomAttributes>
        <minoccurs Value="0" />
      </CustomAttributes>
  </Elements>
</Struct>

I would expect that minOccurs attribute should be present in the resulting WSDL but TRODLToWSDL.WriteStruct doesn’t check the structure’s attributes minOccurs and maxOccurs at all

if not lIsSimpleTypeExtension then begin
  lRet := aLibrary.FindStruct(li.DataType);
  if (lRet <> nil) and
     (lRet.Count = 1) and (
      (lRet.Attributes.Values['Anonymous'] = '1') or
      (lRet.Attributes.Values['IsSimpleTypeExtension'] = '1')) then begin
    if lRet.Attributes.Values['Nillable'] = '1' then
      Write(Format('<xs:element name="%s" type="%s" nillable="1">', [Unprefix(li.Name), ExtSOAPDataType(aLibrary, lRet.Items[0].DataType)]), 15)
    else
      Write(Format('<xs:element name="%s" type="%s" minOccurs="0" maxOccurs="1">', [Unprefix(lName), ExtSOAPDataType(aLibrary, lRet.Items[0].DataType)]), 15);
  end
  else begin
    Write(Format('<xs:element name="%s" type="%s">', [Unprefix(lName), ExtSOAPDataType(aLibrary, li.DataType)]), 15);
  end;

Q: Is this correct and by design?

If not then maybe the following improvement can be used?

    sMinOccurs := li.Attributes.Values['minOccurs'];
    sMaxOccurs := li.Attributes.Values['maxOccurs'];
    if sMinOccurs <> '' then
      sMinOccurs := Format(' minOccurs="%s"', [sMinOccurs]);
    if sMaxOccurs <> '' then
      sMaxOccurs := Format(' maxOccurs="%s"', [sMaxOccurs]);
    Write(Format('<xs:element name="%s" type="%s"%s%s>', [Unprefix(lName), ExtSOAPDataType(aLibrary, li.DataType), sMinOccurs, sMaxOccurs]), 15);

regards

I think, we can add minOccurs="0" for all binary, arrays & structs properties inside struct if it isn’t set by default. Will log for Delphi and .NET

Thanks, logged as bugs://81324

Thanks, logged as bugs://81325