Solved

C# web reference and exception

Posted on 2011-03-11
4
553 Views
Last Modified: 2012-05-11
Hi,
Java web service is passing me a custom exception: NoIncomeException, which is a soapfault. That is actually a soapexception. I've to create a custom exception that exposes that exception to all my .Net project.

Problem is that only way I can catch that exception is
catch(SoapException ex)
{
if ex.message.contains("No Income Exception");
}

so I've to build my customeexception such that this condition is tested. I've no idea how to do that. Can somebody help please?
0
Comment
Question by:vivekj2004
  • 3
4 Comments
 
LVL 19

Expert Comment

by:daveamour
ID: 35115734
if ex.message.contains("No Income Exception")
{
    throw new MyCustomException();
}

Where MyCustiomException is one you write inheriting from Exception

Is that what you need?
0
 

Accepted Solution

by:
vivekj2004 earned 0 total points
ID: 35129009
Thanks daveamour,
       for this solution, exception ex has to inherit from soapexception, and when I do that, I get an error saying that custom exceptions have to inherit from System.Exception.

Can you provide a solution for this problem
0
 

Author Comment

by:vivekj2004
ID: 35460587
I didn't get any meaningful response, so I accepted my answer as solution.
0
 

Author Closing Comment

by:vivekj2004
ID: 35496436
I don't have acceptable answer to this question.
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question