Java Mailing List Archive

http://www.java2.5341.com/

Home » axis-user.ws »

Please help on Axis2 Exception handling

Li Ma

2010-02-15

Replies: Find Java Web Hosting

Author LoginPost Reply
Dear All,

I ran into a very weird problem with Axis2 exception handling, which puzzled me for long time. Any help from you Axis2 expert will be greately appreciated!

This is what I did:

1. Get my service POJO ready. All method throws a customized MyException which is derived from java.lang.Exception
2. Use Axis2 java2wsdl to convert this POJO to WSDL,. I can see the wsdl:fault part of each service call has been created successfully with name as MyException
3. Then use wsdl2java to generate client side API with ADB binding. Suddenly Axis2 creates a bunch of exception related classes, such as:
MyExceptionException
MyExceptionE
xsd/MyException

The methods will throw MyExceptionException, which contains MyExceptionE, which contains xsd/MyException. The xsd/MyException has all properties I defined at server side. Method also throw AxisFault.

When I run the client code and throw MyException on server, at client side, I could only catch AxisFault exception which reason string as return of MyException.getMessage() defined on server. I could never catch MyException nor MyExceptionException at client side. This is the bigest issue that troubled me. If Axis2 has to wrap everything in AxisFault at client side, fine, but whey wsdl2java still throws MyExceptionException in generated code and never throw it?

Thanks a lot!

Li
©2008 java2.5341.com - Jax Systems, LLC, U.S.A.