Jump to content
Ubaltino

SMS 3 + mORMot = Error

Recommended Posts

I downloaded the latest version of SMS recently. I have tested all the examples. Really enjoyed.

I've been using mORMot for some time. And I'd like to use the two built-in ones. In this link http://blog.synopse.info/post/2014/08/11/CrossPlatform-Clients/SmartMobileStudio AB gives the steps needed to use mORMot with SMS. But unfortunately it is not working any more in the last versions. The errors were commented on this link https://synopse.info/forum/viewtopic.php?id=4744

I requested this correction for the AB, but apparently he is out of time at the moment.

Could anyone here give a force and put it to work?

Thank you.

 

Share this post


Link to post
Share on other sites

The crazy AB apparently he's out of the time or holidays since december. I do perform the tests on the mORMot lastest trunk (december/2018) and it compiles and works in both SMS 2.2.2.04694 (the lastest WinXP compatible) and SMS 3.1.0.80 (development version)! I have to download mORMot again(jan/2019) and submit the changes of the SynCrossPlatform units to AB.

 

Share this post


Link to post
Share on other sites
16 minutes ago, warleyalex said:

The crazy AB apparently he's out of the time or holidays since december. I do perform the tests on the mORMot lastest trunk (december/2018) and it compiles and works in both SMS 2.2.2.04694 (the lastest WinXP compatible) and SMS 3.1.0.80 (development version)! I have to download mORMot again(jan/2019) and submit the changes of the SynCrossPlatform units to AB.

 

Okay. I'll be waiting for an answer here, so I can test both with the latest versions.

Thank you.

Share this post


Link to post
Share on other sites

I download the mORMot_and_Open_Source_friends_234301_06b24ae728 today and patched some needed SynCrossPlatform units and mORMotWrappers (generate mORMot cross-platform clients code from the server). and some changes at the project 27 and 29,

Now, it compiles and works in both SMS 2.2.2.04694 (lastest WinXP compatible) and SMS 3.1.0.80 (development version)! 

download link: mORMot with SMS 2x and 3x

Share this post


Link to post
Share on other sites

Hi Mr. Warleyalex, i'm trying the new 3.9.1.167 version of the SMS, with the latest version (12/2019) of MORMOT and i see that the GetClient wrapper fuction generated don't work.

There is some problem on the SetUser function. The same code is full working on a 3.0.2.20 version on SMS.

Do you have some updates for the wrappers on Mormot?

Thanks in advance for your help.

Cristiano.

Share this post


Link to post
Share on other sites
On 2/14/2020 at 8:51 PM, dottor_j said:

I tested better. The problem is in the SMS Browser, only in this doesn't work, if i start the default browser it works fine.... Could be a bug of the SMS Browser.

Thanks.

Do you guys have any advice on how I could help? I myself don't have any mORMot servers that I could use to test against. However, I'd love to get familiar with this and eliminate the problem with the SMS Browser.

 

Share this post


Link to post
Share on other sites

You can download it from https://synopse.info/fossil/wiki?name=Downloads, file is mORMotNightlyBuild.zip.

Unpack somewhere and copy units from CrossPlatform dir to SMS libraries dir.

Now you can try some code, 

go to SQLite3\Samples\27 - CrossPlatform Clients, compile in Delphi Project14ServerHttpWrapper

run once as admin compiled Project14ServerHttpWrapper.exe, this will register it as a handler within http.sys 

now start Project14ServerHttpWrapper.exe as normal user and leave it running.

go to http://localhost:8888/root/wrapper, download SmartMobileStudio client unit

copy downloaded mORMotClient.pas to Samples\27 - CrossPlatform Clients\SmartMobileStudio

now compile "27 - CrossPlatform Clients\SmartMobileStudio\Project14Client.sproj in" SMS

run it with F9, press Server connect, it should give an error

now try it in Chrome http://127.0.0.1:8090/index.html, and it should work

 

Share this post


Link to post
Share on other sites

@IgorSavkicThank you for the great instructions. I was able to download, compile and run Project14ServerHttpWrapper, but ran into problems after that.

On 2/16/2020 at 7:28 PM, IgorSavkic said:

go to http://localhost:8888/root/wrapper, download SmartMobileStudio client unit

copy downloaded mORMotClient.pas to Samples\27 - CrossPlatform Clients\SmartMobileStudio

GetClient in the downloaded version of mORMotClient.pas differs from the original one that is included in mORMot:

//OLD one:
procedure GetClient(const aServerAddress, aUserName,aPassword: string;
  onSuccess, onError: TSQLRestEvent; aServerPort: integer=SERVER_PORT);

//NEW one:
procedure GetClient(const aServerAddress: string;
  onSuccess, onError: TSQLRestEvent;
  aServerPort: integer=SERVER_PORT; aServerRoot: string=SERVER_ROOT;
  aHttps: boolean=false);

The new one has no UserName and Password. When I remove them, I am able to compile and connect to the service. However, I run into issues with this:

XMLHttpRequest with the synchronous flag set to true is deprecated due to its impact on user-perceived site performance.

It's probably because TServiceClientAbstract.Create does a synchronous call in CallRemoteServiceInternal and CallGetResult returns an unidentified result.

  fClient.CallRemoteServiceInternal(Call,self,SERVICE_PSEUDO_METHOD[imContract],'[]');
  result := CallGetResult(Call,dummyID);

And if I ran the compiled app, I am able to reproduce the issue where the internal browser does not load the project. I'll dive into that now, but I'd really appreciate help with this synchronous-issue. @warleyalex

Share this post


Link to post
Share on other sites

> The new one has no UserName and Password. When I remove them, I am able to compile and connect to the service.

It seems you have wrong path or wrong file, check in Project14ServerHttpWrapper.dpr call to AddToServerWrapperMethod, it specifies location of mustache template for SMS, it should resolve to your mORMotUnpackDir\CrossPlatform\templates. If you're running 

mORMotUnpackDir\SQLite3\Samples\27 - CrossPlatform Clients\Project14ServerHttpWrapper.dpr those paths should match.

I'm including correct SmartMobileStudio.pas.mustache and mORMotClient files.

> However, I run into issues with this: XMLHttpRequest with the synchronous flag set to true is deprecated due to its impact on user-perceived site 

> performance.It's probably because TServiceClientAbstract.Create does a synchronous call in CallRemoteServiceInternal 

> and CallGetResult returns an unidentified result.

This has been the case from the start, but it doesn't affect working code. 
Once when browsers really remove that call it will stop working, there's no solution yet, ab from mORMot isn't using SMS anymore so someone else has to solve it.

 

SmartMobileStudio.zip

Share this post


Link to post
Share on other sites
5 hours ago, IgorSavkic said:

It seems you have wrong path or wrong file, check in Project14ServerHttpWrapper.dpr call to AddToServerWrapperMethod, it specifies location of mustache template for SMS, it should resolve to your mORMotUnpackDir\CrossPlatform\templates. If you're running  

mORMotUnpackDir\SQLite3\Samples\27 - CrossPlatform Clients\Project14ServerHttpWrapper.dpr those paths should match.

I'm including correct SmartMobileStudio.pas.mustache and mORMotClient files.

This is weird. The paths are correct in the dpr and I can connect to the server with the mORMotClient.pas that I can download from http://localhost:8888/root/wrapper

If I try the mORMotClient.pas that you attached, the login does not go through. Comparing the two files, it seems that my version just does not require any authentication. I'll attach my version of mORMotClient.pas, which works through connect but does not compute.

5 hours ago, IgorSavkic said:

This has been the case from the start, but it doesn't affect working code. 
Once when browsers really remove that call it will stop working, there's no solution yet, ab from mORMot isn't using SMS anymore so someone else has to solve it.

This is good to know.

mORMotClient.pas

Share this post


Link to post
Share on other sites
21 hours ago, IgorSavkic said:

And mustache template is equal to one I've sent? I have no idea, only to debug code and see what's going on during client wrapper creation. Here is project I have.

BTW note that your file has wrong unit name (differts to file name) but that's probably you trying something.

SmartMobileStudio.7z

Yes, the mustache template was the same. Could you also send a compiled version of the server to jt at smartmobilestudio.com?

Share this post


Link to post
Share on other sites
On 2/14/2020 at 8:51 PM, dottor_j said:

I tested better. The problem is in the SMS Browser, only in this doesn't work, if i start the default browser it works fine.... Could be a bug of the SMS Browser.

Thanks.

@IgorSavkic Thank you for the exe. I got the server running and was able to debug the issue.

The reason what the SMS Browser does not work here is due to settings. Go to IDE Settings and Internal Browser.

Then have a look at option Web Security. Click on it until you get a Check Mark or a black rectangle on it. (Black rectangle means that we'll be using Chromium's default value)

Click ok, restart the IDE and it works.

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...