XFire 1.2X 使用 Spring 2.0 的 services.xml配置
2009-01-19 15:32
483 查看
一、XFire 使用Spring1.2×版本的时候services.xml的配置方式是
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xfire.codehaus.org/config/1.0">
<service>
</service>
</beans>
上面这种方式在spirng 2.X中会报错。
二、XFire 使用Spring 2×版本的时候services.xml的配置方式改为
<?xml version="1.0" encoding="UTF-8"?>
<beans>
<service xmlns="http://xfire.codehaus.org/config/1.0">
</service>
</beans>
三、直接与spring2.x集成
需要修改的xml:web.xml,applicationContext.xml
1)、webl.xml 部分
<servlet>
<servlet-name>XFireServlet</servlet-name>
<servlet-class>org.codehaus.xfire.spring.XFireSpringServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>XFireServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>XFireServlet</servlet-name>
<url-pattern>/servlet/XFireServlet/*</url-pattern>
</servlet-mapping>
<..>web.xml配置spirng部分加上xfire.xml的路径
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/applicationContext.xml,
classpath:org/codehaus/xfire/spring/xfire.xml
<!--
或在 applicationContext.xml 中导入
-->
</param-value>
</context-param>
2)、applicationContext.xml
<!-- 实现类-->
<bean id="LoginServiceImpl" class="com.LoginServiceImpl"/>
<bean id="addressingHandler" class="org.codehaus.xfire.addressing.AddressingInHandler"/>
<bean id="LoginService" class="org.codehaus.xfire.spring.ServiceBean">
<!---实现类引用-->
<property name="serviceBean" ref="LoginServiceImpl"/>
<!--实现的接口-->
<property name="serviceClass" value="com.LoginService"/>
<!--服务名称-->
<property name="name" value="LoginService"/>
<property name="inHandlers">
<list>
<ref bean="addressingHandler"/>
</list>
</property>
</bean>
四、jsr181 结合@xxx注解
<bean id="xfire.annotationServiceFactory"
class="org.codehaus.xfire.annotations.AnnotationServiceFactory">
<constructor-arg index="0">
<ref bean="xfire.commonsAnnotations"/>
</constructor-arg>
<constructor-arg index="1">
<ref bean="xfire.transportManager"/>
</constructor-arg>
<constructor-arg index="2">
<ref bean="xfire.aegisBindingProvider"/>
</constructor-arg>
</bean>
<bean id="xfire.commonsAnnotations"
class="org.codehaus.xfire.annotations.jsr181.Jsr181WebAnnotations"/>
<bean id="LoginServiceImpl" class="com.LoginServiceImpl"/>
<bean id="addressingHandler" class="org.codehaus.xfire.addressing.AddressingInHandler"/>
<bean id="LoginService" class="org.codehaus.xfire.spring.ServiceBean">
<!---实现类引用-->
<property name="serviceBean" ref="LoginServiceImpl"/>
<!--实现的接口-->
<property name="serviceClass" value="com.LoginService"/>
<!--添加引用-->
<property name="serviceFactory" ref ="xfire.annotationServiceFactory"/>
<!--服务名称-->
<property name="name" value="LoginService"/>
<property name="inHandlers">
<list>
<ref bean="addressingHandler"/>
</list>
</property>
</bean>
@WebService(name="LoginService")
public interface LoginService{
@WebMethod
public String login(@WebParam(name = "username")String username,@WebParam(name = password") String password);
}
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xfire.codehaus.org/config/1.0">
<service>
</service>
</beans>
上面这种方式在spirng 2.X中会报错。
二、XFire 使用Spring 2×版本的时候services.xml的配置方式改为
<?xml version="1.0" encoding="UTF-8"?>
<beans>
<service xmlns="http://xfire.codehaus.org/config/1.0">
</service>
</beans>
三、直接与spring2.x集成
需要修改的xml:web.xml,applicationContext.xml
1)、webl.xml 部分
<servlet>
<servlet-name>XFireServlet</servlet-name>
<servlet-class>org.codehaus.xfire.spring.XFireSpringServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>XFireServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>XFireServlet</servlet-name>
<url-pattern>/servlet/XFireServlet/*</url-pattern>
</servlet-mapping>
<..>web.xml配置spirng部分加上xfire.xml的路径
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/applicationContext.xml,
classpath:org/codehaus/xfire/spring/xfire.xml
<!--
或在 applicationContext.xml 中导入
<import resource="classpath:org/codehaus/xfire/spring/xfire.xml"/>
-->
</param-value>
</context-param>
2)、applicationContext.xml
<!-- 实现类-->
<bean id="LoginServiceImpl" class="com.LoginServiceImpl"/>
<bean id="addressingHandler" class="org.codehaus.xfire.addressing.AddressingInHandler"/>
<bean id="LoginService" class="org.codehaus.xfire.spring.ServiceBean">
<!---实现类引用-->
<property name="serviceBean" ref="LoginServiceImpl"/>
<!--实现的接口-->
<property name="serviceClass" value="com.LoginService"/>
<!--服务名称-->
<property name="name" value="LoginService"/>
<property name="inHandlers">
<list>
<ref bean="addressingHandler"/>
</list>
</property>
</bean>
四、jsr181 结合@xxx注解
<bean id="xfire.annotationServiceFactory"
class="org.codehaus.xfire.annotations.AnnotationServiceFactory">
<constructor-arg index="0">
<ref bean="xfire.commonsAnnotations"/>
</constructor-arg>
<constructor-arg index="1">
<ref bean="xfire.transportManager"/>
</constructor-arg>
<constructor-arg index="2">
<ref bean="xfire.aegisBindingProvider"/>
</constructor-arg>
</bean>
<bean id="xfire.commonsAnnotations"
class="org.codehaus.xfire.annotations.jsr181.Jsr181WebAnnotations"/>
<bean id="LoginServiceImpl" class="com.LoginServiceImpl"/>
<bean id="addressingHandler" class="org.codehaus.xfire.addressing.AddressingInHandler"/>
<bean id="LoginService" class="org.codehaus.xfire.spring.ServiceBean">
<!---实现类引用-->
<property name="serviceBean" ref="LoginServiceImpl"/>
<!--实现的接口-->
<property name="serviceClass" value="com.LoginService"/>
<!--添加引用-->
<property name="serviceFactory" ref ="xfire.annotationServiceFactory"/>
<!--服务名称-->
<property name="name" value="LoginService"/>
<property name="inHandlers">
<list>
<ref bean="addressingHandler"/>
</list>
</property>
</bean>
@WebService(name="LoginService")
public interface LoginService{
@WebMethod
public String login(@WebParam(name = "username")String username,@WebParam(name = password") String password);
}
相关文章推荐
- Spring中使用xml配置bean的细节
- Spring整合Hibernate配置(使用hibernate.cfg.xml文件)
- spring如何使用多个xml配置文件
- 【Spring in action】基于xml配置:在SpringMVC中使用Spring容器
- Spring中使用 PropertyPlaceholderConfigurer 替换xml配置文件中的Bean配置项
- hibernate3-maven-plugin 使用 spring applicationContext.xml中的sessionFactory配置(1)
- spring使用aop时xml中的配置
- Spring-Context之三:使用XML和Groovy DSL配置Bean
- (笔记)Spring实战_最小化Spring XML配置(2)_使用注解装配
- spring 第3天使用java类和XML配置bean
- XFire中Services.xml 配置的一些细节
- spring使用多个xml配置文件 【转】
- Spring Boot通过Mybatis,使用mapper接口和xml配置sql,连接数据库
- Spring中使用注解代替xml配置文件
- Spring2.0简明手册(系列之一 Bean的配置及使用)
- spring如何使用多个xml配置文件
- 12、(知识篇)Spring使用xml配置bean01
- spring如何使用多个xml配置文件 【转】
- Spring使用多个xml配置文件
- 使用spring web.xml里的配置 - 请求处理器DispatcherServlet