- 浏览: 434040 次
- 性别:
- 来自: 深圳
文章分类
最新评论
-
qja:
Iterator.remove()这个方法也会出错的。
java.util.ConcurrentModificationException 出现的原因和解决办法 -
angeli:
List<String> save = new A ...
java.util.ConcurrentModificationException 出现的原因和解决办法 -
大峰子:
灰常感谢 刚好碰到这个问题, 搜了好多都没找到解决方法
python学习笔记-Python交互模式下方向键出现乱码 -
anypwx:
牛哥,怎么找到的,解决了我的报错问题,谢谢
JSONObject NestableRuntimeException -
tp7300:
确实好很多了,谢谢博主。
Failed to install on device 'emulator-5554': timeout
第一次接触webservice,所以想在原有的项目上增加webservice功能,没想到今天相当的郁闷,遇到很多的错误,所以花了差不多一下午的时间去解决,不过最后终于成功了。下面是一个小例子(采用自底向上的开发模式)。写下来供以后参考。以下是主要配置文件。
配置步骤:
《1》、导包
struts2:
1. commons-logging-1.0.4.jar
2. freemarker-2.3.13.jar
3. ognl-2.6.11.jar
4. struts2-core-2.1.6.jar
5. xwork-2.1.2.jar
6. commons-fileupload-1.2.1.jar
7. commons-io-1.3.2.jar
8. struts2-spring-plugin-2.1.6.jar
spring2:
1. log4j-1.2.14.jar
2. aspectjweaver.jar
3. aspectjrt.jar
4. spring.jar
xfire-1.2.6(从网上下载新版本,然后把jar包导入WEB-INF\lib下:xfire-all-1.2.6.jar和lib下的所有包)
《2》、删除一些会冲突的包
把lib下的x-fire中的spring-1.2.6.jar删掉,它会和spring2中的spring.jar包发生冲突。
《3》配置web.xnl
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:applicationContext-*.xml,classpath:org/codehaus/xfire/spring/xfire.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>xfireServlet</servlet-name>
<servlet-class>org.codehaus.xfire.transport.http.XFireConfigurableServlet</servlet-class>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>xfireServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
<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>/servlet/XFireServlet/*</url-pattern>
</servlet-mapping>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>login.jsp</welcome-file>
</welcome-file-list>
</web-app>
《4》配置struts.xml(在该例子中还用不到它,以下配置只是与spring2集成)
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.objectFactory" value="spring" />
<package name="public" extends="struts-default">
<action name="login" class="loginAction">
......
</action>
</package>
</struts>
《5》配置applicationContext-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"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
<bean id="connectDb" class="jxust.zjh.db.ConnectDb" />
<bean id="educate" class="jxust.zjh.educateImpl" />
<bean name="helloService" class="org.codehaus.xfire.spring.ServiceBean">
<property name="serviceBean" ref="educate"/>
<property name="serviceClass" value="jxust.zjh.Ieducate"/>
<property name="inHandlers" ref="addressingHandler" />
</bean>
<bean id="addressingHandler" class="org.codehaus.xfire.addressing.AddressingInHandler"/>
</beans>
《6》配置applicationContext-actions.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"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
<bean id="public" abstract="true">
<property name="connectDb" ref="connectDb" />
</bean>
<bean id="loginAction" class="jxust.zjh.actions.LoginAction" scope="prototype" parent="public">
</bean>
</beans>
《7》修改services.xml(由于用的是spring2.0,所以把xmlns="http://xfire.codehaus.org/config/1.0"放在<service>中)
<?xml version="1.0" encoding="UTF-8"?>
<beans >
<service xmlns="http://xfire.codehaus.org/config/1.0">
<name>educate</name>
<serviceClass>jxust.zjh.Ieducate</serviceClass>
<implementationClass>jxust.zjh.educateImpl</implementationClass>
<style>wrapped</style>
<use>literal</use>
<scope>application</scope>
</service></beans>
《8》编写一个简单的接口和实现类(用来测试)
Ieducate.java
package jxust.zjh;
public interface Ieducate {
public String queryStudent(String s_card);
}
EducateImpl.java(该实现类依赖了其他类的对象)
package jxust.zjh;
public class EducateImpl implements Ieducate {
public String queryStudent(String s_card) {
return "该学生学号是:"+s_card;
}
}
这样在浏览器中输入:http://localhost:8080/EducateSystem_server/services/educate?wsdl
就可以看到生成的wsdl文件了
配置步骤:
《1》、导包
struts2:
1. commons-logging-1.0.4.jar
2. freemarker-2.3.13.jar
3. ognl-2.6.11.jar
4. struts2-core-2.1.6.jar
5. xwork-2.1.2.jar
6. commons-fileupload-1.2.1.jar
7. commons-io-1.3.2.jar
8. struts2-spring-plugin-2.1.6.jar
spring2:
1. log4j-1.2.14.jar
2. aspectjweaver.jar
3. aspectjrt.jar
4. spring.jar
xfire-1.2.6(从网上下载新版本,然后把jar包导入WEB-INF\lib下:xfire-all-1.2.6.jar和lib下的所有包)
《2》、删除一些会冲突的包
把lib下的x-fire中的spring-1.2.6.jar删掉,它会和spring2中的spring.jar包发生冲突。
《3》配置web.xnl
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:applicationContext-*.xml,classpath:org/codehaus/xfire/spring/xfire.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>xfireServlet</servlet-name>
<servlet-class>org.codehaus.xfire.transport.http.XFireConfigurableServlet</servlet-class>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>xfireServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
<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>/servlet/XFireServlet/*</url-pattern>
</servlet-mapping>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>login.jsp</welcome-file>
</welcome-file-list>
</web-app>
《4》配置struts.xml(在该例子中还用不到它,以下配置只是与spring2集成)
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.objectFactory" value="spring" />
<package name="public" extends="struts-default">
<action name="login" class="loginAction">
......
</action>
</package>
</struts>
《5》配置applicationContext-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"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
<bean id="connectDb" class="jxust.zjh.db.ConnectDb" />
<bean id="educate" class="jxust.zjh.educateImpl" />
<bean name="helloService" class="org.codehaus.xfire.spring.ServiceBean">
<property name="serviceBean" ref="educate"/>
<property name="serviceClass" value="jxust.zjh.Ieducate"/>
<property name="inHandlers" ref="addressingHandler" />
</bean>
<bean id="addressingHandler" class="org.codehaus.xfire.addressing.AddressingInHandler"/>
</beans>
《6》配置applicationContext-actions.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"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
<bean id="public" abstract="true">
<property name="connectDb" ref="connectDb" />
</bean>
<bean id="loginAction" class="jxust.zjh.actions.LoginAction" scope="prototype" parent="public">
</bean>
</beans>
《7》修改services.xml(由于用的是spring2.0,所以把xmlns="http://xfire.codehaus.org/config/1.0"放在<service>中)
<?xml version="1.0" encoding="UTF-8"?>
<beans >
<service xmlns="http://xfire.codehaus.org/config/1.0">
<name>educate</name>
<serviceClass>jxust.zjh.Ieducate</serviceClass>
<implementationClass>jxust.zjh.educateImpl</implementationClass>
<style>wrapped</style>
<use>literal</use>
<scope>application</scope>
</service></beans>
《8》编写一个简单的接口和实现类(用来测试)
Ieducate.java
package jxust.zjh;
public interface Ieducate {
public String queryStudent(String s_card);
}
EducateImpl.java(该实现类依赖了其他类的对象)
package jxust.zjh;
public class EducateImpl implements Ieducate {
public String queryStudent(String s_card) {
return "该学生学号是:"+s_card;
}
}
这样在浏览器中输入:http://localhost:8080/EducateSystem_server/services/educate?wsdl
就可以看到生成的wsdl文件了
发表评论
-
solr学习笔记-linux下配置solr
2012-05-26 20:03 7857本文地址: http://zhoujianghai. ... -
关于javac编译时出现“非法字符:\65279”的解决方法
2012-04-12 11:25 1849一些文本编辑软件在保存一个以UTF-8编码的文件时 ... -
UrlConnection连接和Socket连接的区别
2011-10-14 15:22 7066关于UrlConnection连接和Socket连接的区别,只 ... -
搜狗的一道关于加密解密的在线测评题目
2011-10-01 15:04 1570是一个信息编码的程序,阅读其encode部分,并补全其deco ... -
java实现快速排序
2011-09-08 11:00 1290/** * 快速排序 * @author zho ... -
java实现大数相乘
2011-09-08 10:41 3428计算大数:1234567891011121 ... -
java.util.ConcurrentModificationException 出现的原因和解决办法
2011-05-12 17:03 39222用iterator遍历集合时碰到java.util.Co ... -
Java:ArrayList和LinkedList区别
2011-02-15 16:30 1545一般大家都知道ArrayList ... -
java.lang.LinkageError: loader constraint violation: when resolving interface...
2010-10-06 22:12 2310java.lang.LinkageError: load ... -
JAVA多线程
2010-08-07 14:46 1026多线程 线程:是指进程中的一个执行流程。 线程与进程的区别 ... -
struts2常量详解
2010-06-11 08:55 1617struts2的配置文件之struts ... -
深入Java虚拟机:JVM中的Stack和Heap
2010-05-16 15:02 1070在JVM中,内存分为两个部分,Stack(栈)和Heap(堆) ... -
关于java的作用域protected
2010-05-10 19:54 1890在某个类中定义的protected 方法和属性和默认权限方法和 ... -
关于org.springframework.security.AccessDeniedException: Access is denied
2010-05-06 19:34 7617在做系统权限管理时使用了springsecurity,出现了如 ... -
struts2的struts.xml文件中package里的元素排列顺序
2010-04-22 09:52 1852package里元素必须按照一定的顺序排列,排列顺序如下: ... -
struts2自定义404错误页面
2010-04-21 17:50 5291以前做的一个网站,最近服务器后台出现一些异常,问题是客户访问一 ... -
hibernate的主键生成策略(generator)详解
2010-04-14 09:30 1743assigned” 主键由外 ... -
ssh开发关于struts2,action中方法执行两次的问题
2010-04-10 20:58 2308前段时间发现了一个很奇怪的问题,我的项目中关于action中的 ... -
org.hibernate.hql.ast.QuerySyntaxException: xx is not mapped [sql语句]
2010-04-08 10:06 2180今天一时大意,写了下面这条查询语句 final String ... -
Attempted a bean operation on a null object(tomcat5.0以上版本)
2010-03-24 21:45 1840今天做scwcd模拟题的时候,碰到这样一个题目: A serv ...
相关推荐
xfire+spring+webservice+client xfire+spring+webservice+client xfire+spring+webservice+client
收集的Java Web整合开发实战:基于Struts 2+Hibernate+Spring-源代码,看到其他人下载币要的太多,给大家分享一下。 不是很全,但可以拿来参考了。 由于大小限制,还有另外一个包······
xfire+spring+webservice xfire+spring+webservice xfire+spring+webservice xfire+spring+webservice
spring+xfire( 编写webservice完整配置+案例)
webservice教程(xfire+spring)webservice教程(xfire+spring)webservice教程(xfire+spring)webservice教程(xfire+spring)
JQuery1.4.2+Struts2.1.8+JSON0.34+Spring2.5.6+Hibernate3.5+XFire1.2.6整合实例(已上传) 1、JSON0.34使用的是struts2附带的struts2-json-plugin-2.1.8.1.jar 2、db是mysql,名字为test,用户名root,密码空 3、...
xfire+spring开发webservice 很不错的文档
xfire+spring+安全认证,包含服务端和客户端,xfire jar包可以从我的资源下面下或网上很多。
spring3+hibernate4+struts2+maven全注解整合,楼主整合hibernate4出现了一点问了,弄了两天才弄好
用XFire开发WebService Spring注解
《Java Web整合开发王者归来(JSP+Servlet+Struts+Hibernate+Spring)》全面介绍了Java Web开发中的各种相关技术及知识。全书分为9篇,内容层次清晰,难度循序渐进。第1篇为入门篇,内容包括Java Web开发概述等;第2篇...
1、JSON0.34使用的是struts2附带的struts2-json-plugin-2.1.8.1.jar 2、db是mysql,名字为test,用户名root,密码空 3、com.morningstar.utility.WSUtility为调用WebService的客户端代码,在调用这个WebService返回...
使用XFire+Spring构建Web Service使用XFire+Spring构建Web Service使用XFire+Spring构建Web Service使用XFire+Spring构建Web Service使用XFire+Spring构建Web Service使用XFire+Spring构建Web Service
xfire+spring webservice
NULL 博文链接:https://chengwang.iteye.com/blog/623428
JSP+Servlet+SqlServer+WebService(XFire)E-家园网站 非常适合自学使用
用maven管理的,xfire+spring开发的webservice例子
webservice+spring+xfire完整项目(包含jar包),只要导入myeclipse就可以直接使用,已经导入所需的所有jar包了
webservice xfire jar包 spring开发,集成spring开发 webservice xfire jar包 spring开发,集成spring开发 有问题随时联系博客
xFire+spring webService示例 用过的