473,404 Members | 2,114 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,404 software developers and data experts.

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(SerializationInfo si, StreamingContext
sc) : base(si,sc)

{

}

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

public override void GetObjectData(SerializationInfo si,
StreamingContext sc)
{

base.GetObjectData(si, sc);

si.AddValue("Tipoecc", 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 (MySoapException 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().ToString();
//msg += "\nValore eccezione: " +
mse.Tipoecc.ToString();
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 1899

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

Similar topics

1
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...
2
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...
2
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...
2
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...
1
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...
4
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...
0
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...
4
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...
5
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...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.