接着上一篇xfire和spring结合的几种方式一,继续学习。
1。直接集成Spring(通过Spring的org.springframework.web.servlet.DispatcherServlet)
新建一个web工程 XfireService,倒入包,新建一个实体类,接口类,接口实现类。这些和上一篇相同,所以省略,一下主要列出不一样的。
web.xml配置如下:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<!-- START SNIPPET: xfire -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>xfire</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>xfire</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
<!-- END SNIPPET: xfire -->
</web-app>
applicationContext.xml配置如下:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="userServiceBean" class="com.zx.xfiretext.webserver.UserServiceImpl"/>
</beans>
在WEB-INF下新建一个xfire-servlet.xml,配置如下:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<!-- 引入XFire预配置信息 -->
<import resource="classpath:org/codehaus/xfire/spring/xfire.xml" />
<!-- 义访问的url-->
<bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="urlMap">
<map>
<entry key="/UserService">
<ref bean="UserService"/>
</entry>
</map>
</property>
</bean>
<!-- 使用XFire导出器 -->
<bean id="baseWebService" class="org.codehaus.xfire.spring.remoting.XFireExporter" lazy-init="true" abstract="true">
<!-- 引用xfire.xml中定义的工厂 -->
<property name="serviceFactory" ref="xfire.serviceFactory" />
<!-- 引用xfire.xml中的xfire实例 -->
<property name="xfire" ref="xfire" />
</bean>
<bean id="UserService" parent="baseWebService">
<!-- 业务服务bean -->
<property name="serviceBean" ref="userServiceBean" />
<!-- 业务服务bean的窄接口类 -->
<property name="serviceClass" value="com.zx.xfiretext.webserver.UserService" />
</bean>
</beans>
测试和上一篇一样~~
学习到次
分享到:
相关推荐
spring xfire spring 集成xfire 比较好的一种方式
xFire与Spring集成xFire与Spring集成xFire与Spring集成xFire与Spring集成xFire与Spring集成
XFire与Spring组合发布webservices的几种方式实例,可以直接导入到环境运行
自己写给同事培训的xfire整合spring的小项目 步骤清晰 简单易懂 适合刚刚接触xfire的同事们
xfire+spring+webservice+client xfire+spring+webservice+client xfire+spring+webservice+client
xfire+spring+安全认证,包含服务端和客户端,xfire jar包可以从我的资源下面下或网上很多。
xfire-spring,学习WebService,Xfire和Spring集成的好资料。
xfire+spring开发webservice 很不错的文档
源代码 博文链接:https://callan.iteye.com/blog/135438
xfire集成了spring的jar包,放到工程中引用即可用xfire集成spring的方式进行webservice接口开发
XFire与Spring集成WebService客户端的两种开发方式.pdfXFire与Spring集成WebService客户端的两种开发方式.pdfXFire与Spring集成WebService客户端的两种开发方式.pdfXFire与Spring集成WebService客户端的两种开发方式...
XFire 是与Axis 2并列的新一代Web Service框架,通过提供简单的API支持Web Service各项标准协议,帮助你方便快速地开发Web Service应用。 相对于Axis来说,目前XFire相对受欢迎,加上其提供了和Spring集成的支持,在...
Xfire1.2.6和Spring2整合 访问时提供了三种不同的方法
webservice(xfire)+spring的二种实现方式,里面有详细的配置说明.
webservice中用到的jar,xfire-spring-1.2.6.jar,xfire-spring-1.2.6.jar,xfire-spring-1.2.6.jar,xfire-spring-1.2.6.jar
xfire+Spring整合发布webservice,详细解释配置过程,及是替代码,帮助一部分需要这方面开发的人员。
xfire与 spring整合框架。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
1 支持一系列Web Service的新标准--JSR181、WSDL2.0 、JAXB2、WS-Security等; 2 使用Stax解释XML,性能有了质的提高。XFire采用Woodstox 作Stax实现;...9 XFire的响应时间是Axis1.3的1/2到1/5。
xfire与spring集成,xfire webservice安全认证,及客户端通过安全认证调用