Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: [1]
  Reply  |  Print  
Author Topic: Sequence cannot be null  (Read 10899 times)
Jos? V.
Posts: 58


« 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

* test.zip (2.4 KB - downloaded 1375 times.)
Reuben B.
Four Js
Posts: 1116


« Reply #1 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.

Product Consultant (Asia Pacific)
Developer Relations Manager (Worldwide)
Author of https://4js.com/ask-reuben
Contributor to https://github.com/FourjsGenero
Jos? V.
Posts: 58


« Reply #2 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?
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines