RO DataSnap Server questions

I need some explanation on the architecture of a RO DataSnap Server.

I already had a look at the DataSnap sample, but don’t understand it fully.

DataSnap Server:

  1. What is IAppServer1 = interface(IAppServer) and why do I need that?
  2. Is that interface always empty?
  3. Can I place more than 1 TDataSetProviders in one TRODataSnapModule?
  4. Why do I have to write the interface name ‘IAppServer1’ as string in the TROClassFactory.Create constructor?
    4.1) Must that name always match the declared interface?

This example illustrates the use of different the TRODataSnapModule simultaneously in the server application. If you use only one TRODataSnapModule, you can skip using IAppServer1/IAppServer2

Interface isn’t empty - it’s descendant of IAppServer so it inherits all properties and methods of parent interface.

Yes, you can. see Providers property of TRODataSnapModule.

Client also passes interface name as string so server compares these strings and finds correspondent Invoker.

Yes.

Hi EvgenyK,

I can add methods my methods in IAppServer1 = interface(IAppServer) and access method on client ? if yes, how implement ?

the easiest way is add separated ROService.

more complicated way is declare your service as Code-First service. I’ve attached updated DataSnap sample: testcase.zip (78.2 KB).
look at TDataSnapServerDataForm.Now method

Hi EvgenyK,

Thanks for your reply, i go try implement.

EvgenyK, one more question, is possible create datasetprovider on run time and publish provider in RODataSnapModule ?

I create TDataSetProvider in run time, but retorn the error: An exception was raised on the server: Provider “dsp_XXX” is not exported

have you added your provider into Providers collection of TRODataSnapModule ?
you can do this with RegisterProvider method