You are not logged in.
Hi,
I refer to this entry http://synopse.info/fossil/tktview?name=d19d9d67f2.
My request was:
Please support objects too, like Embarcadero does with SOAP.
Your answer was:
It is as designed. As stated by the documentation: how will be in charge of freeing the instance? If you want to retrieve some class instance content, you may use a var parameter with the instance: it will be unserialized on the function return.
Well, I have read that. The answer to the freeing question is, why I wrote "like Embarcardero does it with SOAP". It works there so I don't see a valid reason why it could not work here too.
Next, the fact how an class instance is returned, either via var/out param, or via return value seems not to affect the freeing question at all, does it?
Last not least, I have tried to use an class instance as var parameter, as suggested in the docs. Here is the code I used:
TFoo = class( TRemotable)
protected
FBar : string;
published
property Bar : string read FBar write FBar;
end;
ITest = interface( IInvokable)
['{03517954-B3AF-4265-93D7-67AFCC2AA06C}']
procedure GiveMeAFoo( var retval : TFoo);
end;
It did not work, saying "First chance exception at $xxxxxxxx. EServiceException with message 'ITest.GiveMeAFoo: retval parameter has unexpected type TFoo'.". Maybe I just did something wrong?
BTW, nice project, good work.
Last edited by JensG (2012-05-28 19:48:43)
Offline
What is this "TRemotable" here?
This is a SOAP dedicated type.
Forget anything about the Delphi SOAP units!
Do not mix units and types, unless you really need it.
As stated by the documentation, you should use a TPersistent or a TSQLRecord class to be used for classes serialization.
Or any other class type, only if it has been registered as stated in http://blog.synopse.info/post/2012/04/1 … -any-class
This is what the EServiceException calls "unexpected type".
See function TypeInfoToMethodValueType:
tkClass:
if JSONObject(P^.ClassType^.ClassType, IsObjCustomIndex) in
[oCollection,oUtfs,oStrings,oSQLRecord,oPersistent,oCustom] then
result := smvObject; // JSONToObject/ObjectToJSON types
Offline
Agree on TRemotable, thanks for pointing me to the other blog post.
Offline