Hi Jay, Yes it is possible to catch custom faults exactly the way you want. I think if you are getting the expected behaviour it may be due to: 1) DII way of invoking a service won't allow you to catch custom faults Stubs or dynamic proxy approach is fine 2) Check your WSDL there should be mention of your custom fault there at the relevant places. 3) If you generate WSDL by java2wsdl tool then your java interfaces should mention the custom exception thrown by your methods.
This link might be of help to you. http://marc.theaimsgroup.com/?l=axis-user&w=2&r=1&s=sunil+soap+fault&q=b I hope that helps. I can also send you a working example. Sunil Kothari ----- Original Message ----- From: "Jay Glanville" <[EMAIL PROTECTED]> Date: Thursday, March 17, 2005 8:31 am Subject: Is it possible to catch a custom fault? > Hello all. > > I have a custom fault class that extends AxisFault in my Axis server. > It basically holds information about validation errors (invalid > information was passed in). > > public class ValidationFault extends AxisFault { ... } > > I use this fault on methods in my service where information that is > being sent to the server needs to be validated. For example: > > public int addBean( Bean newData ) > throws ValidationFault { > if ( /* bean contains invalid data */ ) { > throw new ValidationFault( /* error info */ ); > } > ... > } > > > Now, on my client, I have a try / catch block that looks something > likethis: > > try { > serverBinding.addBean( badData ); > .... > } catch ( ValidationFault validFault ) { > System.out.println( "caught validation fault" ); > } catch ( AxisFault genFault ) { > System.out.println( "caught validation fault" ); > } > > Now, here's the interesting bit: if my server's method throws a > ValidationFault, my client catches it as an AxisFault, and NOT a > ValidationFault. In other words, my ValidationFault is being > 'dummed-down' into an AxisFault. > > Is this expected behaviour? > > Is it possible to throw AND catch custom faults? If so, how? > > > The reason I'm subclassing AxisFault is because someone on this list > suggested that this is the way to do it > (http://marc.theaimsgroup.com/?l=axis-user&m=110727059025671&w=2). > > > Thanks > > > --- > Jay Glanville > DISCLAIMER: Any Information contained or transmitted in this e-mail and / or attachments may contain confidential data, proprietary to Majoris Systems Pvt Ltd., and / or the authors of the information and is intended for use only by the individual or entity to which it is addressed. If you are not the intended recipient or email appears to have been sent to you by error, you are not authorised to access, read, disclose, copy, use or otherwise deal with it. If you have received this e-mail in error, please notify us immediately at mail to: [EMAIL PROTECTED] and delete this mail from your records. This is to notify that Majoris Systems Pvt Limited shall have no liability or obligation, legal or otherwise, for any errors, omissions, viruses or computer problems experienced as a result of this transmission since data over the public Internet cannot be guaranteed to be secure or error-free.
