Four Js Development Tools Forum

Discussions by product => GWS => Topic started by: Jos? V. on November 23, 2021, 06:21:28 pm



Title: Sequence cannot be null
Post by: Jos? V. on November 23, 2021, 06:21:28 pm
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:
Code:
-17 Sequence 'testresponse': Sequence cannot be null

My response type is defined as follows:
Code:
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:
Code:
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


Title: Re: Sequence cannot be null
Post by: Reuben B. on November 24, 2021, 09:39:05 am
I have not tried with your example, but in 3.10 there was a change in this area http://4js.com/online_documentation/fjs-fgl-manual-html/#fgl-topics/c_fgl_Migrate_to_310_web_services.html and it maybe that you need XMLOptional or XMLNillable or both.


Title: Re: Sequence cannot be null
Post by: Jos? V. on November 24, 2021, 11:14:49 am
I had read the upgrade notes and tried several combinations before posting.

My understanding of the issue is that the type of the main response variable cannot be "empty"
Since it is composed only of a optional dynamic array, this array cannot be null.
And that's what I'm trying to achieve, an empty response.

Is there any way do to this? Am I missing something?