axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John G. Norman" <j...@7fff.com>
Subject Re: Web service error handling with POJO approach
Date Wed, 11 Apr 2007 01:51:28 GMT
With a POJO Service:

I have now tried the strategy here:

http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/util/FaultThrowingService.java?view=markup

Still not seeing the exception on the client that calls the service .
. . Still getting:

> FaultReason; nested exception is:
>         java.lang.Exception: This is a test Exception
> java.lang.reflect.InvocationTargetException
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:324)
> [much deleted]
>
> Caused by: org.apache.axis2.AxisFault: FaultReason; nested exception is:
>         java.lang.Exception: This is a test Exception
>         at com.myco.Service.test(Service.java:45)
>         ... 48 more
> Caused by: java.lang.Exception: This is a test Exception
>         ... 49 more
> DEBUG 16:24:37,843 org.apache.axis2.AxisFault: FaultReason; nested
> exception is:
>         java.lang.Exception: This is a test Exception
> DEBUG 16:24:37,843 isReplyRedirected: FaultTo is null. Returning
> isReplyRedirected
> DEBUG 16:24:37,843 isReplyRedirected: ReplyTo is null. Returning false
>

On 4/9/07, John G. Norman <john@7fff.com> wrote:
> Hi all.
>
> This is a great topic -- how to manage exceptions for services built
> on POJOs. If it is as easy as the link Anne Manes provided
> (http://wso2.org/library/171) then throwing exceptions might well be
> included in the main Axis2 docs at
> http://ws.apache.org/axis2/1_1_1/pojoguide.html).
>
> But I just tried throwing an exception out of a POJO's method  (the
> basis for a service as described here:
> http://ws.apache.org/axis2/1_1_1/pojoguide.html), and the exception
> doesn't seem to make it back to the client.
>
> Does the QName need to match one of the faults defined in the client stub?
>
> In any case, the code looks like this:
>
>   public void test() throws AxisFault {
> throw      new AxisFault(new QName("http://test.org", "FaultCode",
> "test"), "FaultReason", new Exception("This is a test Exception"));
>   }
>
> On the server, the trace looks like this:
>
> FaultReason; nested exception is:
>         java.lang.Exception: This is a test Exception
> java.lang.reflect.InvocationTargetException
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:324)
> [much deleted]
>
> Caused by: org.apache.axis2.AxisFault: FaultReason; nested exception is:
>         java.lang.Exception: This is a test Exception
>         at com.myco.Service.test(Service.java:45)
>         ... 48 more
> Caused by: java.lang.Exception: This is a test Exception
>         ... 49 more
> DEBUG 16:24:37,843 org.apache.axis2.AxisFault: FaultReason; nested
> exception is:
>         java.lang.Exception: This is a test Exception
> DEBUG 16:24:37,843 isReplyRedirected: FaultTo is null. Returning
> isReplyRedirected
> DEBUG 16:24:37,843 isReplyRedirected: ReplyTo is null. Returning false
>
> On 4/3/07, Anne Thomas Manes <atmanes@gmail.com> wrote:
> > See http://wso2.org/library/171.
> >
> > On 4/3/07, Chan, Herman <Herman.Chan@inquent.com> wrote:
> > >
> > >
> > >
> > >
> > > Hi all:
> > >
> > >
> > >
> > > I am relatively new to Axis 2 and web services in general, so please bear
> > > with me if I ask any stupid questions.
> > >
> > >
> > >
> > > I am writing a very simple web service that would return a list of
> > > directories on a server.  However, if certain directories does not exists,
> > > I'd like a throw an error back to the calling client.
> > >
> > >
> > >
> > > I am using the POJO approach to create web services using axis2, so is it
> > > good enough for me to throw a plain Exception or do I have to do more?  What
> > > is the best practice in doing error handling in web services?
> > >
> > >
> > >
> > > Thanks in advance.
> > >
> > >
> > >
> > > Herman Chan
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >
> >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Mime
View raw message