Hi All

Okay, not new to 20.1, but a great opportunity to fix this, so the generated code from a wsdl actually works unaltered in cClientWebService.

When the wsdl contains:
Code:
<complexType name="CompanySearchResponse">    <sequence>
        <element name="companyCount" type="xsd:int"></element>
        <element maxOccurs="unbounded" name="companyList" nillable="true" type="type:Company"></element>
        <element name="requestId" nillable="true" type="xsd:string"></element>
        <element name="transactionIdentifier" nillable="true" type="xsd:string"></element>
    </sequence>
</complexType>
It generates the code ("Better Nillable support (uncheck for legacy behavior)" is selected):
Code:
Struct tWSCompanySearchResponse    Integer         companyCount
    tWSCompany[]    companyList
    String          requestId
    String          transactionIdentifier
End_Struct


Object oWSCompanySearchResponse is a cSoapMetaStruct
    Set psNameSpace to ""
    Send DefineParameter xsInteger 1 1 "companyCount"
    Send DefineStructParameter oWSCompany 1 C_unbounded "companyList"
    Send DefineParameter xsString C_Nillable 1 "requestId"
    Send DefineParameter xsString C_Nillable 1 "transactionIdentifier"
End_Object
This is correct, e.g. transactionIdentifier, is defined as a min of C_Nillable and a max of 1.

However in cClientWebService.pkg, it has the code
Code:
If (ChildSoapParamDef.iMin=0) Begin    // a iMin=0 with no items. We may want to mark this as null
    Get CreateNullValueTree ChildSoapParamDef to ChildValueTree
End
Else Begin
    // data does not match what we are expecting
    Move wssInvalidDataForType to iError
End
So it completely skips the check if it set to c_Nillable (-1).
So the test should fixed to be
Code:
If (ChildSoapParamDef.iMin=0 or ChildSoapParamDef.iMin=C_Nillable) Begin    // a iMin=0 with no items. We may want to mark this as null
    Get CreateNullValueTree ChildSoapParamDef to ChildValueTree
End
Else Begin
    // data does not match what we are expecting
    Move wssInvalidDataForType to iError
End
This test is repeated 3 times in this class.

Once this is fixed, we can use the classes generated by the wsdl, without manually needing to fix it, when the endpoint does not return the nillable element.

ps when NOT checking the nillable support, its worse and assumes a minimum of 1, which obviously always errors when not returned.

To reproduce by building a prototype :
- Create a simple webservice, returning a struct with a string and some other elements.
- Save the generated wsdl locally and alter with replacing the minOccurs="0" with nillable="true" on the string.
- Generate a client class with the nillable support checked
- Call it, all good
- Remove the struct member from the server (as it is nillable right)
- Call it, and see that it fails with "Received XML data does not match destination data type", so this is NOT correct as it is nillable and not provided so should be all good.
- Fix by extending the test for min = 0 or C_Nillable

Kind regards
Marco