Chau Chee Yang
Chau Chee Yang

Reputation: 19650

How to manually invoke DSProxyGEN.EXE to generate Delphi DataSnap proxy client?

I am using DataSnap of Delphi 2010. There is a DSProxyGen.EXE utility to allow us generate proxy client unit. Does anyone how to consume this utility in command line to generate the proxy client without using TSQLConnection's context menu?

Upvotes: 3

Views: 1638

Answers (4)

Bruce McGee
Bruce McGee

Reputation: 15334

DSProxyGen doesn't give you its parameters when run at the command line and doesn't respond to

DSProxyGen /?

You could try replacing it with your own exe (make a backup!) that detects what command line parameters are sent (global CmdLine variable) and write them to a file. Launch this from TSQLConnection's context menu and you should have what you need to call DSProxyGen from the command line.

Update:

From Delphi XE to XE7, source code for DSProxyGen is included as one of the samples

Samples\Delphi\DataSnap\ProxyGenerator

In Delphi XE8, it is shipped as part of the source code.

source\data\datasnap\proxygen

Upvotes: 3

Kobus Smit
Kobus Smit

Reputation: 1785

It is possible with the DSProxyGen.exe from Delphi XE and later, for example:

DSProxyGen.exe Proxy.pas
-C:host=localhost;port=8080;communicationprotocol=http

Run DSProxyGen.exe without parameters for usage help. (/? or /h etc. does not work)

I've noticed the source is also included in Delphi XE7:

C:\Program Files (x86)\Embarcadero\Studio\15.0\source\data\datasnap\proxygen\DSProxyGen.dproj

Note that it would not work if you have specified any Transport Filters (ie. ZLibCompression,PC1,RSA etc.), returning errors for example "TDBXError: ZLibCompression Filter not found."

A temp workaround I've used during development time is to add another TDSTCPServerTransport comp that does not have any Transport Filters and then DSProxyGen works fine.

Upvotes: 2

Bob Swart
Bob Swart

Reputation: 1298

DSProxyGen.exe without arguments connects using TCP/IP port 211 and uses the first command-line argument as filename.

DSProxyGen test.pas

Will generate test.pas

I've found no way to specify ConnectionString options on the command-line, yet...

Upvotes: 2

Bob Swart
Bob Swart

Reputation: 1298

See the unit DSProxyDesigner.dcu (for which the source file is not included, but should be at database\external\src\pas\datasnap\proxy\DSProxyDesigner.pas). This is the unit used at design-time to generate the proxy client classes. I'm not sure DSProxyGen.exe is actually used, and it's a shame there is no documentation on its command-line parameters, yet...

Upvotes: 0

Related Questions