I'm building a webservice which gets a list of DB records as a dynamic array.
When there's no record on the DB the array ends up empty and should return a empty tag, but instead I'm getting the error:
-17 Sequence 'testresponse': Sequence cannot be null
My response type is defined as follows:
type tns1testresponse record ATTRIBUTE(XMLSequence,XSTypeName="TestResponse",XSTypeNamespace="urn:audaxys/leasews/leasing/LeaseComercialService")
responsearray dynamic array ATTRIBUTE(XMLList) of tns2resparray ATTRIBUTE(XMLNamespace="http://www.audaxys.com/namespaces/leasews",XMLOptional)
end record
The problem seems to be that even tought responsearray is XMLOptional he is the only member of type tns1testresponse and without it being instantiated I get the error above.
I also noticed that I get the correct result if I add an empty member to responsearray using appendElement() which forces the array to not be null but returns this:
SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<fjs1:testresponse xmlns:fjs1="urn:audaxys/leasews/leasing/LeaseComercialService" xmlns:fjs2="http://www.audaxys.com/namespaces/leasews"/>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
I attached a zip file demonstrating this behaviour.
It includes a server, the .h file with the globals and the WS module.
Is there a way/attribute to get the expected behaviour(empty testResponse tag) when the array is empty?
NOTE: Im using BDL 3.20.11