473,394 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Exceptionhandling

Hey,

I'm trying to throw an exception through to SOAP-
protocol. Like this:

throw new SoapException("message",
SoapException.ServerFaultCode);

When I catch the exception in my application:

try
{
// Calling a method in my webservice
}
catch (Exception e)
{
// do something based on e.Message
}

When I get the e.Message it contains more information
than I provided in the throw-statement (theres
information about the webservice-method that throw the
exception)

The consequense is that my application can't react to the
exception without some work on the string. That's not
optimal.

When throwing the exception from the webservice I have an
user-defined exception. Is there
a way to send it through the SoapException for a nice
catch in the application ?

René
Nov 12 '05 #1
1 1858
Hi, exception coming from a web service has to be the SoapException.
All custom exceptions thrown from the web service code are automatically
converted to the SoapException, so this is the only exception type you see
at the client side.

However if you throw a SoapException from your web service code, it is not
going to be converted twice and you can use Detail property so send any
custom information you want. On the client side you need to catch
SoapException and do error handling based on the Detail field.

This article contains an example of using SoapException.Detail:
http://msdn.microsoft.com/library/de...etailtopic.asp

--
Thanks,
Eugene
-------------------------
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm.


"René" <re**@convide1.dk> wrote in message
news:08****************************@phx.gbl...
Hey,

I'm trying to throw an exception through to SOAP-
protocol. Like this:

throw new SoapException("message",
SoapException.ServerFaultCode);

When I catch the exception in my application:

try
{
// Calling a method in my webservice
}
catch (Exception e)
{
// do something based on e.Message
}

When I get the e.Message it contains more information
than I provided in the throw-statement (theres
information about the webservice-method that throw the
exception)

The consequense is that my application can't react to the
exception without some work on the string. That's not
optimal.

When throwing the exception from the webservice I have an
user-defined exception. Is there
a way to send it through the SoapException for a nice
catch in the application ?

René
Nov 12 '05 #2

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

Similar topics

1
by: Joergen Vig | last post by:
Hi, I'm going to create one of the classic checks in Web-development : THE DATE CHECKING ! I have made some kind of statemachine for datechecking, but I don't know where to return the 0 (zero)...
1
by: heikekrieg | last post by:
Hi, i have the problem that a background WorkerThread is calling Objects remote (.NET remoting). Now if the conection is closed my Thread gets an exception. But the Exception should be...
4
by: muz dogru | last post by:
I have made own Exception classes, which extend from Exception. When I throw a new MyException("my error message"), then catch the error and print the message, it's all fine within an application....
2
by: HockeyFan | last post by:
Does anyone have a good genereal exceptionhandling class that can be preferably used with web apps as well as windows apps, but in the least, to be able to work well in web apps. I'm fairly new to...
0
by: job | last post by:
Mohamed Sharaf's has produced a Microsoft.Practices.EnterpriseLibrary production server installer: https://blogs.msdn.com/mohamed_sharafs_blog/archive/2005/09/18/470854.aspx Running the...
5
by: BenCoo | last post by:
Hi, In my ASP.NET application I do some exceptionhandling and redirect the exception with Session("Exception") to an Errorpage.aspx. When I put the error in a label I get the following : ...
0
by: =?Utf-8?B?YW5rMmdv?= | last post by:
Hi, Thanks in advance for reading this. Not sure where to post this question, but I hope someone in here can help. Trying to write to Event Log in VS 2005 (.NET 2.0) using Enterprise Library...
2
by: =?Utf-8?B?UG9sbHkgQW5uYQ==?= | last post by:
Hi, I have been successfully using the EHAB & Logging Application Block. Now however I get the error below and looking on line I was told that I have not set references to all the dlls. I have...
0
by: =?Utf-8?B?UG9sbHkgQW5uYQ==?= | last post by:
Hi, I have previously used EL v 3.1 Exception Handling application block successfully. I thought I would now try to do the same with EL v 4.0. My first experiment was to replace an exception....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
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,...
0
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...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.