Puzzled by AuthConnection component in the TMS XData Web Application

I am starting fresh with the template that works. I think my mistakes stem from not realising everywhere that I have to wait for something asynchronous to finish.

PUZZLE

I have a component in ConnectionModule called AuthConnection that was created by the template. But its not in the dfm file. It is also referenced by other units.

Everything compiles and runs as. But if I make any changes to the ConnectionModule (such as naming the component or the form). it complains about the AuthConnection of type TXDataWebConnection, missing.

I have confirmed that I am changing every reference to those entities (with Grep).

Please provide steps to reproduce. Such as:

  1. I create a template like this
  2. I open ConnectionModule and do exactly this.
  3. Then I get this exactly error.

You just mentioned about "changing things" and then "it complains". Can you please be more specific?

I will do that. But what I am confused by is that the second TXDataWebConnection has no component in the DFM.

PAS

  TDMConnection = class(TWebDataModule)
    ApiConnection: TXDataWebConnection;
    AuthConnection: TXDataWebConnection;
    procedure ApiConnectionError(Error: TXDataWebConnectionError);
    procedure ApiConnectionRequest(Args: TXDataWebConnectionRequest);
    procedure ApiConnectionResponse(Args: TXDataWebConnectionResponse);
  private
    FUnauthorizedAccessProc: TUnauthorizedAccessProc;
  public
    procedure InitApp(SuccessProc: TSuccessProc;
      UnauthorizedAccessProc: TUnauthorizedAccessProc);
  end;

DFM

object DMConnection: TDMConnection
  Height = 264
  Width = 395
  object ApiConnection: TXDataWebConnection
    URL = 'http://example.com:2002/chopper'
    OnError = ApiConnectionError
    OnRequest = ApiConnectionRequest
    OnResponse = ApiConnectionResponse
    Left = 48
    Top = 80
  end
end

AuthConnection is not present in the dfm. Is this how its supposed to be?

This is the unmodified code produced b the Wizard/Template TMS XData Web Application.

This is an overlook from the template, indeed. Is this causing the issue? You can try to simply remove it from the code and see if it's the root of the cause.

I have problems either way.

  • If I remove it, then there is code linked in that's using it.
  • If I put it in the dfm, I still get other errorss.
  • When I get the error, if I restart the IDE, it compiles fine. But I find it strange that it runs.

I have to do some sort of authorisation. Was this to handle a different webservice for authorisation. Or is it something else altogether?

This is a left over. The template doesn't deal with authentication or authorization. Which linked code is using it?

Anyway, for authentication/authorization you would have to do it yourself.