#2 mORMot 1 » Mormot Http Client like Indy » 2018-06-05 11:06:42

hkcity1111
Replies: 2

Hi all,

We usually mormot rest server . I want to post data to external web api inside mormot rest server.
I usually use indy http client. Is there any class mormot to do this purpose as well?
Thanks

Regards,
  Kenneth

#4 mORMot 1 » Retrieve session id if using sicPerSession in interface based service » 2015-05-24 16:23:48

hkcity1111
Replies: 2

Hi all,

I found that there will be a field called "id" returned ( 786998398 in the following json sample) in json if using sicPerSession in calling interface interface based service.
As I want to keep track of user behavior, Can I retrieve session id like "id" within calling interface based service such as in the area of
ServiceContext.Request.Call.InHead?

Thanks for your advice.

Regards,
  Kenneth

JSON example
e.g

{
	"result" : {
		"success" : true,
		"msg" : "",
		"data" : []
	},
	"id" : 786998398
}

#5 Re: mORMot 1 » Question using TOleDBMSSQLConnectionProperties in Window 2008 Server » 2015-01-31 00:56:23

thanks, this come from driver issue and no problem after installation

#6 mORMot 1 » Question using TOleDBMSSQLConnectionProperties in Window 2008 Server » 2015-01-13 03:57:47

hkcity1111
Replies: 4

Hi all

I am using Delphi XE and compile into exe or service and install into window 2008 64 bit server
I got the following some error about "Class not registered" in log using TOleDBMSSQLConnectionProperties
I try to create udl with "Microsoft OLE DB Provider for SQL Server" to test connection without problem
I use window 7 32 bit without any problem.
Is it related to 32 bit driver?

Do anyone encounter this problem and any suggested solution/further checking?
Thanks a lot!

TOleDBConnection(0208A140).00639B42 
	EOleSysError 80040154 ("Class not registered") at 00592DE9  stack trace 0063EABC 0040495A 00407820 00407A83 00586D7F 0058A068 770A33B5 770A3322 770A3337 766674A8 778F3CD3 778F2CAF 778F3CD3 00406398 00406398 00587D10 0056520E 00565360 00568467 00404976 
	"EOleSysError(020F9278)":"Class not registered" stack trace API 00511FEC 00639CC1 0063EABC 00586D7F 
	EOleSysError 80040154 ("Class not registered") at 00592DE9  stack trace 0040495A 00407820 00407A83 00586D7F 0058A068 770A33B5 770A3322 770A3337 766674A8 778F3CD3 778F2CAF 778F3CD3 00406398 00406398 00587D10 0056520E 00565360 00568467 00404976 004078BD 

Regards,
  Kenneth

#7 Re: mORMot 1 » Serialization of object which implement generics » 2014-08-27 03:08:07

Thank ab. Finally I use this method to output for my json structure

    procedure Get(const id: integer; out success: boolean; out msg: string; out data: RawJSON);

#8 Re: mORMot 1 » Serialization of object which implement generics » 2014-08-27 01:00:08

I will try to your suggested approach. Thank for your advice

#9 mORMot 1 » Serialization of object which implement generics » 2014-08-26 12:34:54

hkcity1111
Replies: 4

Dear all,

I want to create service of TServiceCoupon and implement TServiceCoupon.Get to return Json result of TResponseJson<TSQLCouponMst>
But during runtime, I got the exception "unexcepted type TResponseJson<DataMode.TSQLCouponMst> - use TJONSerializer.RegisterCustomSerializer()
I think I got something wrong in coding/definition and no need to write custom serializer.
Would anyone have any comment for my thinking?
Thank a lot!

Regards,
  HK City

  TResponseJson<T: class> = class (TObjectList<T>)
  private
    Fdata: TObjectList<T>;
    Fsuccess: boolean;
    Fmsg: String;
    procedure Setdata(const Value: TObjectList<T>);

  published
    constructor Create;
    property success : boolean read Fsuccess write Fsuccess;
    property msg : String read Fmsg write Fmsg;
    property data: TObjectList<T> read Fdata write Setdata;
  end;

  TSQLCouponMst = class(TSQLRecord)
  protected
    fidCouponMst: Int64;
    fshopName: RawUTF8;
    fcouponDesc: RawUTF8;
    feffDateDesc: RawUTF8;
    fcouponFileName: RawUTF8;
    fcrtDate: TDateTime;
    fcrtBy: RawUTF8;
  published
    property idCouponMst: Int64 read fidCouponMst write fidCouponMst;
    property shopName: RawUTF8 index 50 read fshopName write fshopName;
    property couponDesc: RawUTF8 index 200 read fcouponDesc write fcouponDesc;
    property effDateDesc: RawUTF8 index 50 read feffDateDesc write feffDateDesc;
    property couponFileName: RawUTF8 index 50 read fcouponFileName write fcouponFileName;
    property crtDate: TDateTime read fcrtDate write fcrtDate;
    property crtBy: RawUTF8 index 50 read fcrtBy write fcrtBy;
  end;

  TServiceCoupon = class(TInterfacedObject, ICoupon)
  public
    procedure Get(const id: integer; out response : TResponseJson<TSQLCouponMst>);
  end;

#10 Re: mORMot 1 » Receive Json by Calculator Sample » 2014-08-26 12:13:19

Thank you for your enhancement. It is great!

#11 Re: mORMot 1 » Receive Json by Calculator Sample » 2014-08-21 01:59:14

I use weak authorization by "Javascript authentication" in the forum before.
If I got the fixing in javascript,  I will post here. Thanks!

#12 Re: mORMot 1 » Receive Json by Calculator Sample » 2014-08-18 11:46:06

Thank for your advice and I use json array as input and use several json objects within array.
Previously I sometime use dot.net to create service because the coding is very short
and now I can use delphi mORMot and the coding is very short too.
Very good framework and useful to me. : )
Thanks!

#14 mORMot 1 » Receive Json by Calculator Sample » 2014-08-18 06:49:41

hkcity1111
Replies: 12

Dear all

I am new first comer for mORMot. I want to ask how to post json to http interface service by Calculator by javascrpt.

The following is sample but it got { "ErrorCode":400, "ErrorText":"Bad Request" } by the following coding.
If I change data : [4,5] , then result will be return sucessfully.
How can I amend in mORMot contract/service to achieve result or any existing reference to this
Sorry for my stupid question.

Thanks a lot!

      var dataString = { n1 :4, n2 :5};
      $.ajax({ 
        type : 'POST',
        url: "http://localhost:888/"+SessionSign("root/Calculator.Add"), // JQuery loads 
	data : JSON.stringify(dataString),		
        dataType: 'json', 
        contentType : 'application/json',
        success: function(data) 
        {
          alert("url was signed OK");
        }
      });

Regards,
  HK City

Board footer

Powered by FluxBB