You are not logged in.
Pages: 1
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 ?
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 ?
base on @George 's demo
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.
{"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 ?
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 ?
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 ?
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 .
I'd like to know if there is a easy way to get the signature without mormot client ?
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.
// 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.
{
"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.
especially other language .
remote db server created by TSQLDBServerHttpApi , could it be connect by firedac or other language (java ,scala, python ... ) ?
@Chaa which version you are using ?
raising error ... Invalid variant op
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.
[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 ?
serializing seem work pretty good, difficult part is deserializing
generate 100000000 ids cost => Gettickcount: 5320 ms.
can't not believe that fast .
--
it got 19 digits ,like 3231448769769799708 . a little too long;
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 ..
in current version , it is still need use array instead of the TObjectList for storing the array?
I'd like to have one more option such like [woDateTimeSimple] .
they are many conveniences while there are fields defined as TDATETIME in database .
sorry for break the rule .
while i don't need the 'T' here, how to avoid it ?
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 ?
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());
AS title .
I'd like to manage my Forms(frames) like google chrome .
it is not work .
i suppose it must be in vcl application .
does TSynPager and TSynPage work well under delphi multi-device application ?
there are a bunch components which are designed as invisible(pager ribbon toolbar tab ... ), where can I found the demos ?
FreeAndNil(jo) doesn't work.
win7 64X
target 32
tokyo 10.2
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 .
thans to @edwinsn .
however , it seem too much rough to be a tool .
then , I will always be fan of mORMot .
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 .
anydac were merged into DELPHI IDE .
if the day comming , what will ab do ?
code.google.com cannot access in china , may i get this tool on github ?
what we mean is : does mORMot support distributed deployment ?
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 ?
You have to generate it by calling https://github.com/synopse/mORMot/blob/ … ainRes.bat
thank you ,
got it .
FileMain.res lost on github.
Pages: 1