473,385 Members | 1,337 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,385 software developers and data experts.

ExceptionHandling Web Services

I have made own Exception classes, which extend from Exception. When I
throw a new MyException("my error message"), then catch the error and
print the message, it's all fine within an application. But when I throw
a new MyException in a Web Service and catch it on the "other side", I
only get the message that an Exception was thrown, but not the exact
error message.

How do I have to handle own Exceptions? Is there a good tutorial? Thanks
a lot.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #1
4 1093
Hi Muz!
I believe this is because webservices throw ONLY soap exception whenever
something go wrong within a webmethod so even if the error was something
like connection to DB error that the method try to accomplish , what is
thrown to the client is the soap exception so you might need to attach your
massage to that in your case . checkout this link, hope it helps
http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfSystemWebServicesProtocolsSoapExceptionClassT opic.asp
Mohamed Mahfouz
MEA Developer Support Center
ITworx on behalf of Microsoft EMEA GTSC

Nov 16 '05 #2
hello mohammas,

ok, it seems as if I have to throw a SoapException in every case. Thanks
for the link, that works fine, but the returned ErrorMessage is
something like:

System.Web.Services.Protocols.SoapException: invalid AccountId at
blabla.myThrow(SaferpayException e) in balblaWebService.asmx.cs:line 109
at blablaMethod(string message) in blabla.asmx.cs:line 56

This ErrorMessage is very long and I also don't want the user to know in
which file the exception occured. I just want them to see "invalid
AccountId". Isn't that possible?

Thanks,
Muz

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #3
Isn't that possible? No ideas?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #4
Hi Muz
sorry i was away for a while , sure you can do that , you simply catch the
exception wrap it in your own user exception that has the custom message
that you what to display . hope that helps
Mohamed Mahfouz
MEA Developer Support Center
ITworx on behalf of Microsoft EMEA GTSC

Nov 16 '05 #5

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

Similar topics

4
by: rbt | last post by:
How does one associate a "Description" with a Windows service written in Python? I've just started experimenting with Python services. Here's my code... copied straight from Mr. Hammond's "Python...
6
by: cs | last post by:
I noticed there is some .net services on my winxp. One or two mention the CLR. Does that mean that my .net apps/services wont run before those services start? I need to run my service as early on...
3
by: Matt D | last post by:
I've got two web services that use the same data types and that clients will have to consume. I read the msdn article on sharing types...
7
by: Stu | last post by:
Hi, I have a web service which returns a record set and works well integrated with an asp dot net page. However if I decided to develop a unix app will i be able to read the dataset as it is...
3
by: Olivier BESSON | last post by:
Hello, I have a web service of my own on a server (vb.net). I must declare it with SoapRpcMethod to be used with JAVA. This is a simple exemple method of my vb source : ...
2
by: HockeyFan | last post by:
Does anyone have a good genereal exceptionhandling class that can be preferably used with web apps as well as windows apps, but in the least, to be able to work well in web apps. I'm fairly new to...
2
by: sdstraub | last post by:
I have created 5 services in my project, in the 1st service I set servicestorun = array of all 5 services, I have a project installer with 5 service installers, one for each service. I have code...
5
by: BenCoo | last post by:
Hi, In my ASP.NET application I do some exceptionhandling and redirect the exception with Session("Exception") to an Errorpage.aspx. When I put the error in a label I get the following : ...
0
by: krishnaraju | last post by:
HI to all, please help me.its urgent requirement. my question is this is the wsdl file i got from our client.please see at bottom. when iam trying to access that webmethods iam getting...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...

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.