File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes Error and exception handling in Web Service Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Error and exception handling in Web Service" Watch "Error and exception handling in Web Service" New topic

Error and exception handling in Web Service

Raghuveer Rawat
Ranch Hand

Joined: Apr 03, 2003
Posts: 102
hi rancher
Anyone who has handled exception and error in web service. Soap Spec says error and exception will be carried in fault element in which it has actor, action, details etc.
But I am in doubt when calling some web service method suppose method throws SQLException what happens in this case soap toolkit automatically generates corresponding fault code. or we have to some additional work for it.
How to process error at client side in case of error or exception.

Raghuveer Rawat<br />SCJP2
Balaji Loganathan
author and deputy

Joined: Jul 13, 2001
Posts: 3150
See this example from Apache axis.. its show how to throw an soap fault when there is no such employee reqeust.. you can try to use the same logic for your case.
Kuldeep Vaishnav
Ranch Hand

Joined: May 23, 2004
Posts: 72
Sorry about jumping on the wagon but I was looking at the example pointed out by Balaji and it seems Mr.Dims has tried to fix the "Bug 19682 - non-AxisFault exceptions don't have details serialized"...But the example fault(NoSuchEmployeeFault)does not contain detail section....can someone please point me to an example containing a user defined fault with details section? I had serious problems trying to implement(which ultimately I could not)a fault with detail section few weeks back.....

I agree. Here's the link:
subject: Error and exception handling in Web Service
It's not a secret anymore!