Hello Par
I would first try to attenuate the axis2.xml parameter StackTrace e.g.
<parameter name="sendStacktraceDetailsWithFaults">false</parameter>
Martin--
----- Original Message -----
From: Pär Malmqvist
To: [email protected]
Sent: Friday, November 30, 2007 9:49 AM
Subject: AxisFault, CustomException and code first approach
Hi!
When creating a web service using existing business logic with "code first"
approach I dont think custom exceptions are handled the way it should. (Axis2
1.3)
The custom exception appears on the client side in the AxisFault details
field within <exception><exception> -tags together with a HUGE stack trace.
I have checked the source code for RPCMesssageReceiver and specially the
section that handles the AxisFault:
} catch (InvocationTargetException e) {
String msg = null;
Throwable cause = e.getCause();
if (cause != null) {
msg = cause.getMessage();
}
if (msg == null) {
msg = "Exception occurred while trying to invoke service
method " +
method.getName();
}
if (cause instanceof AxisFault) {
log.debug(msg, cause);
throw (AxisFault)cause;
}
log.error(msg, e);
throw new AxisFault(msg, e);
} catch(RuntimeException e) {
throw AxisFault.makeFault(e);
} catch (Exception e) {
String msg = "Exception occurred while trying to invoke service
method " +
method.getName();
log.error(msg, e);
throw AxisFault.makeFault(e);
}
}
Could it be possible to change this code a little bit to throw an AxisFault
with a CustomException only in the details field?
Like: The AxisFault.getDetails() returns something like
<CustomException>custom message... </CustomException>
It would be much easier to handle the exception on the client side!
What do you gurus think?
/Pär
------------------------------------------------------------------------------
Invite your mail contacts to join your friends list with Windows Live Spaces.
It's easy! Try it!