Re: spring Axis2 integration question
Hi, I'm also currently reading this tutorial and could shed some light on it, at least my understanding so far. The basic idea as it seems to me is to be able to access Spring beans (defined within Spring's application context) from normal Axis2 services. The actual injection of the bean seems to be done by Axis2, e.g. if having an Axis2 service that has a "myBean" field, when its messsage receiver is invoked, Axis2 will populate that field with the configured Spring bean by loading it from the Spring application context. The name of the Spring bean to inject is defined using the "SpringBeanName" Axis2 parameter in Axis2 services.xml file. The class that is responsible for looking up this Spring bean needs to be able to access the Spring configuration context in some way. If the Spring and Axis2 are running on a servlet container, this can be done using the servlet context that is also kept in the Axis2 runtime. The following is a standart Spring code to retrieve the Spring application context from a ServletContext: ApplicationContext aCtx = WebApplicationContextUtils.getWebApplicationContext(servletContext); So if you know that both Spring and Axis2 reside on the same servlet container, you should specify the following in the services.xml: org.apache.axis2.extensions.spring.receivers.SpringServletContextObjectSupplier That way you tell Axis2 "try to obtain the Spring application context from the ServletContext, I know it is there". If you run Spring and Axis2 standalone without a servlet container, then Axis2 cannot use this approach, so you need to define a bean in Spring that will take hold of the Spring's application context: This bean just has a static field for the Application context. Spring will populate the static field and later Axis2 will just be able to call the static "getContext()" method to retrieve context and from there the desired bean to inject. In this case you need to define the following in the Axis2 services.xml: org.apache.axis2.extensions.spring.receivers.SpringAppContextAwareObjectSupplier This will tell Axis: "ApplicationContextHolder class is initialized by Spring and contains a reference to Spring's context, get it from there" Regards, Detelin On Tue, Aug 12, 2008 at 9:24 PM, robert lazarski <[EMAIL PROTECTED]>wrote: > Also, use the "with a ServletContext" options for use with WEB-INF/lib . > > - R > > On Tue, Aug 12, 2008 at 3:23 PM, robert lazarski > <[EMAIL PROTECTED]> wrote: > > Putting all jars in WEB-INF/lib is easiest and recommended in most cases. > > > > - R > > > > On Tue, Aug 12, 2008 at 2:21 PM, scabbage <[EMAIL PROTECTED]> wrote: > >> > >> I've been struggling to understand how spring and Axis2 will work > together. I > >> have read the tutorial at http://ws.apache.org/axis2/1_4/spring.html#21. > But > >> still couldn't understand what it's talking about. As I'm new to > webservice > >> and Axis2, I hope you could kindly provide some pointers so that could > use > >> my Spring services in Axis2. > >> > >> So basically I have a standard hibernate+dao+Spring app packaged as a > jar > >> file. The tutorial was unclear about where I should put this jar file. > It > >> should be one of services, pojo or modules, am I right? As this is not a > >> simple pojo, I assume I should put it in one of the other two folders. > And > >> then the tutorial goes ahead talking about "with/without a > ServletContext", > >> which I'm a bit lost. What does it mean by "with a ServletContext"? > >> > >> Can someone please explain how I could deploy this jar in Axis2? > >> > >> Thanks. > >> -- > >> View this message in context: > http://www.nabble.com/spring-Axis2-integration-question-tp18948823p18948823.html > >> Sent from the Axis - User mailing list archive at Nabble.com. > >> > >> > >> - > >> To unsubscribe, e-mail: [EMAIL PROTECTED] > >> For additional commands, e-mail: [EMAIL PROTECTED] > >> > >> > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
Re: spring Axis2 integration question
Also, use the "with a ServletContext" options for use with WEB-INF/lib . - R On Tue, Aug 12, 2008 at 3:23 PM, robert lazarski <[EMAIL PROTECTED]> wrote: > Putting all jars in WEB-INF/lib is easiest and recommended in most cases. > > - R > > On Tue, Aug 12, 2008 at 2:21 PM, scabbage <[EMAIL PROTECTED]> wrote: >> >> I've been struggling to understand how spring and Axis2 will work together. I >> have read the tutorial at http://ws.apache.org/axis2/1_4/spring.html#21. But >> still couldn't understand what it's talking about. As I'm new to webservice >> and Axis2, I hope you could kindly provide some pointers so that could use >> my Spring services in Axis2. >> >> So basically I have a standard hibernate+dao+Spring app packaged as a jar >> file. The tutorial was unclear about where I should put this jar file. It >> should be one of services, pojo or modules, am I right? As this is not a >> simple pojo, I assume I should put it in one of the other two folders. And >> then the tutorial goes ahead talking about "with/without a ServletContext", >> which I'm a bit lost. What does it mean by "with a ServletContext"? >> >> Can someone please explain how I could deploy this jar in Axis2? >> >> Thanks. >> -- >> View this message in context: >> http://www.nabble.com/spring-Axis2-integration-question-tp18948823p18948823.html >> Sent from the Axis - User mailing list archive at Nabble.com. >> >> >> - >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: spring Axis2 integration question
Putting all jars in WEB-INF/lib is easiest and recommended in most cases. - R On Tue, Aug 12, 2008 at 2:21 PM, scabbage <[EMAIL PROTECTED]> wrote: > > I've been struggling to understand how spring and Axis2 will work together. I > have read the tutorial at http://ws.apache.org/axis2/1_4/spring.html#21. But > still couldn't understand what it's talking about. As I'm new to webservice > and Axis2, I hope you could kindly provide some pointers so that could use > my Spring services in Axis2. > > So basically I have a standard hibernate+dao+Spring app packaged as a jar > file. The tutorial was unclear about where I should put this jar file. It > should be one of services, pojo or modules, am I right? As this is not a > simple pojo, I assume I should put it in one of the other two folders. And > then the tutorial goes ahead talking about "with/without a ServletContext", > which I'm a bit lost. What does it mean by "with a ServletContext"? > > Can someone please explain how I could deploy this jar in Axis2? > > Thanks. > -- > View this message in context: > http://www.nabble.com/spring-Axis2-integration-question-tp18948823p18948823.html > Sent from the Axis - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
spring Axis2 integration question
I've been struggling to understand how spring and Axis2 will work together. I have read the tutorial at http://ws.apache.org/axis2/1_4/spring.html#21. But still couldn't understand what it's talking about. As I'm new to webservice and Axis2, I hope you could kindly provide some pointers so that could use my Spring services in Axis2. So basically I have a standard hibernate+dao+Spring app packaged as a jar file. The tutorial was unclear about where I should put this jar file. It should be one of services, pojo or modules, am I right? As this is not a simple pojo, I assume I should put it in one of the other two folders. And then the tutorial goes ahead talking about "with/without a ServletContext", which I'm a bit lost. What does it mean by "with a ServletContext"? Can someone please explain how I could deploy this jar in Axis2? Thanks. -- View this message in context: http://www.nabble.com/spring-Axis2-integration-question-tp18948823p18948823.html Sent from the Axis - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]