 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Guest
|
Posted: Wed Jan 10, 2007 2:56 am Post subject: Newbie question: How to make a new TDataset / TClientDataset |
|
|
We currently have a three-tier setup, but we discovered that the
application server (which was written for us by an external company)
has many performance issues and the code is completely unclear. Also
the protocol has not been documented, etc, etc.. So a little while ago,
we decided to do things better ourselves.
So we currently are writing a new application server in c# and because
we lack the knowledge of the way the current protocol works, we decided
on a new protocol based on xml messages, tunneled through a tcp socket.
Now the xml is not a problem and neither is the tcp socket. The problem
is: we now also need a new dataset decendant to connect to our new
server and communicate in xml. I've already made a new decendant of
TCustomClientDataset, calling it TCustomDataclient (which has another
decendant called TDataClient), and a class which wraps around the tcp
socket, but i'm not seeing how to get it to spit out our xml messages
to this connection class, when a call to TDataClient.open is done. In
fact, it raises an EDatabaseError with message 'Missing dataprovider or
datapacket.'
So i've read some things about this provider in the delphi help, and
i'm thinking that maybe we also need to create a new TCustomProvider or
TBaseProvider decendant and TCustomResolver or TBaseResolver to make it
work. But as i'm not familliar with DataSnap, i don't really know where
to start.
And then i've read that it provides a way to communicate with a
provider in the server. But as the server is going to be written in c#
(and a lot of it has already been done) we don't feel much like trying
to integrate this technique in the server itself.
I've also read that it is possible to use a provider within the same
application (that would be the client). Might this be the way to go and
somehow use a new provider to interface between the TClientDataset
decendant and our xml messages? Could we perhaps use an existing
(xml-)provider within the client (or in fact a bpl thats linked with
the client at compiletime) to do the translation? (we currently use a
TXMLDocument to create an xml request message and parse an xml reply
message..)
I know that's a lot of questions.. But perhaps all i need is some
simple example code to get me started.. Or a quick step-by-step guide
to creating a TCustomClientDataset / TCustomProvider / TCustomResolver
/ etc decendant..
I think it would be preferable to only have just a decendant of the
TCustomClientDataset and override a few methods to get it to spit out
the xml, but i'm guessing it isn't that easy.. Especially because one
of my colleagues has already tried that and failed (though admittedly
he doesn't have much experience with delphi.)
Any help much appreciated!
Tim. |
|
| Back to top |
|
 |
YH. Chan Guest
|
Posted: Wed Jan 10, 2007 6:36 am Post subject: Re: Newbie question: How to make a new TDataset / TClientDat |
|
|
I am using 3rd party tools in my 3 tier application and this tools does
provide
Sample application server with source code ( which can run and you just need
to code your
Business logic ). If you interested, please drop me a mail and i will let
you know where to get it.
anywhere, may i know what is tools you are using now ? DataSnap ?
<tim (AT) timveldhuizen (DOT) nl> wrote in message
news:1168376185.873941.68370 (AT) i39g2000hsf (DOT) googlegroups.com...
| Quote: | We currently have a three-tier setup, but we discovered that the
application server (which was written for us by an external company)
has many performance issues and the code is completely unclear. Also
the protocol has not been documented, etc, etc.. So a little while ago,
we decided to do things better ourselves.
So we currently are writing a new application server in c# and because
we lack the knowledge of the way the current protocol works, we decided
on a new protocol based on xml messages, tunneled through a tcp socket.
Now the xml is not a problem and neither is the tcp socket. The problem
is: we now also need a new dataset decendant to connect to our new
server and communicate in xml. I've already made a new decendant of
TCustomClientDataset, calling it TCustomDataclient (which has another
decendant called TDataClient), and a class which wraps around the tcp
socket, but i'm not seeing how to get it to spit out our xml messages
to this connection class, when a call to TDataClient.open is done. In
fact, it raises an EDatabaseError with message 'Missing dataprovider or
datapacket.'
So i've read some things about this provider in the delphi help, and
i'm thinking that maybe we also need to create a new TCustomProvider or
TBaseProvider decendant and TCustomResolver or TBaseResolver to make it
work. But as i'm not familliar with DataSnap, i don't really know where
to start.
And then i've read that it provides a way to communicate with a
provider in the server. But as the server is going to be written in c#
(and a lot of it has already been done) we don't feel much like trying
to integrate this technique in the server itself.
I've also read that it is possible to use a provider within the same
application (that would be the client). Might this be the way to go and
somehow use a new provider to interface between the TClientDataset
decendant and our xml messages? Could we perhaps use an existing
(xml-)provider within the client (or in fact a bpl thats linked with
the client at compiletime) to do the translation? (we currently use a
TXMLDocument to create an xml request message and parse an xml reply
message..)
I know that's a lot of questions.. But perhaps all i need is some
simple example code to get me started.. Or a quick step-by-step guide
to creating a TCustomClientDataset / TCustomProvider / TCustomResolver
/ etc decendant..
I think it would be preferable to only have just a decendant of the
TCustomClientDataset and override a few methods to get it to spit out
the xml, but i'm guessing it isn't that easy.. Especially because one
of my colleagues has already tried that and failed (though admittedly
he doesn't have much experience with delphi.)
Any help much appreciated!
Tim.
|
|
|
| Back to top |
|
 |
Guest
|
Posted: Wed Jan 10, 2007 3:26 pm Post subject: Re: Newbie question: How to make a new TDataset / TClientDat |
|
|
YH. Chan wrote:
| Quote: | I am using 3rd party tools in my 3 tier application and this tools does
provide
Sample application server with source code ( which can run and you just need
to code your
Business logic ). If you interested, please drop me a mail and i will let
you know where to get it.
anywhere, may i know what is tools you are using now ? DataSnap ?
|
Well, that is part of the problem.. For the old communication between
client and server, it isn't very known what is used. For the new
communication, we use xml over a tcp socket. The generation and
interpretation of the xml is no problem, but i don't see how to get it
into a dataset decendant (other that just using insert, edit the new
record with the received values and post and do that for all received
records)..
A collegue who has been working on this project before me suggested
overriding the 'open' method and generate an xml datarequest, put in on
the socket, await the xml reply, parse it and then use insert (still
from within the overridden open method) to put the received data into
the recordset. Problem with this is that open isn't virtual. So he
suggested making a different open method (lets call it myopen) that we
would then use in stead of 'open'.. But this would also require a
mypost and god knows how many others and i doubt very much that the
data-aware components that we use will still work..
So i looked through the code of the TCustomClientDataset and it seems
that overriding the openCursor could be a way to do it better.. But
still, it doesn't feel right.. I think that hacking it into a dataset
like that wouldn't make the code very maintainable or even unstable and
as our client relies heavily on data-aware components and datasets, i'd
really like to know the right way to do this..
Tim. |
|
| Back to top |
|
 |
Atle Smelvær Guest
|
Posted: Wed Jan 10, 2007 6:33 pm Post subject: Re: Newbie question: How to make a new TDataset / TClientDat |
|
|
This system of your's seem very complex for a very simple task (with
existing tools inside the BDS Architect edition). To map special xml to
clientdataset's you should use the XMLTransformProvider.
Use XMLMapper to create mapping files to map your data to fields in you
dataset's.
-Atle |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|