You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by hiyer <iy...@hotmail.com> on 2006/08/07 17:02:46 UTC
Spring transaction proxy with jsr181 POJO
Hi,
I need to make my jsr181 pojo transactional. If I proxy the pojo using the
Spring TransactionProxyFactoryBean, I lose the annotations since the pojo
webservice annotations are not available in the proxy (see spring
configuration below). So when I use this proxy as a jsr181 component, I get
the 'annotations not found' error. I can get around this by delegating the
jsr181 pojo calls to another transaction proxied pojo but is this the
preferred method?
Cheers,
Hari.
<sm:container
id="jbi"
monitorInstallationDirectory="false">
<sm:activationSpecs>
<sm:activationSpec>
<sm:component>
<jsr181:component>
<jsr181:endpoints>
<jsr181:endpoint
annotations="jsr181"
service="xfire:OrderService"
endpoint="OrderService"
pojo="#orderService">
</jsr181:endpoint>
</jsr181:endpoints>
</jsr181:component>
</sm:component>
</sm:activationSpec>
<sm:activationSpec>
<sm:component>
<http:component>
<http:endpoints>
<http:endpoint
service="xfire:OrderService"
endpoint="OrderService"
targetService="xfire:OrderService"
role="consumer"
locationURI="http://localhost:8192/OrderService/"
defaultMep="http://www.w3.org/2004/08/wsdl/in-out"
soap="true"/>
</http:endpoints>
</http:component>
</sm:component>
</sm:activationSpec>
</sm:activationSpecs>
</sm:container>
<bean id="jdbcTemplate"
class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource">
<ref bean="dataSource"/>
</property>
</bean>
<bean id="jdbcTransactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource">
<ref bean="dataSource"/>
</property>
</bean>
<bean id="transactionAttributeSource"
class="org.springframework.transaction.interceptor.NameMatchTransactionAttributeSource">
<property name="properties">
<props>
<prop key="*">PROPAGATION_REQUIRED, -Throwable</prop>
</props>
</property>
</bean>
<bean id="transactionTemplate" abstract="true"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
lazy-init="true">
<property name="transactionManager">
<ref bean="jdbcTransactionManager"/>
</property>
<property name="transactionAttributeSource">
<ref bean="transactionAttributeSource"/>
</property>
</bean>
<bean id="orderService" parent="transactionTemplate">
<property name="target">
<bean class="com.company.OrderService">
<property name="jdbcTemplate">
<ref bean="jdbcTemplate"/>
</property>
</bean>
</property>
</bean>
--
View this message in context: http://www.nabble.com/Spring-transaction-proxy-with-jsr181-POJO-tf2064171.html#a5686631
Sent from the ServiceMix - User forum at Nabble.com.
Re: Spring transaction proxy with jsr181 POJO
Posted by Guillaume Nodet <gn...@gmail.com>.
This is now fixed in svn head.
See http://issues.apache.org/activemq/browse/SM-535
On 8/7/06, hiyer <iy...@hotmail.com> wrote:
>
>
> I get the error 'Service class cannot be abstract' when I add a
> serviceInterface to the configuration. There apprears to be a bug logged
> against xfire for this: http://jira.codehaus.org/browse/XFIRE-306
>
> <sm:activationSpec>
> <sm:component>
> <jsr181:component>
> <jsr181:endpoints>
> <jsr181:endpoint
> annotations="jsr181"
> service="xfire:DirectoryService"
> endpoint="DirectoryService"
>
> serviceInterface="com.company.webservices.DirectoryServiceInterface"
> pojo="#directoryService">
> </jsr181:endpoint>
> </jsr181:endpoints>
> </jsr181:component>
> </sm:component>
> </sm:activationSpec>
> --
> View this message in context:
> http://www.nabble.com/Spring-transaction-proxy-with-jsr181-POJO-tf2064171.html#a5690463
> Sent from the ServiceMix - User forum at Nabble.com.
>
>
--
Cheers,
Guillaume Nodet
Re: Spring transaction proxy with jsr181 POJO
Posted by hiyer <iy...@hotmail.com>.
I get the error 'Service class cannot be abstract' when I add a
serviceInterface to the configuration. There apprears to be a bug logged
against xfire for this: http://jira.codehaus.org/browse/XFIRE-306
<sm:activationSpec>
<sm:component>
<jsr181:component>
<jsr181:endpoints>
<jsr181:endpoint
annotations="jsr181"
service="xfire:DirectoryService"
endpoint="DirectoryService"
serviceInterface="com.company.webservices.DirectoryServiceInterface"
pojo="#directoryService">
</jsr181:endpoint>
</jsr181:endpoints>
</jsr181:component>
</sm:component>
</sm:activationSpec>
--
View this message in context: http://www.nabble.com/Spring-transaction-proxy-with-jsr181-POJO-tf2064171.html#a5690463
Sent from the ServiceMix - User forum at Nabble.com.
Re: Spring transaction proxy with jsr181 POJO
Posted by Guillaume Nodet <gn...@gmail.com>.
You should defined an annotated interface for your POJO and specify the
serviceInterface attribute
on your jsr181:endpoint tag with the interface class name. Thus, the jsr181
component would use
the interface to define the service / wsdl, but use your proxied POJO to
perform actual calls.
On 8/7/06, hiyer <iy...@hotmail.com> wrote:
>
>
> Hi,
> I need to make my jsr181 pojo transactional. If I proxy the pojo using the
> Spring TransactionProxyFactoryBean, I lose the annotations since the pojo
> webservice annotations are not available in the proxy (see spring
> configuration below). So when I use this proxy as a jsr181 component, I
> get
> the 'annotations not found' error. I can get around this by delegating the
> jsr181 pojo calls to another transaction proxied pojo but is this the
> preferred method?
> Cheers,
> Hari.
>
> <sm:container
> id="jbi"
> monitorInstallationDirectory="false">
>
> <sm:activationSpecs>
> <sm:activationSpec>
> <sm:component>
> <jsr181:component>
> <jsr181:endpoints>
> <jsr181:endpoint
> annotations="jsr181"
> service="xfire:OrderService"
> endpoint="OrderService"
> pojo="#orderService">
> </jsr181:endpoint>
> </jsr181:endpoints>
> </jsr181:component>
> </sm:component>
> </sm:activationSpec>
> <sm:activationSpec>
> <sm:component>
> <http:component>
> <http:endpoints>
> <http:endpoint
> service="xfire:OrderService"
> endpoint="OrderService"
> targetService="xfire:OrderService"
> role="consumer"
> locationURI="http://localhost:8192/OrderService/"
> defaultMep="http://www.w3.org/2004/08/wsdl/in-out"
> soap="true"/>
> </http:endpoints>
> </http:component>
> </sm:component>
> </sm:activationSpec>
> </sm:activationSpecs>
>
> </sm:container>
>
>
> <bean id="jdbcTemplate"
> class="org.springframework.jdbc.core.JdbcTemplate">
> <property name="dataSource">
> <ref bean="dataSource"/>
> </property>
> </bean>
> <bean id="jdbcTransactionManager"
> class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
> <property name="dataSource">
> <ref bean="dataSource"/>
> </property>
> </bean>
>
> <bean id="transactionAttributeSource"
> class="
> org.springframework.transaction.interceptor.NameMatchTransactionAttributeSource
> ">
> <property name="properties">
> <props>
> <prop key="*">PROPAGATION_REQUIRED, -Throwable</prop>
> </props>
> </property>
> </bean>
>
> <bean id="transactionTemplate" abstract="true"
> class="
> org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
> lazy-init="true">
> <property name="transactionManager">
> <ref bean="jdbcTransactionManager"/>
> </property>
> <property name="transactionAttributeSource">
> <ref bean="transactionAttributeSource"/>
> </property>
> </bean>
>
> <bean id="orderService" parent="transactionTemplate">
> <property name="target">
> <bean class="com.company.OrderService">
> <property name="jdbcTemplate">
> <ref bean="jdbcTemplate"/>
> </property>
> </bean>
> </property>
> </bean>
> --
> View this message in context:
> http://www.nabble.com/Spring-transaction-proxy-with-jsr181-POJO-tf2064171.html#a5686631
> Sent from the ServiceMix - User forum at Nabble.com.
>
>
--
Cheers,
Guillaume Nodet