Hi,
We try to connect to a XData serice developed by us using an XDataWebClient in a WebCore TMS app.
After struggling with a lot tests and using your documentation (rawinvoke method) we discovered inside unit XData.Web.Client folowing code!
{ TXDataWebClient }
procedure TXDataWebClient.Delete(const EntitySet: string; Entity: TJSObject;
const RequestId: string);
begin
end;
procedure TXDataWebClient.Get(const EntitySet: string; Id: JSValue;
const RequestId: string);
begin
end;
procedure TXDataWebClient.Get(const EntitySet, QueryString: string; Id: JSValue;
const RequestId: string);
begin
end;
procedure TXDataWebClient.List(const EntitySet, Query, RequestId: string);
begin
end;
procedure TXDataWebClient.Notification(AComponent: TComponent;
Operation: TOperation);
begin
inherited;
if (Operation = opRemove) and (AComponent = FConnection) then
Connection := nil;
end;
procedure TXDataWebClient.Post(const EntitySet: string; Entity: TJSObject;
const RequestId: string);
begin
end;
procedure TXDataWebClient.Put(const EntitySet: string; Entity: TJSObject;
const RequestId: string);
begin
end;
procedure TXDataWebClient.RawInvoke(const OperationId: string;
Args: array of JSValue; const RequestId: string);
begin
end;
IS this a joke?
Practically you haven't implemented any of the methods we hoped we can use un web apps developed using your webcore components.
Please tell us what to do in order to consume our webservices (TMS servers) inside webcore apps.
My TMS setup is looking for XData.Web.Client.pas under: D:\ddev_global\TMSSoftware\TMS XData\source\core
where D:\ddev_global\TMSSoftware\ is the TMS general path.
Apparently the right file should be under:
TMSSoftware\TMS WEB Core RSXE14\Core Source\XData\
for Delphi Alexandria?
What should I do to make it use this instead of XData path?
Shouldn't the TMS installer do this automatically?
And the installer registers the following paths in Library path:
d:\ddev_global\TMSSoftware\TMS WEB Core RSXE14
d:\ddev_global\TMSSoftware\TMS WEB Core RSXE14\Win32
d:\ddev_global\TMSSoftware\TMS WEB Core RSXE14\Component Library Source
I think Win32 is possibly compiled from Core Source. Don't forget that the actual compiling isn't a normal Delphi compile but is built through Pas2JS, so this possibly has it's own paths set.
When you compile a TMS WEB Core app with the pas2js compiler, the library path for this pas2js compiler configured under Tools, Options, TMS WEB is used.
And in this path should be \Core Source\XData
There is no error.
It simply doesn't work because it uses "fake" unit from ...\TMS XData\source\core instead of ...\TMS WEB Core RSXE14\Core Source\XData\ where indeed it is the actual implementation.
I added the path as Bruno said in the Library path for TMSWebCore but it still uses the XDATA path because it has precedence.
Thank you @brunofierens your reply.
I finally understand the way it works.
You use the functions declarations only units in order to allow XData to work and be compiled as standard VCL/FMX apps from Delphi.
In fact, at JS conversion step (compiling web app), for an Web Core App you replace the global Library path declarations with ones from TMS Web Tab, the JS right ones.
Thank you @Weetch_Russell too for explaining that. It took some time until I understood what you where saying.
It finally worked after adding the Core Source\XData\ path to TMS Web tab in Tools/Options.
We could successful connect to our XData service for authentication and retrieve the JWT Token we use for further calls.
But now we encounter a different problem regarding accessing the XData Service.
At WebFormCreate we use following code:
When using local server everything works fine, but when we use the production https connected server it raises "Error connecting to XData server" error.
The service is in use and functions well with all VCL XData Clients, so I cannot suspect any https certificate problem.
In browser we found the following error:
It looks like you should properly configure CORS in your server to allow requests from web applications running in other domains. Here is a small reference:
index.html:1 Access to XMLHttpRequest at 'https://argus.magister.ro/auth/$model' from origin 'http://localhost:8000' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header contains multiple values '*, *', but only one is allowed.
Is there anything we can do to disable CORS check?