没有合适的资源?快使用搜索试试~ 我知道了~
首页结合Spring框架的 CXF WebService编程实例
结合Spring框架的 CXF WebService编程实例
3星 · 超过75%的资源 需积分: 10 7 下载量 128 浏览量
更新于2023-03-16
评论
收藏 70KB DOCX 举报
本实例对于刚学习webservice的同学来说讲的非常细致,交你一个菜鸟能写出webservice实例
资源详情
资源评论
资源推荐
结合 Spring 框架的 CXF WebService 编程实例
1. 需要的 jar 包 ,除了以上的 jar 包以外,还需要 Spring 包,这里就不
一一列出了,根据项目的不同可能还需要其他的 jar 包,后期调试的时候根据控制台出现的问
题,找出原因。
的配置:
加载 容器配置
设置 容器加载配置文件路径
!"#$%!!"
"&"
!
!'(!!
!#!'(!!
!
!
!'(!!
"$"
!
然后在 目录中,新建一个 ! 文件,这个 !
需要在 文件中引入(仔细查看上面在 中的配置),当然不一定非要新建
!,也可以写在 中如果
! 没有写在 下面则 中的文件应该这样写<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/classes/config/spring/*.xml</param-value>
</context-param>
(这里解释下:自己查看下编译后的 ! 的位置是在项目)。我这是在
src 下面新建了 cong 和 spring 两个包,再在里面新建的 !(我这里够啰
嗦的了,但是为了你们明白点,别整晕了啊,哈哈哈)。下面是 ! 中的内容:
<?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"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
<!-- ======================= webService 接口 ===================== -->
<import resource="classpath:META-INF/cxf/cxf.xml"/>
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>
<import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
<!-- 配置好 webservices
的类名和服务名 -->
<bean id="PersonServiceImpl" class="com.service.impl.PersonServiceImpl">
<property name="employeeDAO">
<ref bean="employeeDAO" />
</property>
</bean>
<jaxws:server id="PersonService" serviceClass="com.service.PersonService"
address="/PersonService">
<jaxws:serviceBean>
<!-- 要暴露的 bean 的引用 -->
<ref bean="PersonServiceImpl"/>
</jaxws:serviceBean>
</jaxws:server>
</beans>
好了以上就是 webservice 服务器端外围的 webservice 环境;下面介绍具体的编码实例;
Javabean 文件:里面有 3 个属:编号,姓名,电话
package com.service;
public class Person {
private String code;
private String name;
private String tel;
public String getName() {
return name;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public void setName(String name) {
this.name = name;
}
剩余13页未读,继续阅读
madegebivs
- 粉丝: 2
- 资源: 9
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- RTL8188FU-Linux-v5.7.4.2-36687.20200602.tar(20765).gz
- c++校园超市商品信息管理系统课程设计说明书(含源代码) (2).pdf
- 建筑供配电系统相关课件.pptx
- 企业管理规章制度及管理模式.doc
- vb打开摄像头.doc
- 云计算-可信计算中认证协议改进方案.pdf
- [详细完整版]单片机编程4.ppt
- c语言常用算法.pdf
- c++经典程序代码大全.pdf
- 单片机数字时钟资料.doc
- 11项目管理前沿1.0.pptx
- 基于ssm的“魅力”繁峙宣传网站的设计与实现论文.doc
- 智慧交通综合解决方案.pptx
- 建筑防潮设计-PowerPointPresentati.pptx
- SPC统计过程控制程序.pptx
- SPC统计方法基础知识.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论1