One client connect to multiple DA server


(townsend) #1

Hi, I use RO DA wizard to create my client app for a custom server, it works fine, but I want to add another server connection, each service uses different database(different table structure).
User can choose which server to use at runtime. Can you give me any advice?

(antonk) #3


Go to Tools -> Remoting SDK & Data Abstract -> Connect to Data Abstract Server... or Connect to Data Abstract Server (Typed DataSets)... . Connection Wizard will help you yo fetch data structure from a Data Abstract server.


(townsend) #4

Hi, I built a client connected two DA server, each server has same loginTDYX method and data service method. the first step is choose server, and then login the choosed server.
Question is: when I choose the second server to login, I got error in

    public virtual bool LoginTDYX(string pUserName, string pUserPWD, out StaffInfo poStaffInfo, out RetMsg poResult) {
        RemObjects.SDK.IMessage @__LocalMessage = this.@__GetMessage();
        try {
            @__LocalMessage.InitializeRequestMessage(this.ClientChannel, "CentralSrv", this.ActiveInterfaceName, "LoginTDYX");
            @__LocalMessage.WriteUtf8String("pUserName", pUserName);
            @__LocalMessage.WriteUtf8String("pUserPWD", pUserPWD);
            bool _Result = @__LocalMessage.ReadBoolean("Result");
            poStaffInfo = ((StaffInfo)(@__LocalMessage.Read("poStaffInfo", typeof(StaffInfo), RemObjects.SDK.StreamingFormat.Default)));
            poResult = ((RetMsg)(@__LocalMessage.Read("poResult", typeof(RetMsg), RemObjects.SDK.StreamingFormat.Default)));
            return _Result;
        finally {

Error: cannot convert TdyxBTclient.Mobile.StaffInfo into TdyxBTclient.Central.StaffInfo.

I attached my project. Could you tell me how to solve this problem?

Regards (9.3 MB)

(antonk) #5

This is a name conflict. Client app cannot have a same structure defined in 2 different places.

Do both services use the same RODL? In this case you need to import server RODL only once. To connect to another service you’ll just need to change the URL used to connect to the server.

(townsend) #6

yes, I used 2 different places, and 2 RODL, one is MobileSrv.remoteRODL(in Mobile folder), another one is CentralSrv.remoteRODL(in Central folder). I add two clientchannel2 and two DA services, I traced the program, the second loginTDYX do connect to the Central service, but “@__LocalMessage.Read(“poStaffInfo”, typeof(StaffInfo), RemObjects.SDK.StreamingFormat.Default)” still return TdyxBTclient.Mobile.StaffInfo, pls check my source code.
I don’t know how to set it to use CentralSrv.remoteRODL

(townsend) #7

Sorry, I forgot one thing, my two serveices are not identical, because they connect different database(sqlite for mobile, postgresql for central), and two databases have different data structure.

(marc hoffman) #8

the problem is that the type names sent over the wire are the short names, without namespace, and RO looks up the actual runtime types by name, based the name received over the wire - and in this case is not able to distinguish which of the two types with the same (short) name, both of which are registered wit her RO, to instantiate.

supporting a scenario like this would need some thought and work for a future version, but i’ll bring that up with the team when we discuss future plans. for now, you will need to either use the same RODL and set of types for both servers, or make sure all types have unique (short) names. :(.

(townsend) #9

thanks mh, I can try to use unique names.
By the way, some tables(same name) in two database need to rename to unique name? or just customized structures must have unique name?

(antonk) #10

Unique names are required only for structures.

(townsend) #11

thanks Antonk,

I changed the name and it works.