[prev in list] [next in list] [prev in thread] [next in thread]
List: axis-user
Subject: Re: AxisFault, CustomException and code first approach
From: "Martin Gainty" <mgainty () hotmail ! com>
Date: 2000-11-30 15:30:03
Message-ID: BAY108-DAV10257163015865BB30A6F3AE710 () phx ! gbl
[Download RAW message or body]
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: axis-user@ws.apache.org
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!
[Attachment #3 (text/html)]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<STYLE>.hmmessage P {
PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; \
PADDING-TOP: 0px }
BODY.hmmessage {
FONT-SIZE: 10pt; FONT-FAMILY: Tahoma
}
</STYLE>
<META content="MSHTML 6.00.2800.1106" name=GENERATOR></HEAD>
<BODY class=hmmessage bgColor=#ffffff>
<DIV><FONT face=Arial>Hello Par</FONT></DIV>
<DIV><FONT face=Arial><BR>I would first try to attenuate the axis2.xml
parameter StackTrace e.g.</FONT></DIV>
<DIV><FONT face=Arial> <parameter
name="sendStacktraceDetailsWithFaults">false</parameter><BR><BR>Martin--</FONT></DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 \
2px solid; MARGIN-RIGHT: 0px"> <DIV style="FONT: 10pt arial">----- Original Message \
----- </DIV> <DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=par_malmqvist@hotmail.com href="mailto:par_malmqvist@hotmail.com">Pär
Malmqvist</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=axis-user@ws.apache.org
href="mailto:axis-user@ws.apache.org">axis-user@ws.apache.org</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Friday, November 30, 2007 9:49
AM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> AxisFault, CustomException and
code first approach</DIV>
<DIV><BR></DIV>Hi!<BR>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)<BR>The custom exception appears on the client
side in the AxisFault details field within <exception><exception>
-tags together with a HUGE stack trace.<BR> <BR>I have checked the
source code for RPCMesssageReceiver and specially the section that handles the
AxisFault:<BR>} catch (InvocationTargetException e)
{<BR> String
msg =
null;<BR>
Throwable cause =
e.getCause();<BR> \
if (cause != null)
{<BR> \
msg =
cause.getMessage();<BR> \
}<BR> if
(msg == null)
{<BR> \
msg = "Exception occurred while trying to invoke service method "
+<BR> \
method.getName();<BR> \
}<BR> if
(cause instanceof AxisFault)
{<BR> \
log.debug(msg,
cause);<BR> \
throw
(AxisFault)cause;<BR> \
}<BR>
log.error(msg,
e);<BR>
throw new AxisFault(msg, e);<BR> }
catch(RuntimeException e)
{<BR> throw
AxisFault.makeFault(e);<BR> } catch
(Exception e)
{<BR> String
msg = "Exception occurred while trying to invoke service method "
+<BR> \
method.getName();<BR> \
log.error(msg,
e);<BR>
throw AxisFault.makeFault(e);<BR>
}<BR>}<BR>Could it be possible to change this code a little bit to throw an
AxisFault with a CustomException only in the details field? <BR>Like: The
AxisFault.getDetails() returns something
like <CustomException>custom message...
</CustomException><BR>It would be much easier to handle the exception on
the client side!<BR>What do you gurus
think?<BR> <BR>/Pär<BR> <BR> <BR> <BR> <BR> <BR><BR> <BR><BR>
<HR>
Invite your mail contacts to join your friends list with Windows Live Spaces.
It's easy! <A
href="http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us" \
target=_new>Try it!</A> </BLOCKQUOTE></BODY></HTML>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic