473,785 Members | 2,165 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

catch Custom SoapException

Hi programmers, I'm quite new in this blog, I have a question
concerning web services Soap Exceptions: I created a class
MySoapException derived from SoapException, I add the references both
server-side and client-side, and I tried to implement correctly
serialization, I mean, the "ability" of a class to be used through a
web services communication (that's not so correct, I hope you
understand what I mean).
Here is my class:

[Serializable]
public class MySoapException : SoapException, ISerializable
{
//private string tipoecc;

public MySoapException () : base()
{
//
// TODO: Add constructor logic here
//

}
public MySoapException (SerializationI nfo si, StreamingContex t
sc) : base(si,sc)

{

}

public string Tipoecc
{
get { return tipoecc; }
set { tipoecc = value; }
}

public override void GetObjectData(S erializationInf o si,
StreamingContex t sc)
{

base.GetObjectD ata(si, sc);

si.AddValue("Ti poecc", tipoecc);

}
}

In this way, the new Property Tipoecc shoud be understood and
deserializad correctly by the (soap) client.
The web service throw the customized SoapException in this way:

MySoapException myexc = new MySoapException ();
myexc.Tipoecc = "1";
throw myexc;

I set the value of TipoEcc = "1".
The following code is client-side:

catch (MySoapExceptio n mse)
{

//nel caso sincrono l'eccezione non è contenuta
nel campo InnerException

//la proprietà Tipoecc indica il valore custom con
cui è definita l'eccezione
string msg;
msg = mse.Message;
msg += "\nTipo eccezione: " +
mse.GetType().T oString();
//msg += "\nValore eccezione: " +
mse.Tipoecc.ToS tring();
MessageBox.Show (msg);

}

I think it should catch the custom exception, because I add the same
reference to the dll containing the implementation of the class
MySoapException .
But... it doesn't work!!!
The client catches the Exception ONLY as SoapException, and nothing
else.
I know there is another pretty way to pass custom fields or attributes
by appending a new XMLNode to the Detail property of a SoapException,
and it also works good... But I would like to know WHERE is my mistake
(or my mistakes...).
Thanks a lot.
Giulio

Jun 6 '06 #1
0 1488

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

Similar topics

1
1490
by: Chris Dunaway | last post by:
I'm creating a Web service and a Windows Forms application to consume it. My question is about throwing a custom exception inside the WebService. Can that be done, and can the custom web service be handled in the Windows Forms app? For example, suppose in my WebService, I have the following exception class: '\\\\\ <Serializable()> _
2
1039
by: Rasika WIJAYARATNE | last post by:
I've got a C++/CLI winforms app that calls web services. I am trying to wrap my calls the WS in a try/catch block and need to catch the following two exceptions: System.Net.WebException Thrown when no connection to internet on client computer. System.Web.Services.Protocols.SoapException Thrown when WS server's SqlServer is unavailable (WS returns data from the SqlServer).
2
2545
by: Matt | last post by:
Hello all, The app we are working on uses custom errors extensively to provide friendly error pages to users whilst logging the actual exceptions behind the scenes. However.... We are now having to integrate some Web services into the application using the existing architecture. These Web services are secured using Forms Authentication. Hence, we need to turn the default behavior of Forms Authentication (redirects to login pages, etc)...
2
2411
by: dan | last post by:
hi ng. i have a asp.net application which is client of an asp.net webservice. now i want to configure a custom error page (in case the sewrvice throws an exception) that provides the soapexception detail property as text. but when defined in web.config, the error page doesn't provide access to the thrown exception anymore. i think that i somehow have to enter the http pipeline to catch the error, read the data and transfer to a error...
1
3228
by: Vinoth Kumar | last post by:
Hi All, I have a problem in throwing custom exceptions from a webservice method. The custom exception is being converted into soapexception in the webservice client. only the custom exception message is present in the soapexception . Is there any way to get the exact custom exception instead of soapexception? Thanks in advance
4
8521
by: asanford | last post by:
http://msdn2.microsoft.com/en-us/library/ds492xtk.aspx Is this the following excerpt from the above page incorrect, or is there a bug in the .net 2.0 implementation? Or perhaps I have something configured wrong. Basically, the doc says that when a custom exception type is thrown from a web method, that the web service client app will receive a soapexception with the soapexception.InnerException property set to reference the custom...
0
1922
by: Giulio | last post by:
Hi programmers, I'm quite new in this blog, I have a question concerning web services Soap Exceptions: I created a class MySoapException derived from SoapException, I add the references both server-side and client-side, and I tried to implement correctly serialization, I mean, the "ability" of a class to be used through a web services communication (that's not so correct, I hope you understand what I mean). Here is my class:
4
4477
by: Nol de Wit | last post by:
(this is a re-post of a message I've posted last friday, but now from my MSDN subscription account, hoping MSDN support will pick this up...) Hi all, My webservice throws an exception, which is translated into a soap Fault in the soap message body. See below for the actual message format as it is send by the server. On the (dotNet) client I get (catch) this as a SoapException (or SoapHeaderException). The SoapException contains...
5
5361
by: =?Utf-8?B?a3Jpcw==?= | last post by:
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...
0
9647
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
9489
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
10356
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
10100
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
7509
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
6744
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
5528
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2893
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.