Hi all,
I thought I would answer my own question. I couldn't get the xfire 
configuration (services.xml) to define service properties with any type 
other than String.  After much experimentation, the only approach that 
worked for me is to use the raw Spring syntax in services.xml rather than 
the nice xbean syntax. Here is an example of services.xml that worked for 
me. 

Regards,
- Joe

<?xml version="1.0" encoding="UTF-8"?>
<beans>

  <!-- this does not work - the abcdeDataSource bean turns into a String 
-->
  <!--
  <service xmlns="http://xfire.codehaus.org/config/1.0";>
    <name>MyServices</name>
    <serviceClass>com.foo.IServices</serviceClass>
    <implementationClass>com.foo.ServicesImpl</implementationClass>
    <style>wrapped</style>
    <use>literal</use>
    <scope>application</scope>
    <properties>
        <property key="abcde"><ref bean="abcdeDataSource" /></property>
    </properties>
  </service>
  -->

  <!-- this is the clumsier Spring syntax that does exactly the same thing 
and actually works -->

  <bean name="baseServices" class="org.codehaus.xfire.spring.ServiceBean">
    <property name="serviceBean" ref="servicesImpl" />
    <property name="serviceClass" value="com.foo.IServices" />
    <property name="name" value="MyServices" />
    <property name="style" value="wrapped" />
    <property name="use" value="literal" />
    <property name="scope" value="application" />
    <property name="inHandlers">
      <list>
        <ref bean="addressingHandler" />
      </list>
    </property>
    <property name="properties">
      <map>
        <entry><key><value>abcde</value></key><ref bean="abcdeDataSource" 
/></entry>
      </map>
    </property>
  </bean>

  <bean id="servicesImpl" class = "com.foo.ServicesImpl" />
  <bean id="addressingHandler" 
class="org.codehaus.xfire.addressing.AddressingInHandler" />

  <bean id="abcdeDataSource" 
class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="resourceRef"><value>true</value></property>
    <property name="jndiName" value="jdbc/abcde" />
  </bean>

</beans>

-- 
Joe Morrison
Deutsche Bank, 60 Wall Street, 8th floor 
office: +1 (212) 250-8486        mobile: +1 (917) 952-2935




Joe-D Morrison <[EMAIL PROTECTED]> 
05/14/2007 07:55 PM
Please respond to
[email protected]


To
[email protected]
cc

Subject
[xfire-user] Creating non-String service properties







Hello, 
I'm trying to create a services.xml file that defines non-String service 
properties. I'm creating them as data source objects but when I retrieve 
the properties they become Strings. 

I found the following: 

http://jira.codehaus.org/browse/XFIRE-668 

which suggests that I'm encountering the xbean bug. What is the 
recommended fix at this point? I tried declaring various xbean 
dependencies in my pom.xml file, e.g. 

<dependency> 
        <groupId>org.apache.xbean</groupId> 
        <artifactId>xbean</artifactId> 
        <version>2.8</version> 
</dependency> 

but the dependency could not be resolved.  I also tried declaring the 
property this way: 

<property key="foo" xmlns=""> <!-- added empy namespace here --> 
        <ref bean="fooDataSource" xmlns="" /> 
</property> 

but that didn't work either - the property was null when I retrieved it. 

Any suggestions much appreciated. 
Regards, 
- Joe 

-- 
Joe Morrison
Deutsche Bank, 60 Wall Street, 8th floor 
office: +1 (212) 250-8486        mobile: +1 (917) 952-2935

---

This e-mail may contain confidential and/or privileged information. If you 

are not the intended recipient (or have received this e-mail in error) 
please notify the sender immediately and destroy this e-mail. Any 
unauthorized copying, disclosure or distribution of the material in this 
e-mail is strictly forbidden.


---

This e-mail may contain confidential and/or privileged information. If you 
are not the intended recipient (or have received this e-mail in error) 
please notify the sender immediately and destroy this e-mail. Any 
unauthorized copying, disclosure or distribution of the material in this 
e-mail is strictly forbidden.

Reply via email to