#1 2019-09-03 08:52:06

MikaK
Member
Registered: 2016-11-09
Posts: 14

Different parameter to method call

Hi,
I have mormot server ( TSQLRestServerFullMemory / TSQLHttpServer ) with few interfaces
Server and my test bench work fine. But when I call from another application I receive exception "sicShared execution failed (probably due to bad input parameters)"
interface unit is same (triple checked)

Called method is defined     

  function RahastaPoyta(const aKanta, aPoyta, aPaikka: string; const aMaksutavat: TMaksutapaArray): String;

and TMaksutapaArray is defined

  TKaytettyMaksutapa = record
    NRO: integer;
    Summa: double;
    Annettu: double;
  end;
  TMaksutapaArray = tarray< TKaytettyMaksutapa >;

Server log for error is

20190903 07482618  +    mORMot.TSQLRestServerFullMemory(06022f90).URI POST root/TaustaBusiness.RahastaPoyta in=64 B   
20190903 07482618 call      mORMot.TSQLRestServerFullMemory(06022f90) ITaustaBusiness.RahastaPoyta["ravintola","9","",["￰FAABAQBfQAEAAAAAAAAAAABZQAAAAAAAAAAA"]]
20190903 07482618 debug     mORMot.TSQLRestServerFullMemory(06022f90) TSQLRestRoutingREST.Error: {  "errorCode":406,  "errorText":"sicShared execution failed (probably due to bad input parameters) for TaustaBusiness.RahastaPoyta"  }

and ok log is
20190903 07523704  +    mORMot.TSQLRestServerFullMemory(060d5460).URI POST root/TaustaBusiness.RahastaPoyta in=70 B
20190903 07523704 call      mORMot.TSQLRestServerFullMemory(060d5460) ITaustaBusiness.RahastaPoyta["kirkar","17","",["￰GAABAQBeQAEAAAAAAAAAAAAAAAAAWUAAAAAAAAAAAA=="]]
20190903 07523727 srvr      mORMot.TSQLRestServerFullMemory(060d5460)   POST root/TaustaBusiness.RahastaPoyta Interface=200 out=34 B in 377.05ms
20190903 07523727 ret       mORMot.TSQLRestServerFullMemory(060d5460) {"result":["{\"status\":\"OK\"}"]}

As we can see last parameter (array) is different in two cases.

Both cases that array is same and it's initialized actually by copied code.

  setlength(a,1);
  a[0].NRO := 1;
  a[0].Summa := 100;
  a[0].Annettu := 0;

What makes the difference in last parameter? How does mormot encode arrays ?

Last edited by MikaK (2019-09-03 08:52:58)

Offline

#2 2019-09-03 09:05:38

pvn0
Member
From: Slovenia
Registered: 2018-02-12
Posts: 211

Re: Different parameter to method call

Record needs to be declared as packed record, see documentation.

Last edited by pvn0 (2019-09-03 09:06:01)

Offline

#3 2019-09-03 10:11:35

MikaK
Member
Registered: 2016-11-09
Posts: 14

Re: Different parameter to method call

Thanks. SOme how have missed that.

Offline

Board footer

Powered by FluxBB