1.xfire是支持spring的,不过它自带的是spring1.2.6,记得一定要先在工程移除
2.程序:依然是写一个接口,一个实现类
3.配置全交给spring,把xfire-spring1.2.6.jar中org.codehaus.xfire.spring的customEditors.xml和xfire.xml拷到spring的配置文件同级目录下,原来的services.xml可不要
4.web.xml的xfireServlet改成spring的XFireSpringServlet
5.客户端的调用和以前一样
beans.xml------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<import resource="customEditors.xml"/>
<import resource="xfire.xml"/>
<bean name="sayService" class="org.codehaus.xfire.spring.ServiceBean">
<property name="serviceBean" ref="say"/><!--引用实现类 -->
<property name="serviceClass" value="com.shangdu.service.ISay"/><!--接口所在位置 -->
<!-- <property name="name" value="say"/>
<property name="xfire" ref="xfire" />
<property name="serviceFactory" ref="xfire.serviceFactory"/>
<property name="inHandlers">
<list>
<ref bean="addressingHandler"/>
</list>
</property>
-->
</bean>
<bean id="say" class="com.shangdu.service.SayImpl" /><!--实现类 -->
<!-- <bean id="addressingHandler" class="org.codehaus.xfire.addressing.AddressingInHandler"/> -->
</beans>
------------------------------------------------------------------------------------------------------------------
web.xml------------------------------------------------------------------------------------------------------
<servlet>
<servlet-name>xfireServlet</servlet-name>
<servlet-class>org.codehaus.xfire.spring.XFireSpringServlet</servlet-class><!--换成spring的类 -->
</servlet>
<servlet-mapping>
<servlet-name>xfireServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
-------------------------------------------------------------------------------------------------------------------