Solved

RE : WCF

Posted on 2013-05-20
6
262 Views
Last Modified: 2013-06-09
Hi,

I have one WCF which is called by Client through HTTP protocal. Issue is that when client called the WCF i do some updates in my database and for any reason he has not recieved the response may be due to internet failure. So i would like to rollback the updates happenned in my server.

How can i handle these type of half way communication between two servers. What is the best solution or approach for the same.
0
Comment
Question by:vikalgupta
  • 2
  • 2
  • 2
6 Comments
 
LVL 11

Assisted Solution

by:lenordiste
lenordiste earned 250 total points
ID: 39183719
I believe you are looking for a transaction mechanism so that if a problem occurs during an operation, changes to your database will not be committed.

There is such an option in WCF, here is a brief introduction:
http://msdn.microsoft.com/en-us/library/ms752261.aspx

hope this helps!
0
 
LVL 16

Accepted Solution

by:
Kalpesh Chhatrala earned 250 total points
ID: 39187641
0
 

Author Comment

by:vikalgupta
ID: 39190289
I have 2 physical separated servers communicated on HTTP and scenario is that client called my web service through HTTP and updates happened on my server but client not received response due to internet failure. In that case how can i rollback?
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 16

Expert Comment

by:Kalpesh Chhatrala
ID: 39190323
you can do One simple thing

once your transaction is completed your server send response to Client.

Again Client send one acknowledgement of "Received Response of Transaction".

if you did not get Acknowledgement then you can Rollback your Transaction.
0
 

Author Comment

by:vikalgupta
ID: 39193760
This results in increasing the processing time of my process.

If client internet is down at the time of recieving the first time response, do i need to rollback the transaction on the basis of specific interval of time.
0
 
LVL 11

Expert Comment

by:lenordiste
ID: 39194237
Transactions are the way to go if your workflow involves many different calls and you want to be able to roll back the entire transaction if one of those calls fail. You may also want to look into Reliable Sessions if you wish to guarantee message delivery: http://www.c-sharpcorner.com/uploadfile/afenster/wcf-reliable-messaging/. However this won't allow you to roll back if the client did not get a response, it will only allow you to make sure you processed a call only once.

I think what you need is technically not possible without having the client send an acknowledgment call after receiving a response. If the service gets the acknowledgment it commits the transaction, if not it rolls back after some time interval (similar to what Kalpesh2804 is suggesting).
Think of it this way though, internet communication aside what if the client gets the reponse but the software capturing the response crashes before doing anything with it? Do you still consider the transaction to be complete only because it went through the wire? If not, how could you possibly ensure your client has handled the response appropriately? My point is that in your case you will need an acknowledgment from the client at some point to ensure everything ran smoothly.

That said, do you really need that level of transaction? Let's say your client calls your service to widthdraw money from an account and you send back a withdrawalId of some sort. You could simply allow the client to do the same call again but throw an error indicating the transaction was already processed.

If you give us some more specifics on what you are trying to do we may have a great design solution to give you :-) !
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now