You are not logged in.
Hi ab.
I am trying to use some services in DMZ and according to manual should be able to do this using TSQLRestServer.ServiceRegister(aClient: TSQLRest;
I get AV error with call "srv.ServiceRegister("
Here is my sample
climodel := ClientModule.GetModel;
RemoteClient := TSQLHttpClientWinHTTP.Create( 127.0.0.1, '333', climodel );
RemoteClient.OnAuthentificationFailed := OnAuthentificationFailed;
srv := TSQLRestServerRemoteDB.Create( RemoteClient );
srv.ServiceRegister(RemoteClient,[TypeInfo(ICABMeter)]);
What is the proper way to use this?
I see variable "aClient" has no use in implementation.
function TSQLRestServer.ServiceRegister(aClient: TSQLRest;
const aInterfaces: array of PTypeInfo;
aInstanceCreation: TServiceInstanceImplementation;
const aContractExpected: RawUTF8): boolean;
begin
result := False;
if (self=nil) or (high(aInterfaces)<0) or (aClient=nil) then
exit;
result := (ServiceContainer as TServiceContainerServer).AddInterface(
aInterfaces,aInstanceCreation,aContractExpected);
end;
Offline
I guess you have something misunderstood.
Is this on server side or client side ?
I think the documentation it's very very clear.
Offline
I guess you have something misunderstood.
Is this on server side or client side ?I think the documentation it's very very clear.
Maybe i did.
How to undestand this?
function ServiceRegister(aClient: TSQLRest; const aInterfaces: array of PTypeInfo; aInstanceCreation: TServiceInstanceImplementation=sicSingle; const aContractExpected: RawUTF8=''): boolean; overload; virtual;
Register a remote Service via its interface
- this overloaded method will register a remote Service, accessed via the supplied TSQLRest(ClientURI) instance: it can be available in the main TSQLRestServer.Services property, but execution will take place on a remote server - may be used e.g. for dedicated hosting of services (in a DMZ for instance)
Offline
Sorry, I don't understand you.
From client side you need to do something like that (extracted from sample 14):
...
Client := TSQLHttpClient.Create('localhost', PORT_NAME,Model);
Client.ServiceDefine([ICalculator],sicShared);
And service is prepared to be consumed from client:
...
if Client.Services['Calculator'].Get(I) then
writeln(IntToStr(I.Add(a,b));
Offline
When you write
srv.ServiceRegister(RemoteClient,[TypeInfo(ICABMeter)]);
You are making a confusion between the REST client (RemoteClient) and the class instance implementing the ICABMeter service.
Offline
I want to use part of internal services on public side.
So i have
InternalServer.ServiceDefine([IService1, IService2, IService3]);
I want to use it on external perimeter as
ExternalClient.Create()
ExternalServer.ServiceDefine( ExternalClient, [IService1] );
Of coarce the obvious way would be
ExternalClient.Create()
ExternalClient.ServiceDefine( [IService1] );
But this makes me responsible for creation and freeing client in every call or Having single client for my instance.
So i am trying to find a nice solution.
Since I did not find a way to use such a call in the examples, I started a thread.
Offline