最近重新熟悉下webservice知识,以前用的是axis2,现在用另一种方式spring xfire来实现简单的webservice;
xfire和axis
xfire比axis性能高
axis比xfire响应时间短
一、在eclipse下新建项目工程xfire
二、导入基本的jar包
commons-codec-1.3.jar
commons-httpclient-3.0.jar
commons-logging-1.0.4.jar
jdom-1.0.jar
jsr181-api.jar
spring.jar
wsdl4j-1.6.1.jar
xfire-all-1.2.6.jar
XmlSchema-1.4.7.jar
三、web.xml配置
四、xfire-servlet.xml
copy
xfire和axis
xfire比axis性能高
axis比xfire响应时间短
一、在eclipse下新建项目工程xfire
二、导入基本的jar包
commons-codec-1.3.jar
commons-httpclient-3.0.jar
commons-logging-1.0.4.jar
jdom-1.0.jar
jsr181-api.jar
spring.jar
wsdl4j-1.6.1.jar
xfire-all-1.2.6.jar
XmlSchema-1.4.7.jar
三、web.xml配置
- <?xml version="1.0" encoding="UTF-8"?>
- <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
- display-name>xfire</>
- <!-- 定义装入的spring配置文件 -->
- context-param>
- param-name>contextConfigLocation param-value classpath:org/codehaus/xfire/spring/xfire.xml
- /WEB-INF/xfire-servlet.xml
- <!-- 自动装配配置信息 -->
- listener listener-class>org.springframework.web.context.ContextLoaderListener<!-- 它主要负责处理由 JavaBean Introspector 功能而引起的缓存泄露 -->
- org.springframework.web.util.IntrospectorCleanupListener
- <!-- 注意因为servlet-name为xfire,固xfire配置文件名应该是xfire-servlet.xml -->
- servlet>
- servlet-name servlet-class>org.springframework.web.servlet.dispatcherServletservlet-mappingurl-pattern>*.ws<!-- 配合spring容器中XFire一起工作的Servlet- -->
- >xfireServlet org.codehaus.xfire.spring.XFireSpringServlet
- >/services/*web-app>
四、xfire-servlet.xml
copy