Derik Whittaker

Syndication

News


Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at imagehelp@codebetter.com
Using Anonymous Delegates to handle Async Web Service Calls

I just thought I would share a little trick I used today to back in Async web service calls into existing code using anonymous delegates.

Here was my problem:
I have a library that makes use of an existing web service that I do not control (so I cannot change/up the timeout on this).  I have been using this code now for a few weeks with no issues, however late last week I noticed that I was experiencing timeouts when making certain requests via the service.  My original code was making use of the synchronous methods on the web service.  In order to get around the time out issue I wanted to make the calls asynchronous, but I did not want to have to put in a ton of time or effort to retrofit my code. 

Here is my solution:
Create an anonymous delegate to handle my Async call and move on.

Here is my original code

Here is the new code using the delegates

As you can see, this code is not 'slick' and 'cool' but it does do the job.  By tweaking this code I was able to not have to re-write any other outside logic to handle the new async way of making this call.

Till next time, 


Posted 10-15-2007 8:27 AM by Derik Whittaker
Filed under: , , ,

[Advertisement]

Comments

Using Anonymous Delegates to handle Async Web Service Calls wrote Using Anonymous Delegates to handle Async Web Service Calls
on 10-15-2007 10:24 AM

Pingback from  Using Anonymous Delegates to handle Async Web Service Calls

About The CodeBetter.Com Blog Network
CodeBetter.Com FAQ

Our Mission

Advertisers should contact Brendan

Subscribe
Google Reader or Homepage

del.icio.us CodeBetter.com Latest Items
Add to My Yahoo!
Subscribe with Bloglines
Subscribe in NewsGator Online
Subscribe with myFeedster
Add to My AOL
Furl CodeBetter.com Latest Items
Subscribe in Rojo

Member Projects
DimeCasts.Net - Derik Whittaker

Friends of Devlicio.us
Red-Gate Tools For SQL and .NET

NDepend

SlickEdit
 
SmartInspect .NET Logging
NGEDIT: ViEmu and Codekana
LiteAccounting.Com
DevExpress
Fixx
NHibernate Profiler
Unfuddle
Balsamiq Mockups
Scrumy
JetBrains - ReSharper
Umbraco
NServiceBus
RavenDb
Web Sequence Diagrams
Ducksboard<-- NEW Friend!

 



Site Copyright © 2007 CodeBetter.Com
Content Copyright Individual Bloggers

 

Community Server (Commercial Edition)