#1 2023-05-11 11:47:44

itSDS
Member
From: Germany
Registered: 2014-04-24
Posts: 516

Question concerning SOA "Object" Parameter

Hey Arnaud, we call a SOA Interface function from a client.
we have 5 "Object" Parameter and 2 are initialized with nil on the Client.
On the Server this Parameter are not set to nil, they contain an "empty" Object. Is it possible to get the "nil" parameter.
Specially if one of the Parameter is an "out" Parameter, how is it with memory Management ?

Example:

TMyObject = class TSynPersistent...

interface...

function SOAFunktion(out AResultObject : TMyObject; const AParam1, Param2, AParam3 : TMyObject; const AParam4:TMyObject = nil) : TResultRecord;

Client Calls

var LResult : TMyObject := nil;
AServer.SOAFunction(LResult, p1, p2, p3, nil);

On the Server Side all 5 Objects does contain a TMyObject, p1-3 are the desired Objects. but AResultObject and AParam4 should be nil ?!

Last edited by itSDS (2023-05-11 11:48:23)


Rad Studio 12.1 Santorini

Offline

#2 2023-05-11 12:09:50

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,656
Website

Re: Question concerning SOA "Object" Parameter

The class instances are passed by value, and are allocated/disallocated on the server side, as documented.
It means the "out " parameter lifetime is managed by the framework on server side.

There is no support of "nil" because the client side instances lifetime should reflect the server side expectations.
In practice, null within the JSON is not supported because the instances are allocated before the actual JSON is parsed.*

So this current behavior is a documented limitation/feature.
See
https://synopse.info/files/html/Synopse … l#TITL_154
and
https://synopse.info/files/html/Synopse … #TITLE_408

Offline

#3 2023-05-11 12:23:31

itSDS
Member
From: Germany
Registered: 2014-04-24
Posts: 516

Re: Question concerning SOA "Object" Parameter

tyvm i can work with it


Rad Studio 12.1 Santorini

Offline

Board footer

Powered by FluxBB