#1 2017-06-28 09:38:02

cybexr
Member
Registered: 2016-09-14
Posts: 78

SOA service-contract on linux differs with on windows

Same service code, both compiled with FPC, but service-contract differs . the client expected contract is the version on windows.

Linux-retruns {"result":["0063F5DAFC95F854"]}
linux

windows-retruns {"result":["A9C202E36B8F93AB"]}
windows

Offline

#2 2017-06-28 10:10:21

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

Re: SOA service-contract on linux differs with on windows

What is the fContract JSON content as computed in TServiceFactory.Create (line 56742) on Windows and Linux?

I'm afraid there may be some case-sensitivity inconsistency about RTTI type names.
Do both FPC have the same exact version?

Offline

#3 2017-06-28 12:19:46

cybexr
Member
Registered: 2016-09-14
Posts: 78

Re: SOA service-contract on linux differs with on windows

Tested with :

FPC svn 52403 on Windows
  target windows ,return A9C202E36B8F93AB
  crosscompile to linux64 then running on ubuntu, return 0063F5DAFC95F854

FPC svn 55405 on Ubuntu
  retrun  0063F5DAFC95F854

Offline

#4 2017-06-28 12:23:53

cybexr
Member
Registered: 2016-09-14
Posts: 78

Re: SOA service-contract on linux differs with on windows

fContract JSON content on windows:

{"contract":"ComplexCalculator","implementation":"single","methods":[{"method":"Add","arguments":[{"argument":"Self","direction":"in","type":"self"},{"argument":"n1","direction":"in","type":"integer"},{"argument":"n2","direction":"in","type":"integer"},{"argument":"Result","direction":"out","type":"integer"}]},{"method":"Multiply","arguments":[{"argument":"Self","direction":"in","type":"self"},{"argument":"n1","direction":"in","type":"int64"},{"argument":"n2","direction":"in","type":"int64"},{"argument":"Result","direction":"out","type":"int64"}]},{"method":"Subtract","arguments":[{"argument":"Self","direction":"in","type":"self"},{"argument":"n1","direction":"in","type":"double"},{"argument":"n2","direction":"in","type":"double"},{"argument":"Result","direction":"out","type":"double"}]},{"method":"ToText","arguments":[{"argument":"Self","direction":"in","type":"self"},{"argument":"Value","direction":"in","type":"currency"},{"argument":"Result","direction":"both","type":"utf8"}]},{"method":"ToTextFunc","arguments":[{"argument":"Self","direction":"in","type":"self"},{"argument":"Value","direction":"in","type":"double"},{"argument":"Result","direction":"out","type":"utf8"}]},{"method":"Swap","arguments":[{"argument":"Self","direction":"in","type":"self"},{"argument":"n1","direction":"both","type":"double"},{"argument":"n2","direction":"both","type":"double"}]},{"method":"StackIntMultiply","arguments":[{"argument":"Self","direction":"in","type":"self"},{"argument":"n1","direction":"in","type":"integer"},{"argument":"n2","direction":"in","type":"integer"},{"argument":"n3","direction":"in","type":"integer"},{"argument":"n4","direction":"in","type":"integer"},{"argument":"n5","direction":"in","type":"integer"},{"argument":"n6","direction":"in","type":"integer"},{"argument":"n7","direction":"in","type":"integer"},{"argument":"n8","direction":"in","type":"integer"},{"argument":"n9","direction":"in","type":"integer"},{"argument":"n10","direction":"in","type":"integer"},{"argument":"Result","direction":"out","type":"int64"}]},{"method":"StackFloatMultiply","arguments":[{"argument":"Self","direction":"in","type":"self"},{"argument":"n1","direction":"in","type":"double"},{"argument":"n2","direction":"in","type":"double"},{"argument":"n3","direction":"in","type":"double"},{"argument":"n4","direction":"in","type":"double"},{"argument":"n5","direction":"in","type":"double"},{"argument":"n6","direction":"in","type":"double"},{"argument":"n7","direction":"in","type":"double"},{"argument":"n8","direction":"in","type":"double"},{"argument":"n9","direction":"in","type":"double"},{"argument":"n10","direction":"in","type":"double"},{"argument":"Result","direction":"out","type":"int64"}]},{"method":"SpecialCall","arguments":[{"argument":"Self","direction":"in","type":"self"},{"argument":"Txt","direction":"in","type":"utf8"},{"argument":"Int","direction":"both","type":"integer"},{"argument":"Card","direction":"both","type":"cardinal"},{"argument":"field","direction":"in","type":"TSynTableFieldTypes"},{"argument":"fields","direction":"in","type":"TSynTableFieldTypes"},{"argument":"options","direction":"both","type":"TSynTableFieldOptions"},{"argument":"Result","direction":"out","type":"TSynTableFieldTypes"}]},{"method":"ComplexCall","arguments":[{"argument":"Self","direction":"in","type":"self"},{"argument":"Ints","direction":"in","type":"TIntegerDynArray"},{"argument":"Strs1","direction":"in","type":"TRawUTF8DynArray"},{"argument":"Str2","direction":"both","type":"TWideStringDynArray"},{"argument":"Rec1","direction":"in","type":"TVirtualTableModuleProperties"},{"argument":"Rec2","direction":"both","type":"TSQLRestCacheEntryValue"},{"argument":"Float1","direction":"in","type":"double"},{"argument":"Float2","direction":"both","type":"double"},{"argument":"Result","direction":"out","type":"TSQLRestCacheEntryValue"}]},{"method":"Substract","arguments":[{"argument":"Self","direction":"in","type":"self"},{"argument":"n1","direction":"in","type":"TComplexNumber"},{"argument":"n2","direction":"in","type":"TComplexNumber"},{"argument":"Result","direction":"out","type":"TComplexNumber"}]},{"method":"IsNull","arguments":[{"argument":"Self","direction":"in","type":"self"},{"argument":"n","direction":"in","type":"TComplexNumber"},{"argument":"Result","direction":"out","type":"boolean"}]},{"method":"TestBlob","arguments":[{"argument":"Self","direction":"in","type":"self"},{"argument":"n","direction":"in","type":"TComplexNumber"},{"argument":"Result","direction":"out","type":"TServiceCustomAnswer"}]},{"method":"TestVariants","arguments":[{"argument":"Self","direction":"in","type":"self"},{"argument":"Text","direction":"in","type":"utf8"},{"argument":"V1","direction":"in","type":"variant"},{"argument":"V2","direction":"both","type":"variant"},{"argument":"Result","direction":"out","type":"variant"}]},{"method":"Collections","arguments":[{"argument":"Self","direction":"in","type":"self"},{"argument":"Item","direction":"in","type":"TCollTest"},{"argument":"List","direction":"both","type":"TCollTestsI"},{"argument":"Copy","direction":"out","type":"TCollTestsI"}]},{"method":"GetCurrentThreadID","arguments":[{"argument":"Self","direction":"in","type":"self"},{"argument":"Result","direction":"out","type":"cardinal"}]},{"method":"GetCustomer","arguments":[{"argument":"Self","direction":"in","type":"self"},{"argument":"CustomerId","direction":"in","type":"integer"},{"argument":"CustomerData","direction":"out","type":"TCustomerData"},{"argument":"Result","direction":"out","type":"boolean"}]},{"method":"FillPeople","arguments":[{"argument":"Self","direction":"in","type":"self"},{"argument":"People","direction":"both","type":"TSQLRecordPeople"}]}]}

fContract JSON content on linux:

{"contract":"ComplexCalculator","implementation":"single","methods":[{"method":"Add","arguments":[{"argument":"Self","direction":"in","type":"self"},{"argument":"n1","direction":"in","type":"integer"},{"argument":"n2","direction":"in","type":"integer"},{"argument":"Result","direction":"out","type":"integer"}]},{"method":"Multiply","arguments":[{"argument":"Self","direction":"in","type":"self"},{"argument":"n1","direction":"in","type":"int64"},{"argument":"n2","direction":"in","type":"int64"},{"argument":"Result","direction":"out","type":"int64"}]},{"method":"Subtract","arguments":[{"argument":"Self","direction":"in","type":"self"},{"argument":"n1","direction":"in","type":"double"},{"argument":"n2","direction":"in","type":"double"},{"argument":"Result","direction":"out","type":"double"}]},{"method":"ToText","arguments":[{"argument":"Self","direction":"in","type":"self"},{"argument":"Value","direction":"in","type":"currency"},{"argument":"Result","direction":"both","type":"utf8"}]},{"method":"ToTextFunc","arguments":[{"argument":"Self","direction":"in","type":"self"},{"argument":"Value","direction":"in","type":"double"},{"argument":"Result","direction":"out","type":"utf8"}]},{"method":"Swap","arguments":[{"argument":"Self","direction":"in","type":"self"},{"argument":"n1","direction":"both","type":"double"},{"argument":"n2","direction":"both","type":"double"}]},{"method":"StackIntMultiply","arguments":[{"argument":"Self","direction":"in","type":"self"},{"argument":"n1","direction":"in","type":"integer"},{"argument":"n2","direction":"in","type":"integer"},{"argument":"n3","direction":"in","type":"integer"},{"argument":"n4","direction":"in","type":"integer"},{"argument":"n5","direction":"in","type":"integer"},{"argument":"n6","direction":"in","type":"integer"},{"argument":"n7","direction":"in","type":"integer"},{"argument":"n8","direction":"in","type":"integer"},{"argument":"n9","direction":"in","type":"integer"},{"argument":"n10","direction":"in","type":"integer"},{"argument":"Result","direction":"out","type":"int64"}]},{"method":"StackFloatMultiply","arguments":[{"argument":"Self","direction":"in","type":"self"},{"argument":"n1","direction":"in","type":"double"},{"argument":"n2","direction":"in","type":"double"},{"argument":"n3","direction":"in","type":"double"},{"argument":"n4","direction":"in","type":"double"},{"argument":"n5","direction":"in","type":"double"},{"argument":"n6","direction":"in","type":"double"},{"argument":"n7","direction":"in","type":"double"},{"argument":"n8","direction":"in","type":"double"},{"argument":"n9","direction":"in","type":"double"},{"argument":"n10","direction":"in","type":"double"},{"argument":"Result","direction":"out","type":"int64"}]},{"method":"SpecialCall","arguments":[{"argument":"Self","direction":"in","type":"self"},{"argument":"Txt","direction":"in","type":"utf8"},{"argument":"Int","direction":"both","type":"integer"},{"argument":"Card","direction":"both","type":"cardinal"},{"argument":"field","direction":"in","type":"TSynTableFieldTypes"},{"argument":"fields","direction":"in","type":"TSynTableFieldTypes"},{"argument":"options","direction":"both","type":"TSynTableFieldOptions"},{"argument":"Result","direction":"out","type":"TSynTableFieldTypes"}]},{"method":"ComplexCall","arguments":[{"argument":"Self","direction":"in","type":"self"},{"argument":"Ints","direction":"in","type":"TIntegerDynArray"},{"argument":"Strs1","direction":"in","type":"TRawUTF8DynArray"},{"argument":"Str2","direction":"both","type":"TWideStringDynArray"},{"argument":"Rec1","direction":"in","type":"TVirtualTableModuleProperties"},{"argument":"Rec2","direction":"both","type":"TSQLRestCacheEntryValue"},{"argument":"Float1","direction":"in","type":"double"},{"argument":"Float2","direction":"both","type":"double"},{"argument":"Result","direction":"out","type":"TSQLRestCacheEntryValue"}]},{"method":"Substract","arguments":[{"argument":"Self","direction":"in","type":"self"},{"argument":"n1","direction":"in","type":"TComplexNumber"},{"argument":"n2","direction":"in","type":"TComplexNumber"},{"argument":"Result","direction":"out","type":"TComplexNumber"}]},{"method":"IsNull","arguments":[{"argument":"Self","direction":"in","type":"self"},{"argument":"n","direction":"in","type":"TComplexNumber"},{"argument":"Result","direction":"out","type":"boolean"}]},{"method":"TestBlob","arguments":[{"argument":"Self","direction":"in","type":"self"},{"argument":"n","direction":"in","type":"TComplexNumber"},{"argument":"Result","direction":"out","type":"TServiceCustomAnswer"}]},{"method":"TestVariants","arguments":[{"argument":"Self","direction":"in","type":"self"},{"argument":"Text","direction":"in","type":"utf8"},{"argument":"V1","direction":"in","type":"variant"},{"argument":"V2","direction":"both","type":"variant"},{"argument":"Result","direction":"out","type":"variant"}]},{"method":"Collections","arguments":[{"argument":"Self","direction":"in","type":"self"},{"argument":"Item","direction":"in","type":"TCollTest"},{"argument":"List","direction":"both","type":"TCollTestsI"},{"argument":"Copy","direction":"out","type":"TCollTestsI"}]},{"method":"GetCurrentThreadID","arguments":[{"argument":"Self","direction":"in","type":"self"},{"argument":"Result","direction":"out","type":"int64"}]},{"method":"GetCustomer","arguments":[{"argument":"Self","direction":"in","type":"self"},{"argument":"CustomerId","direction":"in","type":"integer"},{"argument":"CustomerData","direction":"out","type":"TCustomerData"},{"argument":"Result","direction":"out","type":"boolean"}]},{"method":"FillPeople","arguments":[{"argument":"Self","direction":"in","type":"self"},{"argument":"People","direction":"both","type":"TSQLRecordPeople"}]}]}

Original interface definition :

    /// returns the thread ID running the method on server side
    function GetCurrentThreadID: TThreadID;

which on linux64 produce : {"argument":"Result","direction":"out","type":"int64"}
but on win32 produce: {"argument":"Result","direction":"out","type":"cardinal"}
also on win64 produce : {"argument":"Result","direction":"out","type":"int64"}

So, strictly speaking, it's not a bug ,just an implemention flaw. 
Thank you, ab, for your so quick replying .

Last edited by cybexr (2017-06-28 12:41:10)

Offline

#5 2017-06-28 16:05:57

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

Re: SOA service-contract on linux differs with on windows

Yes, TThreadID is a type alias, which is not system independent.
On real production server, you would never use such a parameter for remote SOA access, since a thread ID is clearly computer specific.

Nice catch!

Offline

Board footer

Powered by FluxBB