axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smcar...@spansurf.com
Subject Handling AxisFault Exceptions in Java Client
Date Thu, 11 Mar 2004 16:30:10 GMT
Hi all,

I am relativel new to Axis but have trawled the net and the Axis FAQ for 
answers to the following question without success and have decided to come to 
you for help in my hour of need.

I would like to know how to extract the original exception from an AxisFault.

I have a Stateless Session EJB acting as a Facade running on a Weblogic6.1 
server that has methods defined that throw many application defined exceptions. 
All of the serializable classes used as parameters, return types and exceptions 
are already available to my webservice and clients via a client jar that also 
includes the EJBHome and EJBRemote interfaces for the EJB. 

I have created a large WSDL file describing all of the serializable types 
including the exceptions thrown and run WSDL2java to construct the Service 
classes. This also recreates the serializable types and exceptions but I throw 
these away in favour of the originals defined in the client.jar that I use when 
deploying my service on Tomcat. I forward the calls to my EJB via the 
<Service>BindingImpl.java class generated by WSDL2Java and locate the EJB on 
the WLS server via JNDI. I also get WSDL2Java to create a 
<Service>TestCase.java file which I use as a client test harness.

My problem is that I am unable to get the actual exception thrown by the EJB 
service from the AxisFault that is returned to the client. If I call the 
getCause() method on the AxisFault it is null but the StackTrace contains the 
details.

I have test<X>Exception methods in my EJB that just returns the specified 
exception i.e. testUnknownIdException() throws UnknownIdException

I want to assert in the JUnit testCase that this exception is thrown but I only 
get an AxisFault back with a null value returned from the getCause() method.

How do I reconstruct an exception to test for from this? I need to be able to 
handle these exceptions in my client code such that clients can identify the 
server side exception thrown and handle them by taking alternative/corrective 
action.

Any help here would be appreciated..

Regards

Steve


---------------------------------------------------
This message was sent using Spansurf Web Mail
Internet access in Spain - http://www.spansurf.com/


Mime
View raw message