Solved

RE : WCF

Posted on 2013-05-20
6
278 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
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…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

832 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