M
Mark Stevens
I have a web service which is used to perform database updates. Every
now and then we have a networking glitch which causes a problem with
the connection. The end result is that we end up with two records in
the database when a new record is created in the Windows App.
As the network issue is outside of my control I was thinking about
solving this problem using SQL Transactions. If this was a Windows or
ASP web page then I could do this easily but I am not sure if this
will work with a web service. What I want to do is the following:
Step 1
Windows app calls web service - Begin Transaction
Web service creates a transaction and returns to windows app
Step 2
Windows app call web service - Create new record
Web service updates db and returns the DB ID to windows app
Step 3
Windows app receives DB ID and calls web service - Commit Transaction
Web service - commits transaction and deletes transaction object.
So the transaction object would persist over web service calls for the
users session. I would be storing the transaction in the web service
class as a private variable. The begin transaction function in the
web service would detect the variable being null or not and realise
that not null means that the transaction needs to be rolled back as
the previous operation failed to complete (i.e. my network failure
returning the DB ID in step 2).
Can anyone see why this would not work? Would the private class
variable continue to exist over function calls? I know if this was a
web page I would be storing the class variables in the session - would
I have to do something similar with a web service?
Thanks in advance,
Mark
--
|\ _,,,---,,_ A picture used to be worth a
ZZZzzz /,`.-'`' -. ;-;;, thousand words - then along
|,4- ) )-,_. ,\ ( `'-' came television!
'---''(_/--' `-'\_)
Mark Stevens (mark at thepcsite fullstop co fullstop uk)
This message is provided "as is".
now and then we have a networking glitch which causes a problem with
the connection. The end result is that we end up with two records in
the database when a new record is created in the Windows App.
As the network issue is outside of my control I was thinking about
solving this problem using SQL Transactions. If this was a Windows or
ASP web page then I could do this easily but I am not sure if this
will work with a web service. What I want to do is the following:
Step 1
Windows app calls web service - Begin Transaction
Web service creates a transaction and returns to windows app
Step 2
Windows app call web service - Create new record
Web service updates db and returns the DB ID to windows app
Step 3
Windows app receives DB ID and calls web service - Commit Transaction
Web service - commits transaction and deletes transaction object.
So the transaction object would persist over web service calls for the
users session. I would be storing the transaction in the web service
class as a private variable. The begin transaction function in the
web service would detect the variable being null or not and realise
that not null means that the transaction needs to be rolled back as
the previous operation failed to complete (i.e. my network failure
returning the DB ID in step 2).
Can anyone see why this would not work? Would the private class
variable continue to exist over function calls? I know if this was a
web page I would be storing the class variables in the session - would
I have to do something similar with a web service?
Thanks in advance,
Mark
--
|\ _,,,---,,_ A picture used to be worth a
ZZZzzz /,`.-'`' -. ;-;;, thousand words - then along
|,4- ) )-,_. ,\ ( `'-' came television!
'---''(_/--' `-'\_)
Mark Stevens (mark at thepcsite fullstop co fullstop uk)
This message is provided "as is".