1.xfire文件配置
<!--将来所有的web服务信息就要写在这里了。-->
<import resource="classpath:org/codehaus/xfire/spring/xfire.xml" />
<!-- 定义访问的url -->
<bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="urlMap">
<map>
<!-- 显示WebService 访问路径,有几个路径就需要 配置几个路径。ref bean与下面的是对应的。-->
<entry key="/RApplication">
<ref bean="webServiceForApplication" />
</entry>
<entry key="/RForApplication">
<ref bean="webServiceForGlobal" />
</entry>
</map>
</property>
</bean>
<!-- 使用XFire导出器 -->
<bean id="baseWebService" class="org.codehaus.xfire.spring.remoting.XFireExporter" lazy-init="false" abstract="true">
<!-- 引用xfire.xml中定义的工厂 -->
<property name="serviceFactory" ref="xfire.serviceFactory" />
<!-- 引用xfire.xml中的xfire实例 -->
<property name="xfire" ref="xfire" />
</bean>
<!-- 服务请求的地址,与上面访问的url地址是对应的 -->
<bean id="webServiceForApplication" parent="baseWebService">
<!-- 业务服务bean 定义的接口的实现类 与spring配置文件中的是对应的 -->
<property name="serviceBean" ref="webServiceForApplicationImpl" />
<!-- 业务服务bean的窄接口类 定义的接口 ,实现类的接口-->
<property name="serviceClass" value="com.webservice.IWebServiceForApplication" />
</bean>
<bean id="webServiceForGlobal" parent="baseWebService">
<!-- 业务服务bean 定义的接口的实现类 与spring配置文件中的是对应的 -->
<property name="serviceBean" ref="webServiceForGlobalImpl" />
<!-- 业务服务bean的窄接口类 定义的接口 ,实现类的接口-->
<property name="serviceClass" value="com.webservice.IWebServiceForGlobal" />
</bean>
</beans>
2.web.xml
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/spring/applicationContext-import.xml,/WEB-INF/xfire-servlet.xml
</param-value>
</context-param>
<servlet>
<servlet-name>XFireServlet</servlet-name>
<servlet-class>
org.codehaus.xfire.spring.XFireSpringServlet
</servlet-class>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>XFireServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
3.接口包中添加IWebServiceForApplication.aegis.xml 与接口名对应的.aegis.xml文件
IWebServiceForApplication.aegis.xml 文件内容用于有好显示接口参数名称
<mappings>
<mapping>
<method name="getDeviceList">
<parameter index="0" mappedName="username"/>
<parameter index="1" mappedName="password" />
<parameter index="2" mappedName="productSpec" />
<parameter index="3" mappedName="level" />
</method>
</mapping>
</mappings>
4.远程接口实现类中可以使用Spring ioc注入bean对象
5.文件结构