You are not logged in.
Pages: 1
Thanks for your answer!
Hi!
Is that possible to serialize the given object a simple way (dump) just like RecordSaveJson?
The problem is that ObjectToJson always returns empty json if there is no properties! But I do not want any properties, I just have plain fields to serialize..
THe idea is that I want in some future switch from SuperObject to SynOpse for JSON serialization.
type
TMyClass = class
public
name: String;
value: Double;
end;
TMyRecord = record
public
name: String;
value: Double;
end;
Everything works fine with record, but never with a class.
SuperObject JSON or any other library does this without problem, but I cant get it working with SynCommons unit.
What do I miss?
1) I do not want or will descend from TSynPersistent;
2) I can't add properties/change the interfaces of the class;
3) I tried ObjectToVariant -> VariantToJson;
4) I have mORMot unit in uses list for TJSONSerializer.
Many thanks for your help!
Thank you very much for the info. It worked fine in the end when using the same encoding on .NET side, but also required minimal length of the secret key (it was too short for 256 bit token ).
Hello!
We are trying to start using the TJWTHS256 classes. But we immediately faced the issue when trying to verufy the generated tokens in ASP.NET or .NET application.
So I tried the following and that works fine in the code:
var
LToken: TJWTAbstract;
LTokenText: RawUTF8;
...
LToken := TJWTHS256.Create('The secret password', 0, [jrcIssuer, jrcSubject, jrcIssuedAt, jrcJwtID], []);
LTokenText := LToken.Compute(['http://www.ourdomain.com', True], 'Issuer', 'subject', '', 0);
Result := LToken.VerifyPayload(LTokenText, 'subject', 'Issuer', '') = jwtValid;
...
Result in the Delphi app is True. So if I understood correctly - the VerifyPayload method returns true. And also we can see in the generated token that there is a signature in the end.
But when we try to validate the given token outside of Delphi and mORMot world it always says "Invalid signature"!
For example: https://www.jsonwebtoken.io/ parses all the data, but says that the signature is not valid (that also happens in other web-sites). We tried removing the expiration claim but that does not change anything.
Can you help us with understanding what we are doing wrong?
Thank you in advance!
Should I use OnErrorURI event of the TSQLRestServer. Is that the right approach?
Just for the record it looks like that actually does the job. I just check the exception class of the event OnErrorURI parameter and if it is of my ERESTServerError then I return false and set the error from the properties of the exception.
Hi!
I am using your HTTPServer for providing REST access to the API of a certain system. All is fine, but I can't figure out how can I do one thing.
So I was using the Sample 14 for the start. So I do TInterfaceFactory.RegisterInterfaces([TypeInfo(IMyInterfaceName)]) and so on (so create the TSQLModel, TSQLRestServerFullMemory and TRestHTTPServer.
When I have the method like UserDisplayInfo(ID: Integer): TUserDisplayInfo then I get the response with 200 OK and the JSON of the record which is all fine.
But when the user is not found by the ID we wish to return the response code 404 (for example) or some other code accordingly to the standard..
How that can be done?
I thought first that maybe SynXXX has some kind of raise ESynHTTPErrorCode.Create(AErrorCode: Cardinal; AMessage: String)... but when I look at handling of the Request method of the HTTP server I see that the responses are kind of hard-coded. And I can only override them if I override the Request method - which actually is not so convinient probably..
Thanks in advance!
Hi!
Do you have any possibility to generate the ORM classes for an existing MS SQL Server database tables?
I checked out samples 12 - SynDBExplorer... but after I got connected to the DB the form was a bit strange (empty list of tables and objects), executing SQL raised class not registered.. and after I closed the app and started it again choosing the configured MSSQL connection I got a Class not registered error on line
Props.ForeignKeysData := UncompressString(C.ForeignKeys); in function TryConnect.
Thanks in advance.
OK, thanks for letting me now that.
Yes, thanks. I just did that.. But that wasn't obvios for me as I even forgot that I have SynopsePDF installed..
By the way TestSQL3.dpr fails on PDF tests..
I have removed the old SynPDF folder at all.
I have installed the SynPDF library before... and the INC file was conflicting with the one in the mORMot.
So I managed that..
Hi!
I am new user for the mORMot framework. So I downloaded (latest sources) your library [b8275632e2] as instructed and tried to check samples I am interested in.
And in the manual it is described that I can build and run TestSQL3.dpr but it fails with the error:
[dcc32 Error] mORMotHttpClient.pas(433): E2003 Undeclared identifier: 'TSQLHttpClientWinHTTP'
I am using Delphi XE7 Update 1.
When trying to compile samples I get another error:
[dcc32 Error] SynLog.pas(328): E2003 Undeclared identifier: 'TSynPersistentLocked'
What do I do wrong (except choosing the developer job )?
Thanks in advance!
Pages: 1