You are not logged in.
Pages: 1
I get exception:
TServiceFactoryClient.Create(): server''s IMyService contract differs from
client''s: expected ["1"], received [1] -
you may need to upgrade your 1.0.0.219 client to match server expectations'
But see screen from debug session (mORMot.pas)
This is my mistake or mORMot has problem? :-)
ps. latest mORMot, Delphi Tokyo
Last edited by jaclas (2018-02-06 12:43:39)
Offline
If you have changed the definition of IMyService, you have to **compile** both the server and client programs.
All, I mean all, all of the time I got a "contract" error was the above mentioned reason.
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
Yeah you need to recompile and redeploy both. That happened here too.
Offline
I always recompile server and client.
But why ContractExpected value has quoted chars around "1"? See Watch List and values of compared variables.
Offline
Client side:
fServiceFactory := fClient.ServiceRegister(TypeInfo(IMyInterface), sicShared, '2') as TServiceFactoryClient;
server side:
sf := ServiceRegister(fMyService as TInterfacedObject, [TypeInfo(IMyService)], '2');
sf.ContractExpected := '2';
and I still get exception:
{"Message":"TServiceFactoryClient.Create(): server's IMyService
contract differs from client's: expected [\"2\"], received [2] - you may need to upgrade your 1.0.0.221 client to match server expectations"}
Why? Where I make mistake?
Offline
And I found problematic place, in constructor:
constructor TServiceFactory.Create(aRest: TSQLRest; aInterface: PTypeInfo;
aInstanceCreation: TServiceInstanceImplementation; const aContractExpected: RawUTF8);
See:
Last edited by jaclas (2018-02-07 10:23:01)
Offline
I found on server side:
But I have it in the code for a very long time! And maybe the last versions of the mORMot have changed something here...
Last edited by jaclas (2018-02-07 12:32:41)
Offline
Just get rid of this line.
IIRC ServiceRegister() did already set the ContractExpected value from the '1' supplied parameter - with the quotes.
See TServiceFactory.Create.
Also check https://synopse.info/fossil/info/152edc748c33068b for the client side.
Offline
Ok, I remove this line, but I have a doubt and a question!
When I create TServiceFactoryServer object and specify the contract in the constructor:
sf := ServiceRegister(fMyService as TInterfacedObject, [TypeInfo(IMyService)], '2');
then in ContractExpected property I have value: "2" (with quote chars)
sf.ContractExpected is equal "2"
But (!) when I use setter:
sf.ContractExpected := '2';
then property is set to a different value! ContractExpected property has a: 2 (without quote chars!)
sf.ContractExpected is equal 2
This is IMHO a incorrect behavior, the value set by the constructor should be the same as set by property.
Last edited by jaclas (2018-02-08 14:05:22)
Offline
Thx Arnaud!
Offline
Pages: 1