users@glassfish.java.net

Re: Re: exception handling in EJB3 Stateless and JAX -WS. guide tutorial example...

From: Mohammad Shamsi <m.h.shams_at_gmail.com>
Date: Tue, 27 May 2008 10:31:52 +0330

Hi,

i run a test with netbeans, (a web service client with netbeans) and i stack
trace is :

javax.xml.ws.soap.SOAPFaultException: javax.ejb.EJBException
        at...

Caused by: javax.ejb.EJBException
        at...

Caused by: FooException: test message
        at...

i just throw a FooException in my Web Method.

On Mon, May 26, 2008 at 1:17 PM, Mohammad Shamsi <m.h.shams_at_gmail.com>
wrote:

> but i tested it before, result :
>
> 1 - FooException is RuntimeException : i got EJBException in JAX WS client
> without any clear message or stack trace.
>
> 2 - FooException is not RuntimeException : in JAX WS client i got another
> exception during FooException.setMessage() method call. (FooException has a
> String message)
>
>
>
>
> On Mon, May 26, 2008 at 12:50 PM, Markus Karg <karg_at_quipsy.de> wrote:
>
>> AFAIK in your current situation you do not need to worry about specific
>> exceptions. Just throw all the business exceptions that you need and do not
>> care for whether the client is using RMI or SOAP. AFAIK @WebServices is
>> wrapping any business exception sufficiently, so when using JAX-WS on the
>> client side, you will catch exactly the same Java Exception again -- while
>> beeing *transported* by SOAP. You do not need to throw SOAP or RMI specific
>> exceptions. Just throw a FooException.
>>
>>
>>
>> I can remember I tried out months ago and it worked well, but I am no SOAP
>> guru. Just give it a try and let us know whether it works. :-)
>>
>>
>>
>> Regards
>>
>> Markus
>>
>>
>>
>> *From:* Mohammad Shamsi [mailto:m.h.shams_at_gmail.com]
>> *Sent:* Montag, 26. Mai 2008 08:50
>> *To:* users_at_glassfish.dev.java.net
>> *Subject:* Re: exception handling in EJB3 Stateless and JAX -WS. guide
>> tutorial example...
>>
>>
>>
>> Hi Markus,
>>
>> In Java EE 5 we can one code for both Session Bean and Web Service.
>>
>> @WebService
>> @Stateless
>> public class FooImpl implements Foo {
>> public void dofoo() {
>> }
>> }
>>
>> clients can call dofoo method, either via RMI (as a Session Bean) or
>> SOAP/HTTP (as a web method)
>>
>> for web service clients i can throw just a SOAPFaultException and for RMI
>> clients i can throw any exception.
>>
>> i have to know that how to handle and throw exception from this method
>> that both clients can use it.
>>
>>
>> On Mon, May 26, 2008 at 9:57 AM, Markus Karg <karg_at_quipsy.de> wrote:
>>
>> What exactly do you want to know?
>>
>>
>>
>> Regards
>>
>> Markus
>>
>>
>>
>> *From:* Mohammad Shamsi [mailto:m.h.shams_at_gmail.com]
>> *Sent:* Samstag, 24. Mai 2008 12:33
>> *To:* users_at_glassfish.dev.java.net
>> *Subject:* exception handling in EJB3 Stateless and JAX -WS. guide
>> tutorial example...
>>
>>
>>
>> hi all,
>>
>> im looking for guides and examples for Exception Handling in EJB3
>> Stateless Session Bean and JAX WS
>>
>> any resources ? idea ?
>>
>>
>>
>>
>> --
>> sincerely yours
>> M. H. Shamsi
>>
>>
>>
>>
>> --
>> sincerely yours
>> M. H. Shamsi
>>
>
>
>
> --
> sincerely yours
> M. H. Shamsi
>



-- 
sincerely yours
M. H. Shamsi