Several problem with the XData web server wizard

Hello,


I'm not sure what I'm doing wrong, really, but it seems that the XData web server wizard - a truely excellent idea - behaves strangely, at least for me.

I have created a simple Xdata server (v 4.0.0.0) for an existing MSSQL database. It has a few tables available in read-only (GET, LIST) and a simple service.

The server works, as far as I can tell: I can call the service functions and the CRUD operaitions works from a browser.

I then used the Xdata web app wizard to generate a TMS Web application (V1.0.5.3) but the application does not work.

Initially, I get a truely weird compilation error: "[Error] View.t_files.List.pas(39): identifier not found "TExtendedField"". I can fix this by removing the field in question and adding it again: it gets create as a TLargeIntField (it's a bigint in the database).

After changing this, i can compile, but the application fails to work. All I get when I browse to the index is "Error connecting to XData server: http://localhost:2001/gitcloud/PDFBeamer/$model"

I then tried to open the ConnectonModule.pas unit to try rto auto-enable the connections and, once I do that, I get a problem: there is a AuthConnection (TXDataWebConnection) component defined in the class that doesn't exist in the corresponding DFM. If I remove the reference, then the application fails to compile "[Error] Auth.Service.pas(73): identifier not found "AuthConnection"". If I leave it, I guess it will AV as soon as a TAuthService instance is created.

Any suggestion about what I'm doing wrong?

Hi Stephane,


it's always a good idea to check the browser console for more detailed information about what's going on with the web application. I suspect it's a CORS issue.
Enable CORS in your XData server and the error will probably go away.
Or simply use the same domain in your XData server as used in your web application (probably localhost, port 8000, something like http://+:8000/tms/xdata).

Wagner

Thank you. Setting CORS let the application work.


Any suggestiong about the missing AuthConnection  component?

The AuthConnection is just a left over from a clean up of the template source code that generates the app. It doesn't affect the application. You should not use AuthService, since the generated app still doesn't support authentication automatically (you have to manually add it yourself).

Ok, thank you.