cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nguyen Minh Tuan <minhtuan2...@gmail.com>
Subject Re: Initialize service context
Date Tue, 12 Jul 2011 17:41:57 GMT
Thanks Sergey,

yes, I registered an input interceptor and it worked as recommended. Thanks
a lot for your help.

On Wed, Jul 13, 2011 at 2:55 AM, Sergey Beryozkin <sberyozkin@gmail.com>wrote:

> Hi, JAX-WS WebServiceContext is probably doing get() on the current
> Message but does not check contextualProperties (the ones set up
> before the endpoint has been published). Dan can probably confirm that
> - try registering a basic CXF input interceptor and set needed
> properties on the in message, the added bonus is that you can analyze
> the incoming payload if needed and add some dynamism to the way
> properties are set
> Cheers, Sergey
>
> On Tue, Jul 12, 2011 at 4:29 PM, Nguyen Minh Tuan
> <minhtuan2712@gmail.com> wrote:
> > Hi Sergey,
> >
> > I tried to set properties using JaxWsServerFactoryBean and then retrieve
> the
> > properties from the service implementation but couldn't do it.
> >
> > Btw, I have the following code snippet to set properties before
> deployment:
> >
> >        JaxWsServerFactoryBean serverFactoryBean = new
> > JaxWsServerFactoryBean();
> >        serverFactoryBean.setServiceClass(CustomerServiceImpl.class);
> >        serverFactoryBean.setAddress("
> > http://localhost:9090/CustomerServicePort");
> >
> >        serverFactoryBean.setProperties(new HashMap<String, Object>());
> >        serverFactoryBean.getProperties().put("ContentBasedCheck",
> > Boolean.TRUE);
> >        serverFactoryBean.getProperties().put("URLBasedCheck",
> > Boolean.FALSE);
> >
> >        serverFactoryBean.create();
> >
> > And in my service implementation, I have the following:
> >    @Resource
> >    private WebServiceContext context;
> >
> > Then I tried to use context.getMessageContext() to retrieve those
> properties
> > but couldn't find any. What did I do wrong?
> >
> > On Tue, Jul 12, 2011 at 10:24 PM, Sergey Beryozkin <sberyozkin@gmail.com
> >wrote:
> >
> >> You can set the properties on JAXWSServerFactoryBean or using
> >> jaxws:endpoint/jaxws:properties and WebServiceContext.get() should
> >> provide an access to those properties
> >> Alternatively, set the properties on a current message from the in
> >> interceptor
> >> Cheers, Sergey
> >>
> >> On Tue, Jul 12, 2011 at 12:48 PM, Nguyen Minh Tuan
> >> <minhtuan2712@gmail.com> wrote:
> >> > Thanks Sergey,
> >> >
> >> > How do you set values to properties in WebServiceContext before
> >> deployment?
> >> >
> >> > On Tue, Jul 12, 2011 at 8:42 PM, Sergey Beryozkin <
> sberyozkin@gmail.com
> >> >wrote:
> >> >
> >> >> Hi,
> >> >>
> >> >> On Tue, Jul 12, 2011 at 11:31 AM, Nguyen Minh Tuan
> >> >> <minhtuan2712@gmail.com> wrote:
> >> >> > Hi all,
> >> >> >
> >> >> > In my service implementation, I want to refer to some properties
> set
> >> in
> >> >> my
> >> >> > service context. Based on these properties, the implementation
> logic
> >> >> > changes. And such properties are set before I deploy the service,
> i.e.
> >> >> > before invoking Endpoint.publish() to create an implementor. By
> this
> >> way,
> >> >> I
> >> >> > can change the service's behavior via different values set to
the
> >> >> > properties.
> >> >> >
> >> >> > I read about WebServiceContext but it seems not what I am looking
> for.
> >> >> Since
> >> >> > all values in WebServiceContext are only retrievable and usable
in
> out
> >> >> > interceptors. What I needs is to use those values in my service
> >> >> > implementation.
> >> >> >
> >> >> > Could anyone explain to me what I should do in this case?
> >> >> >
> >> >> I think WebServiceContext.get() can be used to get to propreties
> which
> >> >> have been set before the endpoint publication,
> >> >> CXF specific
> >> >> PhaseInterceptorChain.getCurrentMessage().getContextualProperty()
> >> >> will also work
> >> >>
> >> >> Cheers. Sergey
> >> >>
> >> >> > --
> >> >> > Best regards,
> >> >> > Tuan.
> >> >> >
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >> Sergey Beryozkin
> >> >>
> >> >> http://sberyozkin.blogspot.com
> >> >> Talend - http://www.talend.com
> >> >>
> >> >
> >> >
> >> >
> >> > --
> >> > Best regards,
> >> > Tuan.
> >> >
> >>
> >>
> >>
> >> --
> >> Sergey Beryozkin
> >>
> >> http://sberyozkin.blogspot.com
> >> Talend - http://www.talend.com
> >>
> >
> >
> >
> > --
> > Best regards,
> > Tuan.
> >
>
>
>
> --
> Sergey Beryozkin
>
> http://sberyozkin.blogspot.com
> Talend - http://www.talend.com
>



-- 
Best regards,
Tuan.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message