Solved

C# web reference and exception

Posted on 2011-03-11
4
527 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

705 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now