XData Web components - Suggestion

TXDataWebConnection.URL must be either HTTP:// or HTTPS:// is that correct.  I've been running round trying to work out why my connection was failing.  It was connecting at design time, but not at runtime.  

At designtime, it didn't need the http, but at runtime you got an error.

Either be consistent at designtime and runtime or have the property raise a warning.

My own fault, but would have saved a while.

Cheers,

Hello Jason,

Sorry, but I don't understand what you mean. Could you please be more specific, with exact steps and error messages?

TXDataWebConnection.Url should contain the URL address of your XData server. Since it's HTTP protocol, you must specify if you're using http:// or https:// - they are considered different "addresses", as with any HTTP communication, not only with XData.


There should be no difference between design-time or runtime, besides the obvious ones: at design-time you are connecting from Delphi, at runtime you are connecting from the browser. Please indicate the error message, maybe something browser-related is preventing you from connecting to the address but you can connect from Delphi.

Hi Wagner, thank you for the reply.  

At designtime the following is fine:

object xDataWebConnection: TXDataWebConnection
  URL = 'localhost:2001/tms/xdata'
  Connected = True
  OnConnect = xDataWebConnectionConnect
  OnError = xDataWebConnectionError
  Left = 128
  Top = 8
end

But of course, at runtime the javascript in browser doesn't like it.  So I am saying, either at designtime it should fail (or warn).  For a newbie I couldn't see why it wasn't working at runtime.

Hope that makes more sense.
Jason.

Hi Jason,

I understand what you mean now. But I'm not sure how to solve it or help the user in this case.
Point is your URL is valid at design-time, but at runtime it's considered a relative path (relative to your web app address). I think it's a valid address and some users might want to use it, the relative address.
But it's also a valid address at design-time, and at design-time there is no way to know what would be the base URL address of web app.

Wagner

Thanks Wagner, but within the context of TMS WEB Core, how can 

  URL = 'localhost:2001/tms/xdata'
ever be working.  I was using in Edge on my local machine

I had to change it to: 
  URL = 'http://localhost:2001/tms/xdata'

So I guess I didn't realise that you use the same components for VCL connection or a WEB Core connection.  That makes sense.

The component does know what kind of app it is being dropped onto though, e.g. if I drop a JQuery component on a VCL form it gives me a warning. So presumably the setter could do the check.  But in the grand scale of things, it's minor, but just a stumbling block for the newbie.

Cheers,
JAC

It's not the same component. TXDataWebConnection is target for Web Core applications only. It's just that the IDE runs Win32 code at design-time. Every component in Delphi, even if works for, say, Android, will have its "win32 version" running at design-time.