Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

RE : WCF

Posted on 2013-05-20
6
280 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
MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

 
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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Help 27 57
Powershell File Sort 8 41
SSIS On fail action 5 38
How can I do Unit Testing with Session ? 1 10
This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
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…
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…

856 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