You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Lars-Fredrik Smedberg <it...@gmail.com> on 2015/01/27 20:54:56 UTC

Quesion on Interceptors and WebService classes

Hi

As far as I understood from previous discussions and from reading e.g.
JSR-109:

*Spec *says/allows

- Allows Stateless/Singleton EJBs to be exposed as WebServices

*TomEE *allows (in addition to the spec)

- Also allows a WebService to be annotated with any CDI scope (and possibly
also Stateful EJBs?)

I also understood from before (answer from Romain) that the default for the
CXF based WebService is for the container to create it using new ....();

=>

*Questions:*

1. Does the above imply that I need to annotate a WebService with
@Stateless or @Singleton (if following the spec) to be able to use CDI/EJB
Interceptors on it?
2. If I run TomEE I understand that I also can annotated the WebService
e.g. @ApplicationScoped to be able to use CDI/EJB Interceptors on it,
correct?
3. Maybe more of a CXF question but I try anyway, is there any way that I
in the onFault(...) method of a Logical/SoapHandler can see what Exception
caused the SoapFault? I would like to know this to be able to, for a
specific runtime exception, modify the FaultCode.

Ps. The way I do now is to use an interceptor on the WebService
implementation bean and there catch and possible rethrow some exceptions as
SoapFaultExceptions.
Ps2. For @WebFault annotated checked exceptions and most of the runtime
exceptions the above mentioned interceptor does nothing but rethrow


-- 
Med vänlig hälsning / Best regards

Lars-Fredrik Smedberg

STATEMENT OF CONFIDENTIALITY:
The information contained in this electronic message and any
attachments to this message are intended for the exclusive use of the
address(es) and may contain confidential or privileged information. If
you are not the intended recipient, please notify Lars-Fredrik Smedberg
immediately at itsmeden@gmail.com, and destroy all copies of this
message and any attachments.

Re: Quesion on Interceptors and WebService classes

Posted by Lars-Fredrik Smedberg <it...@gmail.com>.
@Romain, thanks for the answers... will take a look at the CXF
Interceptors....

Regards
LF

On Tue, Jan 27, 2015 at 10:42 PM, Romain Manni-Bucau <rm...@gmail.com>
wrote:

> You can also define your pojo in web.xml IIRC but youll only get cdi
> injextion then writing a delegate pattern allows you to have interceptors.
>
> Not OOTB example but using PhaseInterceptor should do the trick whatever
> solution you choose or a cxf interceptor allows you to do it without any
> hack.
>  Le 27 janv. 2015 21:37, "Lars-Fredrik Smedberg" <it...@gmail.com> a
> écrit :
>
> > Hi Romain
> >
> > Thanks for the quick reply.
> >
> > Is 1 required if need to follow the spec?
> >
> > 3. Does this require using a CXF Interceptor or can I use a plain
> > SoapHandler/LogicalHandler... if so do you have any example pointers?
> >
> > Thanks
> >
> > On Tue, Jan 27, 2015 at 8:58 PM, Romain Manni-Bucau <
> rmannibucau@gmail.com
> > >
> > wrote:
> >
> > > Hello
> > >
> > > 1/2. need no, I think we added recently support for plain CDI beans
> > > 3. you can using cxf and reading it from cxf Message - yes more a cxf
> > > question ;)
> > >
> > >
> > > Romain Manni-Bucau
> > > @rmannibucau
> > > http://www.tomitribe.com
> > > http://rmannibucau.wordpress.com
> > > https://github.com/rmannibucau
> > >
> > >
> > > 2015-01-27 20:54 GMT+01:00 Lars-Fredrik Smedberg <it...@gmail.com>:
> > > > Hi
> > > >
> > > > As far as I understood from previous discussions and from reading
> e.g.
> > > > JSR-109:
> > > >
> > > > *Spec *says/allows
> > > >
> > > > - Allows Stateless/Singleton EJBs to be exposed as WebServices
> > > >
> > > > *TomEE *allows (in addition to the spec)
> > > >
> > > > - Also allows a WebService to be annotated with any CDI scope (and
> > > possibly
> > > > also Stateful EJBs?)
> > > >
> > > > I also understood from before (answer from Romain) that the default
> for
> > > the
> > > > CXF based WebService is for the container to create it using new
> > ....();
> > > >
> > > > =>
> > > >
> > > > *Questions:*
> > > >
> > > > 1. Does the above imply that I need to annotate a WebService with
> > > > @Stateless or @Singleton (if following the spec) to be able to use
> > > CDI/EJB
> > > > Interceptors on it?
> > > > 2. If I run TomEE I understand that I also can annotated the
> WebService
> > > > e.g. @ApplicationScoped to be able to use CDI/EJB Interceptors on it,
> > > > correct?
> > > > 3. Maybe more of a CXF question but I try anyway, is there any way
> > that I
> > > > in the onFault(...) method of a Logical/SoapHandler can see what
> > > Exception
> > > > caused the SoapFault? I would like to know this to be able to, for a
> > > > specific runtime exception, modify the FaultCode.
> > > >
> > > > Ps. The way I do now is to use an interceptor on the WebService
> > > > implementation bean and there catch and possible rethrow some
> > exceptions
> > > as
> > > > SoapFaultExceptions.
> > > > Ps2. For @WebFault annotated checked exceptions and most of the
> runtime
> > > > exceptions the above mentioned interceptor does nothing but rethrow
> > > >
> > > >
> > > > --
> > > > Med vänlig hälsning / Best regards
> > > >
> > > > Lars-Fredrik Smedberg
> > > >
> > > > STATEMENT OF CONFIDENTIALITY:
> > > > The information contained in this electronic message and any
> > > > attachments to this message are intended for the exclusive use of the
> > > > address(es) and may contain confidential or privileged information.
> If
> > > > you are not the intended recipient, please notify Lars-Fredrik
> Smedberg
> > > > immediately at itsmeden@gmail.com, and destroy all copies of this
> > > > message and any attachments.
> > >
> >
> >
> >
> > --
> > Med vänlig hälsning / Best regards
> >
> > Lars-Fredrik Smedberg
> >
> > STATEMENT OF CONFIDENTIALITY:
> > The information contained in this electronic message and any
> > attachments to this message are intended for the exclusive use of the
> > address(es) and may contain confidential or privileged information. If
> > you are not the intended recipient, please notify Lars-Fredrik Smedberg
> > immediately at itsmeden@gmail.com, and destroy all copies of this
> > message and any attachments.
> >
>



-- 
Med vänlig hälsning / Best regards

Lars-Fredrik Smedberg

STATEMENT OF CONFIDENTIALITY:
The information contained in this electronic message and any
attachments to this message are intended for the exclusive use of the
address(es) and may contain confidential or privileged information. If
you are not the intended recipient, please notify Lars-Fredrik Smedberg
immediately at itsmeden@gmail.com, and destroy all copies of this
message and any attachments.

Re: Quesion on Interceptors and WebService classes

Posted by Romain Manni-Bucau <rm...@gmail.com>.
You can also define your pojo in web.xml IIRC but youll only get cdi
injextion then writing a delegate pattern allows you to have interceptors.

Not OOTB example but using PhaseInterceptor should do the trick whatever
solution you choose or a cxf interceptor allows you to do it without any
hack.
 Le 27 janv. 2015 21:37, "Lars-Fredrik Smedberg" <it...@gmail.com> a
écrit :

> Hi Romain
>
> Thanks for the quick reply.
>
> Is 1 required if need to follow the spec?
>
> 3. Does this require using a CXF Interceptor or can I use a plain
> SoapHandler/LogicalHandler... if so do you have any example pointers?
>
> Thanks
>
> On Tue, Jan 27, 2015 at 8:58 PM, Romain Manni-Bucau <rmannibucau@gmail.com
> >
> wrote:
>
> > Hello
> >
> > 1/2. need no, I think we added recently support for plain CDI beans
> > 3. you can using cxf and reading it from cxf Message - yes more a cxf
> > question ;)
> >
> >
> > Romain Manni-Bucau
> > @rmannibucau
> > http://www.tomitribe.com
> > http://rmannibucau.wordpress.com
> > https://github.com/rmannibucau
> >
> >
> > 2015-01-27 20:54 GMT+01:00 Lars-Fredrik Smedberg <it...@gmail.com>:
> > > Hi
> > >
> > > As far as I understood from previous discussions and from reading e.g.
> > > JSR-109:
> > >
> > > *Spec *says/allows
> > >
> > > - Allows Stateless/Singleton EJBs to be exposed as WebServices
> > >
> > > *TomEE *allows (in addition to the spec)
> > >
> > > - Also allows a WebService to be annotated with any CDI scope (and
> > possibly
> > > also Stateful EJBs?)
> > >
> > > I also understood from before (answer from Romain) that the default for
> > the
> > > CXF based WebService is for the container to create it using new
> ....();
> > >
> > > =>
> > >
> > > *Questions:*
> > >
> > > 1. Does the above imply that I need to annotate a WebService with
> > > @Stateless or @Singleton (if following the spec) to be able to use
> > CDI/EJB
> > > Interceptors on it?
> > > 2. If I run TomEE I understand that I also can annotated the WebService
> > > e.g. @ApplicationScoped to be able to use CDI/EJB Interceptors on it,
> > > correct?
> > > 3. Maybe more of a CXF question but I try anyway, is there any way
> that I
> > > in the onFault(...) method of a Logical/SoapHandler can see what
> > Exception
> > > caused the SoapFault? I would like to know this to be able to, for a
> > > specific runtime exception, modify the FaultCode.
> > >
> > > Ps. The way I do now is to use an interceptor on the WebService
> > > implementation bean and there catch and possible rethrow some
> exceptions
> > as
> > > SoapFaultExceptions.
> > > Ps2. For @WebFault annotated checked exceptions and most of the runtime
> > > exceptions the above mentioned interceptor does nothing but rethrow
> > >
> > >
> > > --
> > > Med vänlig hälsning / Best regards
> > >
> > > Lars-Fredrik Smedberg
> > >
> > > STATEMENT OF CONFIDENTIALITY:
> > > The information contained in this electronic message and any
> > > attachments to this message are intended for the exclusive use of the
> > > address(es) and may contain confidential or privileged information. If
> > > you are not the intended recipient, please notify Lars-Fredrik Smedberg
> > > immediately at itsmeden@gmail.com, and destroy all copies of this
> > > message and any attachments.
> >
>
>
>
> --
> Med vänlig hälsning / Best regards
>
> Lars-Fredrik Smedberg
>
> STATEMENT OF CONFIDENTIALITY:
> The information contained in this electronic message and any
> attachments to this message are intended for the exclusive use of the
> address(es) and may contain confidential or privileged information. If
> you are not the intended recipient, please notify Lars-Fredrik Smedberg
> immediately at itsmeden@gmail.com, and destroy all copies of this
> message and any attachments.
>

Re: Quesion on Interceptors and WebService classes

Posted by Lars-Fredrik Smedberg <it...@gmail.com>.
Hi Romain

Thanks for the quick reply.

Is 1 required if need to follow the spec?

3. Does this require using a CXF Interceptor or can I use a plain
SoapHandler/LogicalHandler... if so do you have any example pointers?

Thanks

On Tue, Jan 27, 2015 at 8:58 PM, Romain Manni-Bucau <rm...@gmail.com>
wrote:

> Hello
>
> 1/2. need no, I think we added recently support for plain CDI beans
> 3. you can using cxf and reading it from cxf Message - yes more a cxf
> question ;)
>
>
> Romain Manni-Bucau
> @rmannibucau
> http://www.tomitribe.com
> http://rmannibucau.wordpress.com
> https://github.com/rmannibucau
>
>
> 2015-01-27 20:54 GMT+01:00 Lars-Fredrik Smedberg <it...@gmail.com>:
> > Hi
> >
> > As far as I understood from previous discussions and from reading e.g.
> > JSR-109:
> >
> > *Spec *says/allows
> >
> > - Allows Stateless/Singleton EJBs to be exposed as WebServices
> >
> > *TomEE *allows (in addition to the spec)
> >
> > - Also allows a WebService to be annotated with any CDI scope (and
> possibly
> > also Stateful EJBs?)
> >
> > I also understood from before (answer from Romain) that the default for
> the
> > CXF based WebService is for the container to create it using new ....();
> >
> > =>
> >
> > *Questions:*
> >
> > 1. Does the above imply that I need to annotate a WebService with
> > @Stateless or @Singleton (if following the spec) to be able to use
> CDI/EJB
> > Interceptors on it?
> > 2. If I run TomEE I understand that I also can annotated the WebService
> > e.g. @ApplicationScoped to be able to use CDI/EJB Interceptors on it,
> > correct?
> > 3. Maybe more of a CXF question but I try anyway, is there any way that I
> > in the onFault(...) method of a Logical/SoapHandler can see what
> Exception
> > caused the SoapFault? I would like to know this to be able to, for a
> > specific runtime exception, modify the FaultCode.
> >
> > Ps. The way I do now is to use an interceptor on the WebService
> > implementation bean and there catch and possible rethrow some exceptions
> as
> > SoapFaultExceptions.
> > Ps2. For @WebFault annotated checked exceptions and most of the runtime
> > exceptions the above mentioned interceptor does nothing but rethrow
> >
> >
> > --
> > Med vänlig hälsning / Best regards
> >
> > Lars-Fredrik Smedberg
> >
> > STATEMENT OF CONFIDENTIALITY:
> > The information contained in this electronic message and any
> > attachments to this message are intended for the exclusive use of the
> > address(es) and may contain confidential or privileged information. If
> > you are not the intended recipient, please notify Lars-Fredrik Smedberg
> > immediately at itsmeden@gmail.com, and destroy all copies of this
> > message and any attachments.
>



-- 
Med vänlig hälsning / Best regards

Lars-Fredrik Smedberg

STATEMENT OF CONFIDENTIALITY:
The information contained in this electronic message and any
attachments to this message are intended for the exclusive use of the
address(es) and may contain confidential or privileged information. If
you are not the intended recipient, please notify Lars-Fredrik Smedberg
immediately at itsmeden@gmail.com, and destroy all copies of this
message and any attachments.

Re: Quesion on Interceptors and WebService classes

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hello

1/2. need no, I think we added recently support for plain CDI beans
3. you can using cxf and reading it from cxf Message - yes more a cxf
question ;)


Romain Manni-Bucau
@rmannibucau
http://www.tomitribe.com
http://rmannibucau.wordpress.com
https://github.com/rmannibucau


2015-01-27 20:54 GMT+01:00 Lars-Fredrik Smedberg <it...@gmail.com>:
> Hi
>
> As far as I understood from previous discussions and from reading e.g.
> JSR-109:
>
> *Spec *says/allows
>
> - Allows Stateless/Singleton EJBs to be exposed as WebServices
>
> *TomEE *allows (in addition to the spec)
>
> - Also allows a WebService to be annotated with any CDI scope (and possibly
> also Stateful EJBs?)
>
> I also understood from before (answer from Romain) that the default for the
> CXF based WebService is for the container to create it using new ....();
>
> =>
>
> *Questions:*
>
> 1. Does the above imply that I need to annotate a WebService with
> @Stateless or @Singleton (if following the spec) to be able to use CDI/EJB
> Interceptors on it?
> 2. If I run TomEE I understand that I also can annotated the WebService
> e.g. @ApplicationScoped to be able to use CDI/EJB Interceptors on it,
> correct?
> 3. Maybe more of a CXF question but I try anyway, is there any way that I
> in the onFault(...) method of a Logical/SoapHandler can see what Exception
> caused the SoapFault? I would like to know this to be able to, for a
> specific runtime exception, modify the FaultCode.
>
> Ps. The way I do now is to use an interceptor on the WebService
> implementation bean and there catch and possible rethrow some exceptions as
> SoapFaultExceptions.
> Ps2. For @WebFault annotated checked exceptions and most of the runtime
> exceptions the above mentioned interceptor does nothing but rethrow
>
>
> --
> Med vänlig hälsning / Best regards
>
> Lars-Fredrik Smedberg
>
> STATEMENT OF CONFIDENTIALITY:
> The information contained in this electronic message and any
> attachments to this message are intended for the exclusive use of the
> address(es) and may contain confidential or privileged information. If
> you are not the intended recipient, please notify Lars-Fredrik Smedberg
> immediately at itsmeden@gmail.com, and destroy all copies of this
> message and any attachments.