473,796 Members | 2,742 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to Catch exceptions of webservices? Urgent please

Hi all,

How to handle exceptions of webservices?
I have a wsdl file which contains the exception classes.

when i am adding that wsdl file in my asp application I am unable to view
those classes.

As of now i am catching through EXCEPTION class. I know this is not the
permanent solution. Please help in solving this...

Thanks in advance
Kris.
Apr 20 '07 #1
5 5361
"kris" <kr**@discussio ns.microsoft.co mwrote in message
news:60******** *************** ***********@mic rosoft.com...
Hi all,

How to handle exceptions of webservices?
I have a wsdl file which contains the exception classes.
Are you referring to SOAP Faults in the WSDL, or are you referring to
something else. If something else, then please post an example of one of
these "exception classes".
when i am adding that wsdl file in my asp application I am unable to view
those classes.

As of now i am catching through EXCEPTION class. I know this is not the
permanent solution. Please help in solving this...
The ASP.NET Web Services handler translates any uncaught exception other
than a SoapException _into_ a SoapException. SoapExceptions are (mostly)
left alone.

When it sees a SoapException, it translates that into a SOAP Fault and
returns that to the client.

If the client is a .NET Client, it will turn that SOAP Fault into a
SoapException and will throw that.

You cannot recover the original exception.

If you have clients other than .NET clients (I don't know how this works
with WCF clients), then you may be interested in having them turn your SOAP
Faults into exceptions they can catch. Java clients can do this, for
instance. If that's what you're looking for, let me know.
--

John Saunders [MVP]
Apr 21 '07 #2
Hi John

I found the solution for this.

To catch the exceptions of wsdl

catch(SoapExcep tion ex)
{
ex.Detail.Inner Text; // Gives me in detail about the exception
}
Any way, Thank u very much.
Apr 23 '07 #3
"kris" <kr**@discussio ns.microsoft.co mwrote in message
news:86******** *************** ***********@mic rosoft.com...
Hi John

I found the solution for this.

To catch the exceptions of wsdl

catch(SoapExcep tion ex)
{
ex.Detail.Inner Text; // Gives me in detail about the exception
}

Note that ex.Detail.Inner Text will only give you detail about the exception
if someone has put some detail there. You're also losing any structure to
the detail by using .InnerText, as there may be arbitrary XML in .Detail.
Finally, .Detail may be null, so test that before taking .InnerText.
--

John Saunders [MVP]
Apr 24 '07 #4
hi

I can see even the exception class name in ex.Detail.Outer Xml.

How to retrieve that class so that i can catch in that class instead of
SOAPEXCEPTION class.

Apr 24 '07 #5
"kris" <kr**@discussio ns.microsoft.co mwrote in message
news:81******** *************** ***********@mic rosoft.com...
hi

I can see even the exception class name in ex.Detail.Outer Xml.

How to retrieve that class so that i can catch in that class instead of
SOAPEXCEPTION class.
You can't, because you're not seeing the class name. You're seeing some text
that _looks_ like a class name. It's just a text message, and the format of
it is subject to change at any time. Do not use it for any purpose other
than to display the text of the message or log it to the event log or
somewhere.

If Microsoft had been attempting to send you the class name, they would have
sent it in the standard full format. Something like this:
"System.Configu ration.AppSetti ngsSection, System.Configur ation,
Version=2.0.0.0 , Culture=neutral , PublicKeyToken= b03f5f7f11d50a3 a".

Also, if Microsoft had intended you to catch specific exceptions, they would
have done it for you, and not required you and everyone else to do it
yourself.

So, please do yourself a favor and stop there; any further will be a hack,
and likely a fragile one at that.

--
John Saunders [MVP]
Apr 24 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
6007
by: Noor | last post by:
please tell the technique of centralize exception handling without try catch blocks in c#.
24
2363
by: Steven T. Hatton | last post by:
If I understand correctly, I have no assurance that I can determine the type of a simple class instance thrown as an exception unless I explicitly catch it by name. (non-derived classes having no virtual funcitons have no rtti) That is, there is no way to do something like: try{ funct_from_3rd_party(); } catch(...){ std:err << extract_name() << std::endl; }
8
2737
by: Z D | last post by:
Hi, I was wondering what's the point of "finally" is in a try..catch..finally block? Isn't it the same to put the code that would be in the "finally" section right after the try/catch block? (ie, forget the finally block and just end the try/catch and put the code after the try/catch block). Or does the "finally" construct add some additional functionality?
9
343
by: Steven Blair | last post by:
Hi, I need to catch exceotions on File.Delete() After checking the help, I have noticed that thgere are serevral Exceptions that can be thrown. My question is, should I catch all thes Exceptions, or if I simply do the following: try
37
2964
by: clintonG | last post by:
Has somebody written any guidelines regarding how to determine when try-catch blocks should be used and where their use would or could be considered superfluous? <%= Clinton Gallagher METROmilwaukee (sm) "A Regional Information Service" NET csgallagher AT metromilwaukee.com URL http://metromilwaukee.com/ URL http://clintongallagher.metromilwaukee.com/
13
3725
by: Benny | last post by:
Hi, I have something like this: try { // some code } catch // note - i am catching everything now {
23
3083
by: VB Programmer | last post by:
Variable scope doesn't make sense to me when it comes to Try Catch Finally. Example: In order to close/dispose a db connection you have to dim the connection outside of the Try Catch Finally block. But, I prefer to dim them "on the fly" only if needed (save as much resources as possible). A little further... I may wish to create a sqlcommand and datareader object ONLY if certain conditions are met. But, if I want to clean these up in the...
32
6130
by: cj | last post by:
Another wish of mine. I wish there was a way in the Try Catch structure to say if there wasn't an error to do something. Like an else statement. Try Catch Else Finally. Also because I understand Finally runs whether an error was caught or not, I haven't found a use for finally yet.
4
8929
by: cj | last post by:
my old code Try Dim sw As New System.io.StreamWriter(fileName, True) sw.WriteLine(strToWrite) sw.Close() Catch End Try my new code
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9535
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10467
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10201
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7558
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6802
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4130
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2931
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.