471,354 Members | 1,633 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,354 software developers and data experts.

Event handling for asynchronous calls

I'm developing WinForms application in .NET 2.0 that talks to web
service. The automatically generated proxy (reference class) has got
methods for both synchronous and asynchronous invocations of the web
service methods. What I like about the asynchronous calls that they
use events. So when I call the web service operation is finished is
fires the event. So all my objects that I'm using in my client
application just subscribe to whatever event they need.
Previously we used the synchronous calls and we just inherited this
proxy (reference class) and overwrote the Invoke method (all
synchronous calls go through this one method) so we can easily trap
exceptions. Whenever we had a WebException or SoapException we dealt
with it in this one spot. But when we're using the asynchronous
invocation there's no such a place. I can overwrite the InvokeAsync
method but that doesn't help me with the SoapExceptions that I'm
getting from the response. As a result of that - in every event
handler I need to try/catch for every possible error and I don't have
the error trapping in one place. I'm not sure how the process works
properly but whenever I get SoapException the event is fired from the
proxy (reference object), it gets to my event handler but then it
crashes.
What is the design approach for this - am I doing something wrong? I
just want to have centralized exception trapping but don't know how to
do it for asynchronous calls.
Thanks for any help
Jan

Jun 15 '07 #1
1 1628
ja********@gmail.com wrote in news:1181891280.444153.171100
@n15g2000prd.googlegroups.com:
What is the design approach for this - am I doing something wrong? I
just want to have centralized exception trapping but don't know how to
do it for asynchronous calls.
Nope - Unfortunately doesn't look like MS provided a rich error handling
framework :-(

It wouldn't have been hard for MS to include a "OnError" event.
Jun 26 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Marcin Kielar | last post: by
2 posts views Thread by Srinath Avadhanula | last post: by
13 posts views Thread by ALI-R | last post: by
4 posts views Thread by dave_wurtz | last post: by
2 posts views Thread by Kevin Walzer | last post: by
reply views Thread by marian.kovac | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.