My custom delphi code-first RO/DA server needs to poll a REST end point and update the database with the contents (if changed).
I am implementing this by using a TTimer on the fServerDataModule. In the OnTimer event I am polling the end-point (in a TTask) to get a JSON string.
Then I am creating an instance of my data-service
//FRules is a string containing JSON from REST end-point ClientID := ROMessage.ClientID; fClassFactory := GetClassFactory('AquilaService'); fClassFactory.CreateInstance(ClientID, instance); IAquilaService(instance).UpdateRulesFromJSON(fRules); //<-- need client access
In order to access the
UpdateRulesFromJson method, I have to include my client-access interface unit (AquilaLibrary_Intf).
When I do this and compile the server, each time I try to access a data table on the client I get an exception "Error reading parameter aTableRequestInfoArray: Unexpected class found in stream; class “TableRequestInfo” does not descend from “TableRequestInfo”.
When I remove the reference to AquilaLibrary_Intf from the fServerDataModule it all works fine, but then I cannot utilise a reference to
IAquilaService or any of its methods.
What is the best way to implement this scenario?