#1 2023-02-07 12:07:15

itSDS
Member
From: Germany
Registered: 2014-04-24
Posts: 516

Error 400 Invalid URI calling SOA Function

Hi Arnaud,

with yesterday tests i experience an Error 400 calling SOA Functions.

This Error comes not with Version 4496 but exists with Version 4665.
Sry the Repository Version between this 2 i don't have.

If you need more input I'll try to provide it.


Rad Studio 12.1 Santorini

Offline

#2 2023-02-07 12:11:34

itSDS
Member
From: Germany
Registered: 2014-04-24
Posts: 516

Re: Error 400 Invalid URI calling SOA Function

One more Info: We use the Syncrossplatform Client from m1 to access the SOA Functions


Rad Studio 12.1 Santorini

Offline

#3 2023-02-07 13:39:52

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: Error 400 Invalid URI calling SOA Function

Try to add '/' in the beginning of all requested URI:

procedure TSQLRestClientURI.URI(var Call: TSQLRestURIParams);
...
  if (Call.Url<>'') and (Call.Url[1]<>'/') then
    Call.Url := '/'+Call.Url;
  InternalURI(Call);
...

If it is not enough, please post here the actual values of Call.Url from the client side.
And try to debug on the server side why it is not routed as expected, e.g. in TRestRouter.Lookup().

Offline

#4 2023-02-07 15:43:16

itSDS
Member
From: Germany
Registered: 2014-04-24
Posts: 516

Re: Error 400 Invalid URI calling SOA Function

Hi Arnaud, i see TRestRouter.Lookup is new

There is the Problem, it does not find my Function (GetStammdaten) But Stammdaten is in the tree under Get (GetStammdaten, GetArtikel, ...) i have 4 Methods starting with get.

The Value of Call URL is : 'LSYSConnector/DFLSYSConnector.GetStammdaten?session_signature=000e153ce78f9d46a320304d'

Last edited by itSDS (2023-02-07 15:49:16)


Rad Studio 12.1 Santorini

Offline

#5 2023-02-07 15:53:40

itSDS
Member
From: Germany
Registered: 2014-04-24
Posts: 516

Re: Error 400 Invalid URI calling SOA Function

Here is the matching RadixTree:

https://postimg.cc/zHr9fz6V

May be the Backslash at stammdaten/ ?!

Last edited by itSDS (2023-02-07 15:54:27)


Rad Studio 12.1 Santorini

Offline

#6 2023-02-07 16:13:19

itSDS
Member
From: Germany
Registered: 2014-04-24
Posts: 516

Re: Error 400 Invalid URI calling SOA Function

Trying to add / at the Beginning does not work. On Server lsysconnector/timestamp -> //lsysconnector/timestamp if i add your code sample.


Rad Studio 12.1 Santorini

Offline

#7 2023-02-07 18:06:51

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: Error 400 Invalid URI calling SOA Function

The tree seems correct: you need to look at FullUrl field to see the actual URI.
Because at each node level, you only have the new text in Chars[].
So there is a 'get' node, with 'stammdaten' sub-node for 'getstammdaten' URI.

Offline

#8 2023-02-07 18:15:19

itSDS
Member
From: Germany
Registered: 2014-04-24
Posts: 516

Re: Error 400 Invalid URI calling SOA Function

You can see the fullurl in the bottom line of my Screenshot.
There is a slash at the end. That's the reason why Lookup fails. In Requested URL is no slash at the end but ?session...
In the former Version 4495 the String was accecpted.

I think it's a missing feature in new Lookup Method - what do you think ?

Last edited by itSDS (2023-02-07 18:18:05)


Rad Studio 12.1 Santorini

Offline

#9 2023-02-07 18:38:05

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: Error 400 Invalid URI calling SOA Function

Where does this trailing '/' come from?

On my side,  TRestServerRoutingRest.UriComputeRoutes register the routes with no trailing /

Please post on a gist your full tree content:
You can just uncomment line 6829 of mormot.rest.server - writeln(r.Tree[mPOST].ToText);

For instance, here is a tree during SOA regression tests: https://gist.github.com/synopse/8b994c0 … 1dce6296eb

Offline

#10 2023-02-08 08:14:31

itSDS
Member
From: Germany
Registered: 2014-04-24
Posts: 516

Re: Error 400 Invalid URI calling SOA Function

Here is the Tree:

lsysconnector/
              dflsysconnector
                             /
                              get
                                 a
                                  usgabemengen/
                                               <clientid>
                                  rtikel/
                                         <clientid>
                                 stammdaten/
                                            <clientid>
                                 inventur/
                                          <clientid>
                                 belege/
                                        <clientid>
                              sende
                                   inventur/
                                            <clientid>
                                   artikel/
                                           <clientid>
                                   belege/
                                          <clientid>
                              druckeb
                                     arcode/
                                            <clientid>
                                     eleg/
                                          <clientid>
                              _
                               free_/
                                     <clientid>
                               instance_
                               contract_
                             .
                              get
                                 a
                                  usgabemengen/
                                               <clientid>
                                  rtikel/
                                         <clientid>
                                 stammdaten/
                                            <clientid>
                                 inventur/
                                          <clientid>
                                 belege/
                                        <clientid>
                              sende
                                   inventur/
                                            <clientid>
                                   artikel/
                                           <clientid>
                                   belege/
                                          <clientid>
                              _
                               free_/
                                     <clientid>
                               contract_
                               instance_
                              druckeb
                                     arcode/
                                            <clientid>
                                     eleg/
                                          <clientid>
              cacheflush
                        /
                         <fulluri>
              wrapper
                     /
                      <fulluri>
              batch

Rad Studio 12.1 Santorini

Offline

#11 2023-02-08 08:24:13

itSDS
Member
From: Germany
Registered: 2014-04-24
Posts: 516

Re: Error 400 Invalid URI calling SOA Function

Here the deklaration part

  IDFLSYSConnector = interface(IInvokable)
    ['{DCBB296A-C209-4346-BD37-4496E32A50BE}']
    function GetStammdaten(const AAuthToken : RawUtf8; const AGeaendertNach : TDateTime = 0) : RStammdatenResult;
...

Rad Studio 12.1 Santorini

Offline

#12 2023-02-08 09:36:41

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: Error 400 Invalid URI calling SOA Function

In sicClientDriven mode?
My guess is that it should rather be in sicShared mode on server side.

Your previous code worked by chance with the cross-platform clients.
You should specify sicClientDriven also on client side, to have the trailing /<clientid> specified in the client URI.

Offline

#13 2023-02-08 12:35:36

itSDS
Member
From: Germany
Registered: 2014-04-24
Posts: 516

Re: Error 400 Invalid URI calling SOA Function

The Problem is only with the Syncrossplatform Client. The normal m2 Client works.
I use sicClientDriven on both Sides.

I just changed sicClientDriven on Server Side to sicShared, and the Error is gone.
Are there any things i have to change on the Server now ?
Is this the right way - Change Mode on Server ?


Rad Studio 12.1 Santorini

Offline

#14 2023-02-08 14:05:38

itSDS
Member
From: Germany
Registered: 2014-04-24
Posts: 516

Re: Error 400 Invalid URI calling SOA Function

Sry i have to add this, i read the Doku for sicShared / sicClientDriven again.
I need sicClientDriven on the Server Settings, my Server Implementation affords this. There are Client specific var i share between all "Client" requests. The Server Implmentation is needed for every client.

Do i have to provide the Client ID now in SynCrossplatformclient ? and how ?


Rad Studio 12.1 Santorini

Offline

#15 2023-02-08 14:19:39

itSDS
Member
From: Germany
Registered: 2014-04-24
Posts: 516

Re: Error 400 Invalid URI calling SOA Function

Now i checked the URL called from one of the m2 client and you add e.g. stammdaten/1?session_ .. as ClientID to the request where is this clientid generated ? i think it should be on the Server or ?


Rad Studio 12.1 Santorini

Offline

#16 2023-02-08 18:28:15

itSDS
Member
From: Germany
Registered: 2014-04-24
Posts: 516

Re: Error 400 Invalid URI calling SOA Function

Hi Arnaud,

what should i do now.
I have to use SynCrossplatformclient on my App - Client Side (it is the only client i have atm). But i have to use it with sicClientDriven on Client and Server side. (or am i wrong ?)
You have enhanced m2 with a clientID. But i don't know how to enhance Syncrossplatformclient to use/get it.

atm im lost here ?!


Rad Studio 12.1 Santorini

Offline

#17 2023-02-08 19:09:30

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: Error 400 Invalid URI calling SOA Function

And it works by chance/error before in your case: without any /<clientid> the server does not know which server instance to use, so it should reject it.
As the new code does.

Try to look on the client side why the /<clientid> trailer is not transmitted to the server.
Perhaps the mORMot 1 cross-platform client does not make what is required.

In sicClientDriven mode, the clientid is a number returned by the server when /_instance_ is called.
It will identify the server class instance to use for executing the service method for this unique client.
Then, at client shutdown, in sicCLientDriven mode, the client should call /_free_/<clientid> to release the server class instance.

Offline

#18 2023-02-08 19:19:32

itSDS
Member
From: Germany
Registered: 2014-04-24
Posts: 516

Re: Error 400 Invalid URI calling SOA Function

Ok ty i have enhanced the SynCrossplatform Client to ask for instance and use Result as ClientID now.


Rad Studio 12.1 Santorini

Offline

Board footer

Powered by FluxBB