By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,635 Members | 2,060 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,635 IT Pros & Developers. It's quick & easy.

Can a webservice determine that it is called asynchronously?

P: n/a
When a webservice is called through BeginInvoke asynchrously and an
exception is thrown, this exception is not propagated to the client
(obviously). Asynch client simply does not care about it.

However, there are cases when the client would like to call the same
webservice synchronously. In such a case the client will be interested in
receiving the exception and displaying it to the user, or do whatever he
needs to do with it.

Adding throwException parameter would be no-brainer, but I thought wouldn't
be nice if a web service could determine how it is being called. If asynch -
catch and log exception.

Is it possible?

Thanks,

-Stan
Nov 21 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
your idea doesn't seem right to me.

one way or the other , the semantics of the service should remain
consistent.
If an exception fires, log it.

then either re-throw it or not.

How do you know if you are async or not?
you don't, usually. but if you follow this article
http://msdn.microsoft.com/library/en...ce10012002.asp

you can make your service async, always. You can throw in the EndXxx call
if desired.

"Stan" <no****@yahoo.com> wrote in message
news:Oq**************@TK2MSFTNGP14.phx.gbl...
When a webservice is called through BeginInvoke asynchrously and an
exception is thrown, this exception is not propagated to the client
(obviously). Asynch client simply does not care about it.

However, there are cases when the client would like to call the same
webservice synchronously. In such a case the client will be interested in
receiving the exception and displaying it to the user, or do whatever he
needs to do with it.

Adding throwException parameter would be no-brainer, but I thought
wouldn't
be nice if a web service could determine how it is being called. If
asynch -
catch and log exception.

Is it possible?

Thanks,

-Stan

Nov 21 '05 #2

P: n/a
> How do you know if you are async or not?
you don't, usually. but if you follow this article


That is what I am asking.. You say 'usually'. Does it mean that there is
still a way to know?

Nov 21 '05 #3

P: n/a

"Stan" <no****@yahoo.com> wrote in message
news:Oq**************@TK2MSFTNGP14.phx.gbl...
When a webservice is called through BeginInvoke asynchrously and an
exception is thrown, this exception is not propagated to the client
(obviously). Asynch client simply does not care about it.
Are you calling the web method asynchronously using the BeginXXX/EndXXX
proxy method pair? If so, the exception is thrown when the client calls
EndXXX, and you can handle the exception with the normal try/catch
construct.

However, there are cases when the client would like to call the same
webservice synchronously. In such a case the client will be interested in
receiving the exception and displaying it to the user, or do whatever he
needs to do with it.

Adding throwException parameter would be no-brainer, but I thought wouldn't be nice if a web service could determine how it is being called. If asynch - catch and log exception.

Is it possible?


If the call is made asynchronously from the client side with the Begin/End
proxy method pair, then the web service call is made from a background
thread in the client. From the web service's point of view it appears as a
normal synchronous call and there is no way for the service to find out how
it is being called. But I really see no need for this either.

Regards,
Sami
Nov 21 '05 #4

P: n/a
i don't know, but that does not mean there is no way to know.

"Stan" <no****@yahoo.com> wrote in message
news:en**************@TK2MSFTNGP09.phx.gbl...
How do you know if you are async or not?
you don't, usually. but if you follow this article


That is what I am asking.. You say 'usually'. Does it mean that there is
still a way to know?

Nov 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.