URI best match doesnt work without all its units

Hi guys,

Delphi Tokyo 10.2.3. Latest RO.

I have a generated _intf.pas file and I want to use it on a regular Delphi program. DA/RO is installed.

If I create a new form, include the _intf file to the uses list of that new form and add a button and include this code on the OnClick event:

procedure TForm1.Button1Click(Sender: TObject);

var
aCoreService: ICore_Service;

begin
Memo1.Lines.Clear;
aCoreService := CoCoreService.Create(‘supertcp://localhost:8090/Bin’);

if not aCoreService.TryGetSomething(‘ID’) then
Memo1.Lines.Add(‘Couldnt’)
else
Memo1.Lines.Add(‘Worked’);
end;

It will not work, because it will not be able to get the best match for the URI provided. The best match channel and message routines will return nil. If i include the specific unit that contains the expected protocol/message, meaning uROBinMessage on this specific case then it will work.

Same thing happened with the protocol itself.

My question is, why do I need to include on the calling form all these units? I will assume that I should only need the _intf included on the calling form and then if needed the _intf will include any needed units from RO.

My issue is that unless I know what protocol and message im using, and I actually drop those components on the form it will not work. The URI protocol/message formats will not be detected properly unless I include all those units, which defeats its purpose of letting someone just entering the URI.

Any place where I invoke a service from the _intf using its URI i will have to throw all the possible combinations of protocol/message to cover all cases.

Hopefully I described this properly.

you need to include those units to your project at least once because they contain required registration for protocols and messages like:

ROUrlSchemaParser.ProtocolHandler[URL_PROTOCOL_SUPERTCP] := TROSuperTCPChannel;

and

ROUrlSchemaParser.MessageHandler['bin'] := TROBinMessage;

also several channels can handle the same protocol, e.g. Synapse SuperTCP channels also handles supertcp:

ROUrlSchemaParser.ProtocolHandler[URL_PROTOCOL_SUPERTCP] := TROSynapseSuperTCPChannel;

I can recommend for you to create a special unit and include into it your favorite protocols and messages, like

unit MyURISchema;
interface
uses
  uROSuperTCPChannel, uROBinMessage;
implementation
end.