#1 Re: mORMot 1 » multi-interface authorization » 2017-09-26 08:51:10

ServiceFactoryServer := fRestServer.ServiceDefine(TSystem, [ISystem], SERVICE_INSTANCE_IMPLEMENTATION);
ServiceFactoryServer := fRestServer.ServiceDefine(TRestMethods, [IRestMethods], SERVICE_INSTANCE_IMPLEMENTATION);

this two lines are problems , how to get the ServiceFactoryServer include all Interfaces ?

the authorization function's parameter seems required a method name .
    function AllowByID(const aMethod: array of RawUTF8; const aGroupID: array of TID): TServiceFactoryServer;
    function AllowByName(const aMethod: array of RawUTF8; const aGroup: array of RawUTF8): TServiceFactoryServer;

==============
where can I found a Interface based authorization demo ?

#2 mORMot 1 » invalid contract » 2017-09-26 08:03:32

linbren
Replies: 1

I am testing SynCrossPlatformREST.

get a exception here

  if contract<>fContractExpected then
    raise EServiceException.CreateFmt('Invalid contract "%s" for %s: expected "%s"',
      [contract,ClassName,fContractExpected]);

the "contract" was not the same .

my mORMotClient was donwload from Wrapper service .
the contract value was assigned in create method :>   fContractExpected := 'E705B04F2012153D';
-----------------------------------
what does the "contract" working here ? how to calculate the value ?

#4 mORMot 1 » multi-interface authorization » 2017-09-26 03:32:34

linbren
Replies: 4

define two interface

  ISystem = interface(IInvokable)
    ['{B75F244D-AB62-42A3-AE87-BDB9DA346871}']
    function HelloWorld(): string;
    function Hi(sName:string): string;
    function Sum(val1, val2: Double): Double;
  end;
  IRestMethods = interface(IInvokable)
    ['{4EB49814-A4A9-40D2-B85A-137DDF43C72C}']
    function HelloWorld(): string;
    function Hi(sName:string): string;
    function Sum(val1, val2: Double): Double;
  end;

            ServiceFactoryServer := fRestServer.ServiceDefine(TSystem, [ISystem], SERVICE_INSTANCE_IMPLEMENTATION);
            ServiceFactoryServer := fRestServer.ServiceDefine(TRestMethods, [IRestMethods], SERVICE_INSTANCE_IMPLEMENTATION);

authorization is base on method, now , the conflict coming as you can imagine.

#5 Re: mORMot 1 » post param via form-data signature problem » 2017-09-22 08:56:01

{"CustomResult":{"ResultCode":200,"ResultStr":"Awesome","ResultArray":["str_0","str_1","str_2"],"ResultTimeStamp":"2017-09-22T11:18:34"}}

pass.

which confuse me is : array or object ?

#6 Re: mORMot 1 » post param via form-data signature problem » 2017-09-22 08:38:22

function Sum(val1, val2: Double): Double;
[2,1]  ,   {"val2":2,"val1":1}

function SendCustomRecord(const CustomResult: rCustomRecord): Boolean;
[{"ResultCode":200,"ResultStr":"Awesome","ResultArray":["str_0","str_1","str_2"],"ResultTimeStamp":"2017-09-22T11:18:34"}]

how would i Name the parameter "CustomResult"  in Json Parameter  ,like Method sum ?

#7 Re: mORMot 1 » post param via form-data signature problem » 2017-09-22 01:51:58

sending a json work well.

there was a sector "Sending a JSON object" , it was suppose as a optional but necessary .

on web client , they should trans all the form data to json object ?

#8 mORMot 1 » post param via form-data signature problem » 2017-09-21 09:58:52

linbren
Replies: 6

I am using George's demo as server, postman as client.
while the url as below work well.
http://localhost:777/service/RestMethod … f6fcaf8d51

however
http://localhost:777/service/RestMethod … c070a52f89
and params send via form-data or other way but in url
get a 403 result .

question is :  how to get the signature on way 2 , in this way , i think the server did not received the params .

#9 mORMot 1 » method call by TIdhttp or TNethttpclient. » 2017-09-20 09:58:39

linbren
Replies: 1

I'd like to know if there is a easy way to get the signature without mormot client ?

#10 Re: mORMot 1 » Unserialize JSON with complex TObjectList structure » 2017-09-13 09:35:33

			JSONObject parse = (JSONObject) JSON.parse(resp);
			JSONArray itemArray = parse.getJSONArray("items");
			for (int i = 0; i < itemArray.size(); i++) {
				JSONObject item = itemArray.getJSONObject(i);
				System.out.println(item.getString("seqNo")
						+ item.getString("caseDate")
						+ item.getString("caseNumber")
						+ item.getString("court") + item.getString("amount"));
			}
{
    "total": 2, 
    "items": [
        {
            "seqNo": 1, 
            "caseDate": "2017-06-09", 
            "caseNumber": "1212", 
            "court": "court1", 
            "amount": "3.000000"
        }, 
        {
            "seqNo": 2, 
            "caseDate": "2017-06-09", 
            "caseNumber": "2233", 
            "court": "court2", 
            "amount": "12.000000"
        }
    ]
}

parse by jasonfast , no RTTI reqiured.

#11 Re: mORMot 1 » remote db access by firedac or or other language ? » 2017-09-12 01:05:17

// initialize a TObjectList-based database engine
    aServer := TSQLRestServerFullMemory.Create(aModel,'users.json',false,true);
    try
      aServer.NoAJAXJSON:=False;
      // register our IRemoteSQL service on the server side
      aServer.ServiceRegister(TServiceRemoteSQL,[TypeInfo(IRemoteSQL)],sicClientDriven).

code from sample16 ,  NoAJAXJSON were set to false,
same result , it doesn't work.

#12 Re: mORMot 1 » remote db access by firedac or or other language ? » 2017-09-11 08:01:57

{
    "fieldCount": 15, 
    "values": [
        "ID", 
        "CATEGORY_ID", 
        "TITLE", 
        "TITLE_IMG", 
        "SUMMARY", 
        "KEYWORD", 
        "IMG_CNT", 
        "CREATOR", 
        "CREATE_TIME", 
        "ORIGIN_URL", 
        "ORIGIN_AUTHOR", 
        "ORIGIN_OWNER", 
        "ORIGIN_TIME", 
        "STATUS", 
        "REMARK", 
        4, 
        66, 
        "news categroy", 
        "/upload/news/title_img/1490161680292.png", 
        "", 
        "", 
        null, 
        "admin", 
        "2017-03-22T13:48:04", 
        "", 
        "", 
        "", 
        "2017-03-22", 
        "3", 
        "", 
        10, 
        46, 
        "news", 
        "", 
        "", 
        "", 
        null, 
        "admin", 
        "2017-05-17T17:57:29", 
        "", 
        "", 
        "", 
        null, 
        "1", 
        ""
    ], 
    "rowCount": 2
}

the server return json as above , seem not a normal json format.

#14 mORMot 1 » remote db access by firedac or or other language ? » 2017-09-11 00:49:40

linbren
Replies: 5

remote db server created by TSQLDBServerHttpApi , could it be connect by firedac or other language (java ,scala, python ... ) ?

#15 Re: mORMot 1 » Unserialize JSON with complex TObjectList structure » 2017-09-08 08:19:17

@Chaa which version you are using ?

raising error ... Invalid variant op

#16 Re: mORMot 1 » any necessary to implement Snowflake-IdWorker for global unique ID ? » 2017-09-08 00:58:16

it is fast for sure .
"too long" , the reason is for cross language  as you wroted.

hexadecimal  is a string can not be saved as int in database.

#17 mORMot 1 » [dcc32 Warning] W1029 Duplicate constructor » 2017-09-07 09:05:47

linbren
Replies: 1
[dcc32 Warning] W1029 Duplicate constructor 'ESynException.CreateLastOSError' with identical parameters will be inacessible from C++
[dcc32 Warning] W1029 Duplicate constructor 'TSQLRecord.CreateAndFillPrepare' with identical parameters will be inacessible from C++
[dcc32 Warning] W1029 Duplicate constructor 'TSQLRecord.CreateAndFillPrepareJoined' with identical parameters will be inacessible from C++
[dcc32 Warning] W1029 Duplicate constructor 'TSQLRecord.CreateAndFillPrepareMany' with identical parameters will be inacessible from C++
[dcc32 Warning] W1029 Duplicate constructor 'TSynSQLTableDataSet.CreateOwnedTable' with identical parameters will be inacessible from C++
[dcc32 Warning] W1029 Duplicate constructor 'ESynException.CreateLastOSError' with identical parameters will be inacessible from C++
[dcc32 Warning] W1029 Duplicate constructor 'TSQLRecord.CreateAndFillPrepare' with identical parameters will be inacessible from C++
[dcc32 Warning] W1029 Duplicate constructor 'TSQLRecord.CreateAndFillPrepareJoined' with identical parameters will be inacessible from C++
[dcc32 Warning] W1029 Duplicate constructor 'TSQLRecord.CreateAndFillPrepareMany' with identical parameters will be inacessible from C++
[dcc32 Warning] W1029 Duplicate constructor 'TSynSQLTableDataSet.CreateOwnedTable' with identical parameters will be inacessible from C++

such Warnings were appeared , how to avoid them ?

#18 Re: mORMot 1 » Unserialize JSON with complex TObjectList structure » 2017-09-07 07:48:39

serializing seem work pretty good, difficult part is deserializing  smile

#19 Re: mORMot 1 » any necessary to implement Snowflake-IdWorker for global unique ID ? » 2017-09-07 07:33:02

generate 100000000 ids  cost => Gettickcount: 5320 ms.
can't not believe that fast .
--
it got 19 digits ,like 3231448769769799708 . a little too long;

#20 Re: mORMot 1 » Unserialize JSON with complex TObjectList structure » 2017-09-07 00:15:56

I was try to use TObjectList<T> generic version ,  can not find a way to register the class T .
I suppose that , if there is a way to notice the framework which CLASS to convert , that must be work .
generic type is a trend ..

#21 Re: mORMot 1 » Unserialize JSON with complex TObjectList structure » 2017-09-06 10:06:49

in current version , it is still need use array  instead of the TObjectList for storing the array?

#22 Re: mORMot 1 » use ObjectToJSON convert TDATETIME to json , get a 'T' char in string » 2017-09-06 00:26:52

I'd like to have one more option such like [woDateTimeSimple] .
they are many conveniences  while there are fields defined as TDATETIME in database .

#23 Re: mORMot 1 » use ObjectToJSON convert TDATETIME to json , get a 'T' char in string » 2017-09-05 07:18:57

sorry for break the rule .

while i don't need the 'T' here, how to avoid it ?

#24 mORMot 1 » use ObjectToJSON convert TDATETIME to json , get a 'T' char in string » 2017-09-05 02:07:33

linbren
Replies: 5
procedure TfmlJson.btnO2JClick(Sender: TObject);
var
  TestObj:TMyTest;
  s:RawUTF8;
begin
  TestObj:=TMyTest.Create;
  TestObj.ITEM_ID:=1;
  TestObj.ITEM_NAME:='mainItem';
  TestObj.MyDate:=Now;
  TestObj.AddChild(11,'subItem11');
  TestObj.AddChild(12,'subItem12');
  Memo1.Lines.Add( ObjectToJSON(TestObj,[woHumanReadable,woDontStoreDefault,woObjectListWontStoreClassName]));
  TestObj.Free;
end;
==================
{
	"ChildList": 
	[{
			"CHILD_ID": 11,
			"CHILD_NAME": "subItem11"
		},{
			"CHILD_ID": 12,
			"CHILD_NAME": "subItem12"
		}
	],
	"ITEM_ID": 1,
	"ITEM_NAME": "mainItem",
	"MyDate": "2017-09-05T10:03:14"
}
{
	"ChildList": 
	[{
			"CHILD_ID": 11,
			"CHILD_NAME": "subItem11"
		},{
			"CHILD_ID": 12,
			"CHILD_NAME": "subItem12"
		}
	],
	"ITEM_ID": 1,
	"ITEM_NAME": "mainItem",
	"MyDate": "2017-09-05T10:03:34"
}
{
	"ChildList": 
	[{
			"CHILD_ID": 11,
			"CHILD_NAME": "subItem11"
		},{
			"CHILD_ID": 12,
			"CHILD_NAME": "subItem12"
		}
	],
	"ITEM_ID": 1,
	"ITEM_NAME": "mainItem",
	"MyDate": "2017-09-05T10:03:35"
}
{
	"ChildList": 
	[{
			"CHILD_ID": 11,
			"CHILD_NAME": "subItem11"
		},{
			"CHILD_ID": 12,
			"CHILD_NAME": "subItem12"
		}
	],
	"ITEM_ID": 1,
	"ITEM_NAME": "mainItem",
	"MyDate": "2017-09-05T10:03:35"
}

===="MyDate": "2017-09-05T10:03:35"
here 'T' in the middle. what happen ?

#25 Re: mORMot 1 » any necessary to implement Snowflake-IdWorker for global unique ID ? » 2017-09-05 00:42:25

could be work like this :
        IdWorker worker1 = new IdWorker(1);  //process(thread) 1
        System.out.println(worker1.nextId());

        IdWorker worker2 = new IdWorker(2);  //process(thread) 2
        System.out.println(worker2.nextId());

#27 Re: mORMot 1 » where is the samples for components in mORMot ? » 2017-08-30 07:32:44

I'd like to manage my Forms(frames) like google chrome .

#28 Re: mORMot 1 » where is the samples for components in mORMot ? » 2017-08-30 00:42:37

it is not work .
i suppose it must be  in vcl application .

#29 Re: mORMot 1 » where is the samples for components in mORMot ? » 2017-08-30 00:32:58

does TSynPager  and TSynPage  work well under delphi multi-device application ?

#30 mORMot 1 » where is the samples for components in mORMot ? » 2017-08-29 02:03:13

linbren
Replies: 6

there are a bunch components which are designed as invisible(pager ribbon toolbar tab ... ), where can I found the demos ?

#33 mORMot 1 » TDocVariant raise a memory leak exception. » 2017-08-24 02:55:36

linbren
Replies: 3

function testMormetJson():string;
var
  jo: Variant;
  i: Int64;
  sTemp:string;
begin
  TDocVariant.New(jo);
  i := 0;
  while i < 10 do
  begin
    jo.Name := 'This is a Str' + IntToStr(i);
    jo.Age := i;
    jo.List := _JSon('[1,"Hello",5,{"name":"c5soft","age":50}]');
    sTemp:=sTemp+VariantSaveJSON(jo)+#13#10;
    inc(i);
  end;
  result:=sTemp;
end;
////////////////////////////
well , this code is from somewhere ...
there is a "new" , no "free" found.
I can not find a method of "free" from TDocVariant .

#34 Re: mORMot 1 » Record generator tool » 2017-08-16 07:57:33

thans to @edwinsn .

however , it seem too much rough to be a tool .

#36 Re: mORMot 1 » does mORMot application work together on three or more servers ? » 2017-08-16 07:32:12

understand.

IP routing were limited , e.g.  communication required between sessions , session A on server one , session B on server two ,  they does not know each other .

or more simply question : how many clients on our distributed system ?

we got a project which using java framework -- spring , sessions were maintain in Redis , it work pretty good .

#37 mORMot 1 » any possible that mORMot Framework be acquired by embarcadero someday » 2017-08-16 04:15:58

linbren
Replies: 12

anydac were merged into DELPHI IDE .

if the day comming , what will ab do ?

#38 Re: mORMot 1 » Record generator tool » 2017-08-16 01:47:00

code.google.com cannot access in china , may i get this tool on github ?

#39 Re: mORMot 1 » does mORMot application work together on three or more servers ? » 2017-08-16 01:16:39

what we mean is : does mORMot support distributed deployment ?

#40 mORMot 1 » does mORMot application work together on three or more servers ? » 2017-08-16 01:07:50

linbren
Replies: 6

does mORMot application work together on three or more servers ?
in many case , the service were required more than 1,000,000 times within one second, therefore one server cannot be handle the requires .
any solution for this ? sessions handle need be considered.
could I found the samples somewhere ?

Board footer

Powered by FluxBB