#1 2019-01-04 15:21:15

Shadownildo
Member
From: Brazil
Registered: 2018-10-10
Posts: 36

Service Contract Differs

Hello there, I'm having some trouble with the Services methods and i don't know why, let me explain. I have a Service that do a constantly validation in a Mega Server, and it works when i Release, but when i have some update in the Client Server, the Contracts Differs, even if i don't change nothing in the specific Service, but i Have other Service that works Fine and is Almost the Exact same code... I need some help because i cannot find where i have to make changes, and i already read the documentation and not find anything useful.



unit InterfaceAmbiente;

interface

uses
  mORMot, SynCommons;

type
  IRestAmbiente = interface(IInvokable)
    ['{748BB1BE-0503-408C-B72C-9838CD9F012C}']
    function CaptureAll: RawUTF8;
    function Verify (CNPJCLIENT: RawUtF8): RawUtF8;
    procedure SendingDatabase(ID,IDPessoa: Integer; DataBase: string;
      DatabaseLog: string; Port: string; PortHTTP: string; PortmORMot: string;
      UserName: string; Password: string; Host: string);
  end;

const
  SERVICE_INSTANCE_IMPLEMENTATION = TServiceInstanceImplementation.sicSingle;

implementation

initialization

TInterfaceFactory.RegisterInterfaces([TypeInfo(IRestAmbiente)]);

end.

////// This is the Interface Service that is in Mega and Client Servers and have Contract Differs


procedure TRESTServerSIGEPS.ConfigServices;
var
  ServiceFactoryServer: TServiceFactoryServer;
begin
  ServiceFactoryServer := Self.ServiceDefine(TRestLicenca, [IRestLicenca],
    SERVICE_INSTANCE_IMPLEMENTATION);
  ServiceFactoryServer := Self.ServiceDefine(TRestAmbiente, [IRestAmbiente],
    SERVICE_INSTANCE_IMPLEMENTATION);

  ServiceFactoryServer.SetOptions([], [optErrorOnMissingParam]);
 
end;

///// This is the Service Settings on the Servers

unit InterfaceRestLicenca;

interface

uses
  mORMot, SynCommons;

type
  IRestLicenca = interface(IInvokable)
    ['{A043A8F0-813F-4702-B910-B31BCFEB831E}']
      function GetEncrypted(ACNPJ: RawUTF8): RawUTF8;
  end;

const
  SERVICE_INSTANCE_IMPLEMENTATION = TServiceInstanceImplementation.sicSingle;

implementation

initialization

TInterfaceFactory.RegisterInterfaces([TypeInfo(IRestLicenca)]);

end.

// And this is the Other Service that Validate Login but that not have Contract Issues.


Exception Error
https://imgur.com/FLShFb3

Offline

#2 2019-01-04 15:51:41

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

Re: Service Contract Differs

The contract hash differs only if the interface is changed.

Offline

#3 2019-01-04 16:00:18

Shadownildo
Member
From: Brazil
Registered: 2018-10-10
Posts: 36

Re: Service Contract Differs

ab wrote:

The contract hash differs only if the interface is changed.


But i not change anything in the Service Interface, Not even a Single Line.... What happens is when Release a new Version, both are in the Same "Build", it Works, but when i Maintain the Mega Server version and change Others Units not Correlated with the Service in the Client Server Version, This error Appears...

Offline

#4 2019-01-04 16:04:35

Shadownildo
Member
From: Brazil
Registered: 2018-10-10
Posts: 36

Re: Service Contract Differs

Shadownildo wrote:
ab wrote:

The contract hash differs only if the interface is changed.


But i not change anything in the Service Interface, Not even a Single Line.... What happens is when Release a new Version, both are in the Same "Build", it Works, but when i Maintain the Mega Server version and change Others Units not Correlated with the Service in the Client Server Version, This error Appears...

There is a Way that i can "Ignore" This Contracts?

Offline

#5 2019-01-04 17:00:27

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

Re: Service Contract Differs

The interface should have been modified for sure in-between.

Anyway, the easiest is to use

TSQLRestClientURI.ServiceDefineSharedAPI()

on the client side and

TSQLRestServer.ServiceDefine(...).ResultAsJSONObjectWithoutResult := true;

on the server side

Offline

Board footer

Powered by FluxBB