473,796 Members | 2,603 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 1923

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
1040
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
3229
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
8522
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
1489
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
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
10465
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...
0
10242
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10021
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6800
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
5453
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
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.