You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Григорий Лобач <sc...@gmail.com> on 2009/11/04 09:54:42 UTC
Spring Bean Injection for Endpoint
Hi All,
I'm using CXF with JBoss app. server and it's necessary to inject a few
spring beans into endpoint object.
I tried the following solution, but it wasn't working for me:
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd">
<bean id="mailSenderPortType"
class="pl.com.agora.mailsender.ws.MailSenderPortTypeImpl">
<property name="mailSenderFacade" ref="mailSenderFacade"/>
</bean>
<jaxws:endpoint
id="mailSender"
address="http://localhost:8080/mailSender"
implementor="#mailSenderPortType">
<jaxws:invoker>
<bean class="org.jboss.wsf.stack.cxf.InvokerJSE"/>
</jaxws:invoker>
</jaxws:endpoint>
</beans>
mailSenderFacade property is always null at runtime.
Thanks in advance for any advise!
RE: Spring Bean Injection for Endpoint
Posted by Grygorii Lobach <sc...@gmail.com>.
Googling brought me to the following thread -
http://markmail.org/message/cxfrg5agf7boswl3 .
So I changed my jbossws-cxf.xml file as described there and it's working
now:
.....................
<jaxws:server id="mailSender"
serviceClass="pl.com.agora.mailsender.ws.MailSenderPortType"
address="http://localhost:8080/mailSender">
<jaxws:serviceBean>
<bean id="mailSenderPortType"
class="pl.com.agora.mailsender.ws.MailSenderPortTypeImpl">
<property name="mailSenderFacade" ref="mailSenderFacade"/>
</bean>
</jaxws:serviceBean>
<jaxws:invoker>
<bean class="org.jboss.wsf.stack.cxf.InvokerJSE"/>
</jaxws:invoker>
</jaxws:server>
......................
But this solution is still not clear for me. Probably, deeper diving into
Apache CXF documentation will help.
Grygorii Lobach wrote:
>
> No, I have mailSenderFacade bean which is defined in the separate
> ApplicationContext.xml file. I'm using ContextLoaderListener for both of
> them ApplicationContext.xml and jbossws-cxf.xml (which is shown in my
> previous post) so this bean should be "visible". Besides, when I add some
> test value to mailSenderPortType instead of mailSenderFacade like here:
>
> <bean id="mailSenderPortType"
> class="pl.com.agora.mailsender.ws.MailSenderPortTypeImpl">
> <property name="test" value="testString"/>
> </bean>
>
> it doesn't initialize the "test" property. I believe this is some endpoint
> object specific. Or, maybe, using of
> org.jboss.wsf.stack.cxf.InvokerJSE invoker has some influence on context.
>
>
> Eamonn Dwyer-2 wrote:
>>
>>
>> Should your ref value not be
>> mailSender rather than
>> mailSenderFacade
>> to match up with your bean's id?
>>
>>> Date: Wed, 4 Nov 2009 10:54:42 +0200
>>> Subject: Spring Bean Injection for Endpoint
>>> From: scellerato@gmail.com
>>> To: users@cxf.apache.org
>>>
>>> Hi All,
>>> I'm using CXF with JBoss app. server and it's necessary to inject a few
>>> spring beans into endpoint object.
>>> I tried the following solution, but it wasn't working for me:
>>> <beans
>>> xmlns="http://www.springframework.org/schema/beans"
>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>> xmlns:beans="http://www.springframework.org/schema/beans"
>>> xmlns:jaxws="http://cxf.apache.org/jaxws"
>>> xsi:schemaLocation="http://www.springframework.org/schema/beans
>>> http://www.springframework.org/schema/beans/spring-beans.xsd
>>> http://cxf.apache.org/jaxws
>>> http://cxf.apache.org/schemas/jaxws.xsd">
>>>
>>> <bean id="mailSenderPortType"
>>> class="pl.com.agora.mailsender.ws.MailSenderPortTypeImpl">
>>> <property name="mailSenderFacade" ref="mailSenderFacade"/>
>>> </bean>
>>>
>>> <jaxws:endpoint
>>> id="mailSender"
>>> address="http://localhost:8080/mailSender"
>>> implementor="#mailSenderPortType">
>>> <jaxws:invoker>
>>> <bean class="org.jboss.wsf.stack.cxf.InvokerJSE"/>
>>> </jaxws:invoker>
>>> </jaxws:endpoint>
>>>
>>> </beans>
>>>
>>> mailSenderFacade property is always null at runtime.
>>> Thanks in advance for any advise!
>>
>> _________________________________________________________________
>> New Windows 7: Find the right PC for you. Learn more.
>> http://windows.microsoft.com/shop
>>
>
>
--
View this message in context: http://old.nabble.com/Spring-Bean-Injection-for-Endpoint-tp26198861p26208639.html
Sent from the cxf-user mailing list archive at Nabble.com.
RE: Spring Bean Injection for Endpoint
Posted by Grygorii Lobach <sc...@gmail.com>.
No, I have mailSenderFacade bean which is defined in the separate
ApplicationContext.xml file. I'm using ContextLoaderListener for both of
them ApplicationContext.xml and jbossws-cxf.xml (which is shown in my
previous post) so this bean should be "visible". Besides, when I add some
test value to mailSenderPortType instead of mailSenderFacade like here:
<bean id="mailSenderPortType"
class="pl.com.agora.mailsender.ws.MailSenderPortTypeImpl">
<property name="test" value="testString"/>
</bean>
it doesn't initialize the "test" property. I believe this is some endpoint
object specific. Or, maybe, using of
org.jboss.wsf.stack.cxf.InvokerJSE invoker has some influence on context.
Eamonn Dwyer-2 wrote:
>
>
> Should your ref value not be
> mailSender rather than
> mailSenderFacade
> to match up with your bean's id?
>
>> Date: Wed, 4 Nov 2009 10:54:42 +0200
>> Subject: Spring Bean Injection for Endpoint
>> From: scellerato@gmail.com
>> To: users@cxf.apache.org
>>
>> Hi All,
>> I'm using CXF with JBoss app. server and it's necessary to inject a few
>> spring beans into endpoint object.
>> I tried the following solution, but it wasn't working for me:
>> <beans
>> xmlns="http://www.springframework.org/schema/beans"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xmlns:beans="http://www.springframework.org/schema/beans"
>> xmlns:jaxws="http://cxf.apache.org/jaxws"
>> xsi:schemaLocation="http://www.springframework.org/schema/beans
>> http://www.springframework.org/schema/beans/spring-beans.xsd
>> http://cxf.apache.org/jaxws
>> http://cxf.apache.org/schemas/jaxws.xsd">
>>
>> <bean id="mailSenderPortType"
>> class="pl.com.agora.mailsender.ws.MailSenderPortTypeImpl">
>> <property name="mailSenderFacade" ref="mailSenderFacade"/>
>> </bean>
>>
>> <jaxws:endpoint
>> id="mailSender"
>> address="http://localhost:8080/mailSender"
>> implementor="#mailSenderPortType">
>> <jaxws:invoker>
>> <bean class="org.jboss.wsf.stack.cxf.InvokerJSE"/>
>> </jaxws:invoker>
>> </jaxws:endpoint>
>>
>> </beans>
>>
>> mailSenderFacade property is always null at runtime.
>> Thanks in advance for any advise!
>
> _________________________________________________________________
> New Windows 7: Find the right PC for you. Learn more.
> http://windows.microsoft.com/shop
>
--
View this message in context: http://old.nabble.com/Spring-Bean-Injection-for-Endpoint-tp26198861p26208594.html
Sent from the cxf-user mailing list archive at Nabble.com.
RE: Spring Bean Injection for Endpoint
Posted by Eamonn Dwyer <ea...@hotmail.com>.
Should your ref value not be
mailSender rather than
mailSenderFacade
to match up with your bean's id?
> Date: Wed, 4 Nov 2009 10:54:42 +0200
> Subject: Spring Bean Injection for Endpoint
> From: scellerato@gmail.com
> To: users@cxf.apache.org
>
> Hi All,
> I'm using CXF with JBoss app. server and it's necessary to inject a few
> spring beans into endpoint object.
> I tried the following solution, but it wasn't working for me:
> <beans
> xmlns="http://www.springframework.org/schema/beans"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:beans="http://www.springframework.org/schema/beans"
> xmlns:jaxws="http://cxf.apache.org/jaxws"
> xsi:schemaLocation="http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans.xsd
> http://cxf.apache.org/jaxws
> http://cxf.apache.org/schemas/jaxws.xsd">
>
> <bean id="mailSenderPortType"
> class="pl.com.agora.mailsender.ws.MailSenderPortTypeImpl">
> <property name="mailSenderFacade" ref="mailSenderFacade"/>
> </bean>
>
> <jaxws:endpoint
> id="mailSender"
> address="http://localhost:8080/mailSender"
> implementor="#mailSenderPortType">
> <jaxws:invoker>
> <bean class="org.jboss.wsf.stack.cxf.InvokerJSE"/>
> </jaxws:invoker>
> </jaxws:endpoint>
>
> </beans>
>
> mailSenderFacade property is always null at runtime.
> Thanks in advance for any advise!
_________________________________________________________________
New Windows 7: Find the right PC for you. Learn more.
http://windows.microsoft.com/shop