Hello Nigel,

I am just working on a similar thing and I got it working after getting past a non obvious issue with the Jsr181HandlerMapping; specifically with the handler registering a service twice (and failing on the 2nd definition).

The trick is that the JSR181 annotations are present on the BusinessServiceTarget class, not on the interface. However, the Jsr181HandlerMapping checks every bean definition, and when presented with a BusinessService (proxy) class, it resolves the target (BusinessServiceTarget), evaluates the annotations, and registers the URL. Now, if you also have the BusinessServiceTarget class declared explicitly (as you do in the example below), then the Jsr181HandlerMapping class will see the BusinessServiceTarget class twice, once when processing the proxy definition, and once when processing the target definition, and will fail while processing the 2nd definition.

I'm not sure if this is designed behavior or not. I am using 1.1-beta1.

However, if you put the BusinessServiceTarget definition inline in the proxy, then it works, as the Jsr181HandlerMapping only sees one definition (the one via the proxy)

The key things about my environment:

1. the business logic bean definitions are in a file say businessConfig.xml, and the soap bean definitions are in a file called xfire-servlet.xml

2. web.xml has the <contextConfigLocation> set to businessConfig.xml only - no webservice related xml files are defined here.

3. xfire-servlet.xml is as follows: (you can see that there is actually no business related config here)

<beans>
  <import resource="classpath:org/codehaus/xfire/spring/xfire.xml" />

<bean id="handlerMapping" class="org.codehaus.xfire.spring.remoting.Jsr181HandlerMapping">
    <property name="typeMappingRegistry" ref="xfire.typeMappingRegistry" />
    <property name="xfire" ref="xfire" />
    <property name="urlPrefix" value="/" />
    <property name="webAnnotations">
        <bean class="org.codehaus.xfire.annotations.jsr181.Jsr181WebAnnotations" 
/>
    </property>
  </bean>                 
                                
<bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
    <property name="urlMap">
      <map>
          <entry key="/" value-ref="handlerMapping"/>
      </map>
    </property>
 </bean>
</beans>


4. the only class with JSR181 annotations is the real "target" bean (in the example below, TaxonomyServiceBean


Hope that helps.

Nick.


Nigel Magnay wrote:
Hi list

We have a number of spring services that use the TransactionProxyFactoryBean
transaction wrappers to do the right thing (example at end).

Ideally, I would like to use XFire to expose the transaction-wrapped
TaxonomyService (which implements ITaxonomyService).
Even more ideally I'd like to use JSR-181 annotations on ITaxonomyService
(and aegis annotations on dependent classes) in order to get it set-up
correctly.

I could do this by writing a proxy bean (much as you when using Spring/Axis
and generating something like JaxRpcTaxonomyServiceBean that just forwards
to the 'real' service), but I was wondering if there is a simpler (minimal
configuration) way with xfire ?



Example of a service:
    <bean id="TaxonomyService"
        class="
org.springframework.transaction.interceptor.TransactionProxyFactoryBean">

        <property name="transactionManager">
            <ref bean="TransactionManager" />
        </property>
        <property name="target">
            <ref bean="TaxonomyServiceTarget" />
        </property>
        <property name="transactionAttributes">
            <props>
                <prop key="*">
                    PROPAGATION_REQUIRED
                </prop>
            </props>
        </property>
    </bean>

    <bean id="TaxonomyServiceTarget"
        class="com.cswgroup.kms.services.beans.TaxonomyServiceBean">
        <property name="modelFactory">
            <ref bean="ModelFactory" />
        </property>
        <property name="persistenceManager">
            <ref bean="PersistenceManager" />
        </property>
        <property name="userContextAuthenticator">
            <ref bean="UserContextAuthenticator" />
        </property>
    </bean>


--
Nick Airey

Technical Architect
Orchestrate.IT

0439 405 313
02 8332 4913

Reply via email to