WebServices and Datasets

J

JJ

Hi,

I have a situation where I have a Rich Client Win Form App built in C#
and I need to transport a dataset across the internet to a webservice in
asp.net. Database is Sql Server sitting on the same server. Now the problem
resides in the connection type. He is using a satellite connection to
internet. I'm wondering since im calling up a webservice to pass a dataset,
there might be a lag that causes the dataset not to be completely sent. What
method or design should I use in order to make sure dataset arrives to the
webservice completely? The dataset will be about 20 to 25 records with 20
fields per record. Also how can I make sure that the remote database gets
updated from the dataset? Should I have a method in webservice that takes one
or two records from dataset and remotely checks database for existence? Does
anybody have any code examples that basically do what I'm talking about here?

Thanks,

JJ
 
K

Keenan Newton

Well I don't think you should have anything to worry about. .Net uses
the same mechanisms as Internet Explorer does for HTTP. In my mind, if
there was a problem he would have the same issue if data not being sent
from IE while making a HTTP Post to soem web site. Data typically gets
broken down into packets anyways, and I don't think it is often that
the entire Post or Get is sent in one packet to a web site. So
basically the lag beyond being a performance issue. Should not be a
problem technically.

Now when it comes to pushing up data from a ricj clinet what I would do
is only send data that has changed such as inserted, updated and
deleted records. There is a method called GetChanges that will return
a new DataSet with only the changed rows. This way you only need to
send what is changed.

I hope this helps
 
J

JJ

Keenan,

So you think that passing a diffgram dataset to a webservice would be fine?
And if I call the GetChanges Method on the dataset that only the changes will
be shown in the dataset and to pass that to the web service, correct? I
probably don't need to use a diffgram dataset, just a basic one will be fine.
Now to make sure the remote database is updated with changes should I
just create another webmethod that checks the database for inserts/updates
and relays a message back to the rich client app? If so I would suppose their
would be a way to create a custom event to fire when database has been
updated. Should I write a separate method for this custom event to monitor
the webmethod doing the ins/up's for completion? What design do you think I
should use here?

Thanks,

JJ
 
K

Keenan Newton

"So you think that passing a diffgram dataset to a webservice would be
fine?
And if I call the GetChanges Method on the dataset that only the
changes will
be shown in the dataset and to pass that to the web service, correct? I

probably don't need to use a diffgram dataset, just a basic one will be
fine. "

well ther GetChanges method creates a new dataset object with only rows
and atbels with changed data.


"Now to make sure the remote database is updated with changes should I
just create another webmethod that checks the database for
inserts/updates
and relays a message back to the rich client app? If so I would suppose
their
would be a way to create a custom event to fire when database has been
updated. Should I write a separate method for this custom event to
monitor
the webmethod doing the ins/up's for completion? What design do you
think I
should use here? "

Thats a good question, this depends on the requirements of your
application such as location, number of users, service level
agreements, etc... As for the custom event to fire you will need to
poll the database, supposedly with Sql 2005 there wiull be an easier
mechanism to use to determine a change, but remember a web service is
not really a part of an application. A web service can not notify a
client a change as occurred unless the client is constantly polling it.
Same way a web application can't tell a web browser a change as
occured, the web browser must keep polling for the change. I suggest
if you are looking to determine if any updates were made to the data.
That you use a dattime stamp on the rows of data in your tables. Wehn
you make your first query get a datetime stamp from the databse server
(unless you know for sure that all the server clocks are synced up).
Pull that dattime satmp down to the client, now when you make
anyupds/ins, or just want to see if data has been refreshed. Send the
datetime stamp up with the webservice call. ON the database, pull any
records that have a datetime stamp greater then the one sent up from
the client. Then pull just those records back and merge them with your
dataset (DataSet.Merge()). If anyone has a better way using web
services, please chime in.
 
J

jjardine

Keenan Newton said:
"So you think that passing a diffgram dataset to a webservice would be
fine?
And if I call the GetChanges Method on the dataset that only the
changes will
be shown in the dataset and to pass that to the web service, correct? I

probably don't need to use a diffgram dataset, just a basic one will be
fine. "

well ther GetChanges method creates a new dataset object with only rows
and atbels with changed data.


"Now to make sure the remote database is updated with changes should I
just create another webmethod that checks the database for
inserts/updates
and relays a message back to the rich client app? If so I would suppose
their
would be a way to create a custom event to fire when database has been
updated. Should I write a separate method for this custom event to
monitor
the webmethod doing the ins/up's for completion? What design do you
think I
should use here? "

Thats a good question, this depends on the requirements of your
application such as location, number of users, service level
agreements, etc... As for the custom event to fire you will need to
poll the database, supposedly with Sql 2005 there wiull be an easier
mechanism to use to determine a change, but remember a web service is
not really a part of an application. A web service can not notify a
client a change as occurred unless the client is constantly polling it.
Same way a web application can't tell a web browser a change as
occured, the web browser must keep polling for the change. I suggest
if you are looking to determine if any updates were made to the data.
That you use a dattime stamp on the rows of data in your tables. Wehn
you make your first query get a datetime stamp from the databse server
(unless you know for sure that all the server clocks are synced up).
Pull that dattime satmp down to the client, now when you make
anyupds/ins, or just want to see if data has been refreshed. Send the
datetime stamp up with the webservice call. ON the database, pull any
records that have a datetime stamp greater then the one sent up from
the client. Then pull just those records back and merge them with your
dataset (DataSet.Merge()). If anyone has a better way using web
services, please chime in.

One possible way to handle verifying that the data saved to the database is
to create a custom object or datatable that contains an ID of each row and a
status of if the row was saved correctly and return that to the client.
With this you could then sync the data to the server and then get the
results immediatly of which records were successful.
 
K

Keenan Newton

If I had any issues with a save of data in a row to the database. I
was use the rowerror property to save the error messaeg too. then
return the bad row(s) to the client. this way not only do i got the
error message that occured I also have the bad data. This way I can
fix the issue and resend it. Again though it really depends on the
requirements of the application
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top