How to catch all Exceptions from WebService?
I have a web link to a remote web service that is being called in several different classes. I would like to get all exceptions coming from this web service only. How can I do this (like extending the base, auto-generated class) without interfering and changing all the top-level code?
a source to share
You cannot and why do you want? Almost always the error is "catch all exceptions" or "handle all exceptions". What are you trying to accomplish?
- I suggest you register it with the server and not the client.
- What will you do when you hide the exclusion from the top layers? Pretend it didn't happen?
It might make sense to wrap the SoapException in one of your own. May be. This is only because SoapException is so web service specific. In this case, yes, you need to wrap each call in try / catch. The best way to do this would be in a facade class, which can also have generic code to wrap a SoapException or translate it into one of yours.
However, if you are not ready to take control of your code generation, you can do it manually.
a source to share