You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Sean Patrick Floyd <se...@gmx.net> on 2010/06/25 15:59:01 UTC

Wrapping existing service bean

Hello,

 

I have a spring config file service.xml in which a service class is defined

 

<beans>

       <bean id="myService" class="com.mycompany.MyServiceImpl">

       <!-- Many properties here -->

       </bean>

 

       <!-- Many other beans here -->

</beans>

 

And I have a cxf config server.xml with a server definition

 

<import location="classpath:service.xml" />

<simple:server

       id="server"

       serviceClass="com.mycompany.MyService"

       ...

       >

             <simple:serviceBean ref="myService">

 

</simple:serviceBean>

 

I would like the server to reference the existing bean, but unfortunately a
new myService bean is created and all properties are missing.

serviceClass points to an interface implemented by MyServiceImpl and I can't
really change that, because otherwise the created wsdl will contain all
public methods (including setters).

 

Is there something I am doing wrong? Or do I have to configure my service
bean as an inner bean of simple:serviceBean (I hope not)?

I use interface-based proxying in my service.xml, not cglib. Is that perhaps
the issue? I see that CGLib is used to create the new bean.

 

Can anybody help?

 

Thanks Sean

-- 

MostlyMagic.com - Sean Patrick Floyd

IT-Consultant und Senior Java Developer

Mobile: +49 170 4746496

Mail:    <ma...@mostlymagic.com> info@mostlymagic.com

Web:     <http://www.mostlymagic.com> www.mostlymagic.com

XING:    <https://www.xing.com/profile/SeanPatrick_Floyd>
https://www.xing.com/profile/SeanPatrick_Floyd

GULP:    <http://www.gulp.de/Profil/mostlymagic.html>
http://www.gulp.de/Profil/mostlymagic.html

 


Re: Wrapping existing service bean

Posted by Daniel Kulp <dk...@apache.org>.
I think you have two options:

1)  Use the serviceBean child element.  With that, you need to use a spring 
bean child most likely.
<simple:serviceBean>
    <bean ref="myService"/>
</simple:serviceBean>


2)  Use the serviceBean attribute on the simple:server:
<simple:server
        id="server"
        serviceClass="com.mycompany.MyService"
        serviceBean="#myService"
....


Dan



On Friday 25 June 2010 9:59:01 am Sean Patrick Floyd wrote:
> Hello,
> 
> 
> 
> I have a spring config file service.xml in which a service class is defined
> 
> 
> 
> <beans>
> 
>        <bean id="myService" class="com.mycompany.MyServiceImpl">
> 
>        <!-- Many properties here -->
> 
>        </bean>
> 
> 
> 
>        <!-- Many other beans here -->
> 
> </beans>
> 
> 
> 
> And I have a cxf config server.xml with a server definition
> 
> 
> 
> <import location="classpath:service.xml" />
> 
> <simple:server
> 
>        id="server"
> 
>        serviceClass="com.mycompany.MyService"
> 
>        ...
> 
> 
> 
>              <simple:serviceBean ref="myService">
> 
> 
> 
> </simple:serviceBean>
> 
> 
> 
> I would like the server to reference the existing bean, but unfortunately a
> new myService bean is created and all properties are missing.
> 
> serviceClass points to an interface implemented by MyServiceImpl and I
> can't really change that, because otherwise the created wsdl will contain
> all public methods (including setters).
> 
> 
> 
> Is there something I am doing wrong? Or do I have to configure my service
> bean as an inner bean of simple:serviceBean (I hope not)?
> 
> I use interface-based proxying in my service.xml, not cglib. Is that
> perhaps the issue? I see that CGLib is used to create the new bean.
> 
> 
> 
> Can anybody help?
> 
> 
> 
> Thanks Sean

-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog