Error trapping for web service asynchronous calls

J

jan.loucka

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
 
M

Mr. Arnold

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

You should post to MS.Public.dotnet.framework.webservices.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top