You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by laufer <la...@cs.luc.edu> on 2008/03/14 17:23:34 UTC

Re: Share object in request scope on ws server


ianroberts wrote:
> 
> 
> You should be able to define a request-scoped Spring bean to hold the data
> you want to pass around and inject that into your service object,
> interceptors, etc.  You can call the methods of this bean and Spring will
> magically take care of directing the calls to the right place for the
> request.  I do something very similar to support a stateful web service
> where I need to maintain state across an HTTPSession.  In fact I go one
> further and actually use a session-scoped bean as my SEI:
> 
> <bean id="myServiceImpl" class="my.package.WebServiceImpl"
> scope="session">
>   <aop:scoped-proxy />
> </bean>
> 
> <jaxws:server id="serviceEndpoint" serviceBean="#myServiceImpl"
>     serviceClass="my.package.WebServiceImpl" address="/myService" />
> 
> And tell the client to maintain the session
> (http://weblogs.java.net/blog/ramapulavarthi/archive/2006/06/maintaining_ses.html). 
> Works beautifully :-)
> 
> Ian
> 

Thanks, Ian! After struggling with this approach for three weeks on and off,
I can now confirm that it does work beautifully!

It turns out that my earlier problems were due to subtle version mismatches
among Spring components. What worked for me is to use the latest available
version of spring-aop (2.0.8) and match the other components to that
version. In addition, cglib 2.1_3 and asm 1.5.3 have to be in the classpath. 

In case anyone is interested, I have a complete, Maven-ized toy example I
put together for my web services class (this stuff needs to be as foolproof
as possible for this purpose):

cvs -d :pserver:anonymous@cvs.cs.luc.edu:/root/laufer/433 co
NumguessServiceStatefulCXF
cd NumguessServiceStatefulCXF
mvn jetty:run

Any feedback will be appreciated, too.

Thanks again,

Konstantin
-- 
View this message in context: http://www.nabble.com/Share-object-in-request-scope-on-ws-server-tp14611572p16048592.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Share object in request scope on ws server

Posted by Konstantin Läufer <la...@cs.luc.edu>.
On Fri, Mar 14, 2008 at 11:31 AM, Daniel Kulp <dk...@apache.org> wrote:

> On Friday 14 March 2008, laufer wrote:
> > It turns out that my earlier problems were due to subtle version
> > mismatches among Spring components. What worked for me is to use the
> > latest available version of spring-aop (2.0.8) and match the other
> > components to that version. In addition, cglib 2.1_3 and asm 1.5.3
> > have to be in the classpath.
>
> Any chance you could test this by using the cglib-nodep jar (
> http://repo1.maven.org/maven2/cglib/cglib-nodep/2.1_3/) and not having
> asm 1.5.3 on the classpath?
>
> The main reason I'm concerned about this is that with CXF 2.1, there are
> a LOT more cases where ASM 2.x or newer is going to be required.   I'd
> like to see if the hibernate stuff will work with the cglib-nodep jar so
> we can at least have that as a workaround.
>
>
> --
> J. Daniel Kulp
> Principal Engineer, IONA
> dkulp@apache.org
> http://www.dankulp.com/blog
>

Yes, that works just fine with the Spring 2.0.8 components. Even better
because it keeps the list of dependencies in Maven small.

Thanks,

Konstantin

Re: Share object in request scope on ws server

Posted by Daniel Kulp <dk...@apache.org>.
On Friday 14 March 2008, laufer wrote:
> It turns out that my earlier problems were due to subtle version
> mismatches among Spring components. What worked for me is to use the
> latest available version of spring-aop (2.0.8) and match the other
> components to that version. In addition, cglib 2.1_3 and asm 1.5.3
> have to be in the classpath.

Any chance you could test this by using the cglib-nodep jar ( 
http://repo1.maven.org/maven2/cglib/cglib-nodep/2.1_3/) and not having 
asm 1.5.3 on the classpath?    

The main reason I'm concerned about this is that with CXF 2.1, there are 
a LOT more cases where ASM 2.x or newer is going to be required.   I'd 
like to see if the hibernate stuff will work with the cglib-nodep jar so 
we can at least have that as a workaround.


-- 
J. Daniel Kulp
Principal Engineer, IONA
dkulp@apache.org
http://www.dankulp.com/blog