You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by silvia_magrelli <si...@libero.it> on 2009/01/03 19:15:01 UTC

session between a ws service and a client in cxf

Hello,

I'm using cxf 2.1.3, and I'd like to know if like in axis
there is the possibility to mantain a conversational state 
with a web service, like the setMaintainSession() method of Call in axis do.
(Precisely I publish a cxf service in servicemix, can somebody tell me if I can establish a session with a cxf client or another type of client outside the bus?)

Sorry if I didn't understand or not look at the right documentation,
Please help me.

Thank you in advance,

greetings
silvia



Re: session between a ws service and a client in cxf

Posted by Ian Roberts <i....@dcs.shef.ac.uk>.
Julio Oliveira wrote:
> What about concurrency?
> What happen if i have 50 connections at the same time:

With singleton service beans you will have 50 different Java threads
running in methods of the same service object at the same time.  If your
service object is thread safe (which it should be if it is stateless)
this will be fine.

> 1) Can i create a independent invoke for each process ?

Do you mean a separate instance of the service bean for each request?
You can certainly do that using scope="request" for your service beans
in Spring, or I think there's a way to do it with the
JAXRSServerFactoryBean, but like I say that shouldn't be necessary if
your service object is thread safe.

> 2) All the invoke process are to the same socket number ?

Yes, that's perfectly normal for server sockets.

Ian

-- 
Ian Roberts               | Department of Computer Science
i.roberts@dcs.shef.ac.uk  | University of Sheffield, UK

Re: session between a ws service and a client in cxf

Posted by Julio Oliveira <ju...@gmail.com>.
What about concurrency?
What happen if i have 50 connections at the same time:

1) Can i create a independent invoke for each process ?

2) All the invoke process are to the same socket number ?

jOliveira

On Sun, Jan 4, 2009 at 3:34 PM, Ian Roberts <i....@dcs.shef.ac.uk>wrote:

> Julio Oliveira wrote:
> > There are some for JAX-RS ?
>
> As far as I know, CXF doesn't provide anything for the *client* side of
> RESTful services.
>
> For server-side session support you should just be able to make your
> service beans session-scoped (with <aop:scoped-proxy/>).  See the notes
> at the bottom of http://cwiki.apache.org/CXF20DOC/jax-rs-jsr-311.html
> about Spring AOP for details of the potential pitfalls.  Alternatively
> you could use the HttpSession directly by injecting a MessageContext
> into a singleton service bean and accessing the HttpServletRequest
> through that.
>
> Ian
>
> --
> Ian Roberts               | Department of Computer Science
> i.roberts@dcs.shef.ac.uk  | University of Sheffield, UK
>



-- 
Saludos

Julio Oliveira - Buenos Aires

julio.julioOliveira@gmail.com

http://www.linkedin.com/in/juliomoliveira

Re: session between a ws service and a client in cxf

Posted by Ian Roberts <i....@dcs.shef.ac.uk>.
Julio Oliveira wrote:
> There are some for JAX-RS ?

As far as I know, CXF doesn't provide anything for the *client* side of
RESTful services.

For server-side session support you should just be able to make your
service beans session-scoped (with <aop:scoped-proxy/>).  See the notes
at the bottom of http://cwiki.apache.org/CXF20DOC/jax-rs-jsr-311.html
about Spring AOP for details of the potential pitfalls.  Alternatively
you could use the HttpSession directly by injecting a MessageContext
into a singleton service bean and accessing the HttpServletRequest
through that.

Ian

-- 
Ian Roberts               | Department of Computer Science
i.roberts@dcs.shef.ac.uk  | University of Sheffield, UK

Re: session between a ws service and a client in cxf

Posted by Julio Oliveira <ju...@gmail.com>.
There are some for JAX-RS ?

On Sat, Jan 3, 2009 at 3:23 PM, Ian Roberts <i....@dcs.shef.ac.uk>wrote:

> silvia_magrelli wrote:
> > Hello,
> >
> > I'm using cxf 2.1.3, and I'd like to know if like in axis
> > there is the possibility to mantain a conversational state
> > with a web service, like the setMaintainSession() method of Call in axis
> do.
> > (Precisely I publish a cxf service in servicemix, can somebody tell me if
> I can establish a session with a cxf client or another type of client
> outside the bus?)
> >
> > Sorry if I didn't understand or not look at the right documentation,
> > Please help me.
>
> With JAX-WS, once you have the stub you can do
>
> ((BindingProvider)cxfStub).getRequestContext().put(
>              BindingProvider.SESSION_MAINTAIN_PROPERTY,
>              Boolean.TRUE);
>
> All JAX-WS client stub objects implement BindingProvider in addition to
> the service interface.
>
> Ian
>
> --
> Ian Roberts               | Department of Computer Science
> i.roberts@dcs.shef.ac.uk  | University of Sheffield, UK
>



-- 
Saludos

Julio Oliveira - Buenos Aires

julio.julioOliveira@gmail.com

http://www.linkedin.com/in/juliomoliveira

Re: session between a ws service and a client in cxf

Posted by Ian Roberts <i....@dcs.shef.ac.uk>.
silvia_magrelli wrote:
> Hello,
> 
> I'm using cxf 2.1.3, and I'd like to know if like in axis
> there is the possibility to mantain a conversational state 
> with a web service, like the setMaintainSession() method of Call in axis do.
> (Precisely I publish a cxf service in servicemix, can somebody tell me if I can establish a session with a cxf client or another type of client outside the bus?)
> 
> Sorry if I didn't understand or not look at the right documentation,
> Please help me.

With JAX-WS, once you have the stub you can do

((BindingProvider)cxfStub).getRequestContext().put(
              BindingProvider.SESSION_MAINTAIN_PROPERTY,
              Boolean.TRUE);

All JAX-WS client stub objects implement BindingProvider in addition to
the service interface.

Ian

-- 
Ian Roberts               | Department of Computer Science
i.roberts@dcs.shef.ac.uk  | University of Sheffield, UK