Upgrading Delphi 7 Datasnap to XE: client fails to connect to server [Edit]

Hi,

I'm currently working on upgrading a codebase from Delphi 7 to XE, and am currently just trying to get an older school Datasnap application working under XE.  For reference: I'm developing/testing on Windows 7 64bit and currently using Delphi XE.   

The client application connects to the app server via a socket connection currently, and thus uses Borland Socket server, which includes using a registered "Interceptor" which does data compression/decompression.  

Now the problem: Currently I'm running into a problem trying to get the client to actually talk to the server (e.g. have the client call on methods on a Remote Data Module hosted by the server and/or fetching data from the server.) What happens is on trying to connect to the app server, an exception is raised as follows:
Project RSMClient.exe raised exception class Exception with message 'Object not available: {57C1E3BE-070D-48F4-926A-DE99037C05B1}'.

This exception is relayed from the socket server, and apparently relates to the COM Class not being registered, in effect it's saying that the socket server cannot find the app server indicated by the client, to instantiate via COM in order to complete the requested operation.

Now I've done some digging and as intimated by the message, the app server is not registered in the registry, which implies that the app server is not apparently registering itself automatically on startup as used to be the case under Delphi 7 Datasnap/Windows XP.  Initially I thought this may be due to permissions under Windows 7 (UAC and so on), so I started and Administrative cmd.exe and ran "AppServer.exe /regserver" which previously would've explicitly told the app server to register it's interfaces 
etc.  This command completes without any apparent errors orcomplaints, yet the problem remains.   I've further also confirmed by checking the registry: the COM Class id's which should be present under e.g. HKEY_CLASSES_ROOT/AppID/ and HKEY_CLASSES_ROOT/ClsID/ as a result of COM server registration is still absent on my my Delphi XE/Win 7 machine after explicit registration as above.  

So, some questions:  
1) Why is my app server not automatically registering its interfaces in the COM subsystems anymore?  Is COM not supported for Datasnap anymore in Delphi XE?  (I notice the Datasnap server wizard doesn't offer any COM connectivity options anymore...?)

2) More generally, I also notice that the Datasnap server wizard now offers as one of the options a TDSSServermodule class, presumably as a container class in lieu of the older TRemoteDataModule previously used with Datasnap.  Is there any documentation anywhere that explains how DSSServerModule behaviours and intent differs from TRemoteDataModule and/or how code should be migrated from one to the other (If indeed this should be done at all).  

3) Any general guidelines for mgirating from D7 Datasnap into the XE Datasnap?

Thanks in advance,

Walter
0
Walter
10/4/2011 10:52:12 AM
embarcadero.datasnap 643 articles. 1 followers. Follow

4 Replies
2278 Views

Similar Articles

[PageSpeed] 54

Hi Walter,

> Now I've done some digging and as intimated by the message, the app server is not registered in the registry,

That's correct. Around Delphi 2007, DataSnap COM servers are no longer 
automatically registered when they are started. You need to run them 
with the /register command-line option in order to force them to 
register themselves (and also make sure to run them with the "Run as 
Administrator" option).
This was changed when Windows Vista was introduced, since "normal users" 
would not have the required permission to automatically register the COM 
server upon startup.

> 1) Why is my app server not automatically registering its interfaces in the COM subsystems anymore?  Is COM not supported for Datasnap anymore in Delphi XE?  (I notice the Datasnap server wizard doesn't offer any COM connectivity options anymore...?)

See above. Also note that you are using the "old" COM-based DaTaSnap, 
which has been "replaced" by a newer COM-less DataSnap as of Delphi 2009.

> 2) More generally, I also notice that the Datasnap server wizard now offers as one of the options a TDSSServermodule class, presumably as a container class in lieu of the older TRemoteDataModule previously used with Datasnap.  Is there any documentation anywhere that explains how DSSServerModule behaviours and intent differs from TRemoteDataModule and/or how code should be migrated from one to the other (If indeed this should be done at all).

There are some articles, white papers and even a courseware manual.

> 3) Any general guidelines for mgirating from D7 Datasnap into the XE Datasnap?

If you have existing TRemoteDataModule classes, then you can still use 
these in combination with the new DataSnap. But you have to cut some 
functionality from the server, especially the COM-stuff.
First of all, if it’s an existing DataSnap Server application that you 
want to migrate, and not just the remote data module, you need to 
unregister the DataSnap server by running the executable from the 
command-line with the /unregister command-line option. If you don’t do 
that right from the start, you will not be able to unregister the remote 
data module from the registry (unless you can restore a backup of the 
project later).
In the unit for the remote data module, we must remove the code from the 
initialization section. If you want to keep your unit compatible between 
Delphi 2007-or-below, and 2009-or-later, you can place this code inside 
{$IFDEF}s as follows:

{$IF CompilerVersion >= 20}
initialization
   TComponentFactory.Create(ComServer, TRemoteDataModule2010,
     Class_RemoteDataModule2010, ciMultiInstance, tmApartment);
{$IFEND}
end.

We should also remove the UpdateRegistry routine from the project, or 
place it in {$IFDEF}s as well.

   {$IF CompilerVersion >= 20}
     class procedure UpdateRegistry(Register: Boolean;
       const ClassID, ProgID: string); override;
   {$IFEND}

The most important change – to turn the project into a COM-less DataSnap 
server – involves the removal of the type library (or .ridl files) and 
the type library import unit. These cannot be left in {IFDEF}s, so if 
you need to keep a Delphi 2007 or below (COM-enabled) and Delphi 2009 or 
later (COM-less) version of the DataSnap server you need to make a copy 
of the project now. We should use a TDSServerClass component in the 
DataSnap server application and return the TRemoteDataModule class, just 
as we’ve done before.

Finally, make sure that all custom methods that were added to the 
TRemoteDataModule are moved from the protected section (the default in 
COM-enabled DataSnap) to the public section (so method info is generated 
in the COM-less DataSnap architecture).

See also:

http://www.bobswart.nl/Weblog/Blog.aspx?RootId=5:3626 (2010)
http://www.bobswart.nl/Weblog/Blog.aspx?RootId=5:4601 (XE)
http://www.bobswart.nl/Weblog/Blog.aspx?RootId=5:4814 (ADS and XE)
http://www.bobswart.nl/Weblog/Blog.aspx?RootId=5:4905 (XE2 training)

> Thanks in advance,
>
> Walter

Groetjes,
           Bob Swart

-- 
Bob Swart Training & Consultancy (eBob42.com) Forever Loyal to Delphi
Chairman Delphi Development Network (DDN) powered by SDN - www.sdn.nl
Embarcadero Technology Partner  Delphi & RAD Studio Reseller Eurozone
http://twitter.com/eBob42 LinkedIn: http://nl.linkedin.com/in/drbob42
Delphi Win32 & .NET books on Lulu.com: http://stores.lulu.com/drbob42
Personal courseware + e-mail support http://www.ebob42.com/courseware
Blog: http://www.drbob42.com/blog - RSS: http://eBob42.com/weblog.xml
0
Bob
10/4/2011 12:37:59 PM
Hi Bob,

Many thanks for your very comprehensive reply.  As it turned out, the COM registration code for this application server had already been conditioned with an application specific conditional define, which had somehow gotten lost in the migration from D7.  The result of this was that COM registration was not being called and thus was not happening at all, even when the RDM was being built as part of the application server application where it would be wanted to be called. (This conditional is used to preven
t the COM registration stuff from happening in contexts where it's not wanted, e.g. when the RDM is used/included in other applications as a normal unit, where using it should not have as side effect the automatic attempt to register COM interfaces on the machine.)  

Anyway, having fixed the conditional define in the application server/rdm unit, both the client and server now appear to compile/work/register fine (with /register etc.) under Delphi XE and Windows 7. 

Re migration in general: You mention papers re migrating to Datasnap XE, are these publicly available and if so do you have the links? (I've previously googled but not turned up much specifically appropriate, however I'll go do some more searches and in any case followup the hints you posted -- In any case, I can't say that I'm uhappy that COM's being/been preferentially excised from Datasnap...)

Many thanks again for your help,

Walter
0
Walter
10/5/2011 12:47:22 PM
Hi Walter,

> Anyway, having fixed the conditional define in the application server/rdm unit, both the client and server now appear to compile/work/register fine (with /register etc.) under Delphi XE and Windows 7.

Good to hear.

> Re migration in general: You mention papers re migrating to Datasnap XE, are these publicly available and if so do you have the links?

If you follow the last four links from my previous answer, you'll see 
some blog posts where I put the direct links and more information for 
these free white papers (and not-free courseware manuals and training).

http://www.bobswart.nl/Weblog/Blog.aspx?RootId=5:3626 (2010)
http://www.bobswart.nl/Weblog/Blog.aspx?RootId=5:4601 (XE)
http://www.bobswart.nl/Weblog/Blog.aspx?RootId=5:4814 (ADS and XE)
http://www.bobswart.nl/Weblog/Blog.aspx?RootId=5:4905 (XE2 training)

> Many thanks again for your help,
>
> Walter

Groetjes,
           Bob Swart

-- 
Bob Swart Training & Consultancy (eBob42.com) Forever Loyal to Delphi
Chairman Delphi Development Network (DDN) powered by SDN - www.sdn.nl
Embarcadero Technology Partner  Delphi & RAD Studio Reseller Eurozone
http://twitter.com/eBob42 LinkedIn: http://nl.linkedin.com/in/drbob42
Delphi Win32 & .NET books on Lulu.com: http://stores.lulu.com/drbob42
Personal courseware + e-mail support http://www.ebob42.com/courseware
Blog: http://www.drbob42.com/blog - RSS: http://eBob42.com/weblog.xml
0
Bob
10/5/2011 1:05:12 PM
> {quote:title=Bob Swart wrote:}{quote}
> If you follow the last four links from my previous answer, you'll see 
> some blog posts where I put the direct links and more information for 
> these free white papers (and not-free courseware manuals and training).

Ugh my apologies. I somehow didn't consciously register/see those links when I read your previous reply, but when I looked again now you'd obviously already given details in your original answer about migration in general, so my asking about them again was rather superflous. Sorry! 

Walter
0
Walter
10/5/2011 8:45:43 PM
Reply:

Similar Artilces:

Connect Old Datasnap Clients with new datasnap Server ? [Edit]
Is it possible to connect a XE5 datasnap server with Borland C++ 6 Datasnap clients ? I want to know this before starting ... Edited by: Bart vd Voort vd Kleij on Jan 9, 2014 11:49 PM Edited by: Bart vd Voort vd Kleij on Jan 9, 2014 11:51 PM ...

ANN: DataSnap-like Client-Server JSON RESTful Services in Delphi 7-2010 [Edit]
How to implement a very useful service... say... adding two numbers? In our framework, you code Server-Side: {code} function TSQLRestServerTest.Sum(aRecord: TSQLRecord; aParameters: PUTF8Char; const aSentData: RawUTF8; var aResp, aHead: RawUTF8): Integer; var a,b: Extended; begin if not UrlDecodeNeedParameters(aParameters,'A,B') then begin result := 404; // invalid Request exit; end; while aParameters<>nil do begin UrlDecodeExtended(aParameters,'A=',a); UrlDecodeExtended(aParameters,'B=',b,@aParameters); end; aRes...

XE Datasnap Client expection with a XE2 DataSnap Server.
I have developed a simple DataSnap Server on XE2 and the client that connects to this server is under XE. Everything works just fine except when freeing the ClientProxy Module on the client side I get the following exception " TDXError with message Invalid Ordinal 3." followed by a AV. Any hints how to avoid this exception or the Server must be on XE also? Thanks in Advance, Omar Zelaya I have now the DataSanp Server on XE and the client no longer throws the exception. So the question now is, it is possible to use a XE DataSnap Client with a XE2 DataSnap Se...

Indy 10
This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --JivePart=_39eb5.zeB8CwDOH5aMJzMl Content-Type: text/plain; charset="Utf-8" The udp client component would be used in the datasnap server. The udp server component would be used in the datasnap client. --JivePart=_39eb5.zeB8CwDOH5aMJzMl Content-Type: application/x-zip-compressed; name="UDPDSClinetstub.zip" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="UDPDSClinetstub.zip" UEs...

IP address of clients, connected to DataSnap server [Edit]
Hello. Please help with answers: Is it possible to obtain list of clients currently connected to the DataSnap server, including IP adresses? What class i need to use for it? Edited by: Sergey Ryasnyanskiy on Jun 19, 2011 9:53 PM There is no default way to accomplish this task without some programming on your part. If you find that you can obtain the correct IP from the OnConnect event (in XE you may find the IP returned is the Server's IP) then you can store that IP in the session (Session := TDSSessionManager.GetThreadSession;) using the get/put data functions. You can later g...

Delphi XE2 DataSnap Server
I'm building an XE2 DataSnap server which will serve connections from REST clients. My DSServerClass LifeCycle property is set to 'Invocation'. What I want to do is to log the details of all client connections to the server, including the following details : username, IP address, protocol, application name. I can currently get these details using the following events : DSAuthenticationManager - UserAuthenticate() : username, protocol (using the standard parameters passed in) DSServer - Connect() : protocol, IP address, application name (using DSConnectEventObject.ChannelInf...

Datasnap Rest client and no datasnap server
Hi, it's possible to use a delphi datasnap rest client to consume a rest web services written in other lenguages (like java or php) or i have to use an idhttp (or other) component? Thanks. Bye Pasquale Di Giovanni wrote: > > it's possible to use a delphi datasnap rest client to consume a rest > web services written in other lenguages (like java or php) or i have > to use an idhttp (or other) component? You could in theory, but it may be more trouble than its worth. You'd probably have to have control of the REST server so you can implement all the...

Datasnap and connecting from app to a server
Hey all, I wuld be glad if someone can help me. I have now created a client/server solution for an App using Delphi XE8 on Windows 7. But all the time I get the error 10061 connection refused. I have checked my public IP address, that the server is running, and checked that the server shouldn't be busy. I also have tried to deactivate my firewall and antivirus with no success. So I don't know where to look for finding the problem with the connection from app to server. I really hope that someone can give some ideas. best regards Michael Edited by: Michael Eriksen...

How to know which client using the server methord in Datasnap Server? [Edit]
Hi, There are some clients which has connected the datasnap server. I have recorded their ChannelInfo.Id when these clients connect the server in Onconnect Event of Datasnap Server. Now if a client is preparing to use the Server Methord, how can I get this client's thread id or ChannelInfo.Id? I want to do this: 1.So I can record the time of this client invoked the server methord in Datasnap Server. 2.So I can disconnect this client's connection. Best regards, Sunstone Edited by: sun stone on Feb 7, 2010 10:17 PM I want this to store session info in a server having...

Problem upgrading web service client from Delphi 7 to Delphi XE
In trying to upgrade our web service client to Delphi XE we have now get a web service error of Invalid Format. When we examine the SOAP request we see the following differences from Delphi 7 vs Delphi XE In Delphi 7 we get <SomeStuff xmlns="" xsi:nil="true" /> In Delphi XE we get <SomeStuff xsi:nil="true" /> We have narrowed the failure down to these differences in the client request. Is there anyway to get Delphi XE to generate a SOAP request with the xmlns attribute set to blank as it used to be? Hello, > In trying to u...

DataSnap server
I have a Delphi XE2 DataSnap server (Windows service) connected to a backend MS SQL Server 2008 (same server box) serving REST client requests. Everything has been working great for some time until recently I had an issue where for some reason the DataSnap service lost connection to the SQL Server. The service failed to re-establish a connection and I had to restart the DataSnap service to continue. This got me thinking because currently the service only uses 1 SQL connection (TADOConnection) shared fo r all the client requests. I did this because I didn't want the overhead of instant...

Datasnap Client/Server multithread
This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --JivePart=_52fae.zeB8CwDOH5aMJzMl Content-Type: text/plain; charset="Utf-8" This attachment is for QC92921. Regards Bjarne --JivePart=_52fae.zeB8CwDOH5aMJzMl Content-Type: application/zip; name="Basic DS.zip" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="Basic DS.zip" UEsDBBQAAgAAANlEiD4AAAAAAAAAAAAAAAAJAAAAQmFzaWMgRFMvUEsDBBQAAgAIAM1EiD5pWF4O 2gEAAKEGAAAaAAAAQmFzaWMgRFMvQ...

Delphi 2009 Datasnap server and client
Hello, I am trying develop Datasnap server and client. I have a type TStringArray = array of string;. I used this type in one of server method. When I am trying to Generate Datasnap Client classes it says 'Remote error:Unknow data type: TStringArray'. How can I register this data type? -- Best Regards Md. Shariful Alam Khan Hello, Isn't there anyone to answer my question? Also I am getting same error if I use TStrings or TWideStringArray. Best Regards Md. Shariful Alam Khan "Md. Shariful Alam Khan" <murad_mouri@yahoo.com> wrote in messag...

Datasnap Server Getting Client List [Edit]
Hi, I have a project that uses Datasnap. I need list of all clients that still connected at a moment. Is there any way to get connection list ? I need client's IP, Connected User, Pass etc. My Clients connects via HTTP with authentication. Edited by: Umut Kose on May 10, 2010 6:25 AM ...

Web resources about - Upgrading Delphi 7 Datasnap to XE: client fails to connect to server [Edit] - embarcadero.datasnap

Facebook Starts Upgrading Profiles To Timeline
A couple of readers told us that timeline previews have kicked in on their profiles without their having initiated the change themselves. A welcome ...

Facebook Upgrading “Insights” Metrics Dashboard for Page Managers Tonight
Facebook has just begun pushing an upgrade to its “Insights” metrics dashboard for Facebook Pages that gives administrators more visibility into ...

Flickr: Help: Free Accounts, Upgrading and Gifts
Flickr is almost certainly the best online photo management and sharing application in the world. Show off your favorite photos and videos to ...

Mac Spoofed: Upgrading [Low Quality]
PC teaches Mac about the benefits of upgradability.

Coalition's NBN will need ongoing, costly upgrading, experts warn
The Coalition's planned broadband infrastructure will "freeze" broadband speeds, and need ongoing and expensive upgrading to resemble the system ...

Beware of unintended and costly consequences when upgrading houses
Meeting the Building Code measures on energy efficiency is a potentially tricky business, even if you are upgrading or extending only one part ...

Nuclear states still upgrading stocks
Nuclear armed states continue to upgrade their stockpiles despite s trend towards global disarmament.

Looks like Labor's upgrading from Tarago to minibus
The people of Stafford have done the rest of Queensland a favour by electing Dr Anthony Lynham.

Promise check: $16m towards upgrading Hobart's Cadbury factory
Keep track of the Coalition's promise to spend $16 million on upgrading Hobart's Cadbury chocolate factory.

Upgrading IOIO to Bluetooth - YouTube
An instructional video showing how to upgrade IOIO's firmware in order to make it Bluetooth capable. Downloads are at: https://github.com/yt ...

Resources last updated: 1/18/2016 8:45:31 AM