利用CXF框架开发webservice
1. web.xml文件中添加cxf的servlet

2. 定义接口
@WebService(targetNamespace="http://UserInfo.ws.com",name="UserInfoWebServiceImpl",
portName="UserInfoWebServicePort",serviceName="UserInfoWebService")
public interface UserInfoWebService {
public void sayWord();
public List findAll();
}
3.实现接口
public class UserInfoWebServiceImpl implements UserInfoWebService
{
private UserInfoService userInfoService = new
UserInfoService();
@Override
public void sayWord() {
System.out.println("hell
world");
}
@Override
public List findAll() {
return
userInfoService.findAll();
}
}
4.在applicationContext.xml文件中配置webservice接口

serviceClass值是在服务器端程序中的位置
5.启动应用
访问webservice http://127.0.0.1:8080/wsserver/ws
这是在web.xml文件中配置的
开发客户端代码
1. 利用wsdl2java生成客户端的代码
wsdl2java -d
. http://127.0.0.1:8080/wsserver/ws/userInfo?wsdl
wsdl2java在cxf里
在生成的文件夹中可能会有很多java文件,但我们只需要接口的实现类和相应的实体类文件,将接口的实现类和实体类放在相应的包中
2.在applicationContext文件中配置webservice接口

serviceClass值是在客户端程序中的位置
3. 在程序中调用webservice接口
UserInfoWebServiceImpl
userInfoWebService = (UserInfoWebServiceImpl)
applicationContext.getBean("userInfoService2");
List userInfoList =
userInfoWebService.findAll();
利用CXF框架开发webservice的更多相关文章
- WebService系列二:使用JDK和CXF框架开发WebService
一.使用JDK开发WebService 服务端程序创建: 1.新建一个JDK开发webservice的服务端maven项目JDKWebServiceServer 2. 定义一个接口,使用@WebSer ...
- WEBSERVICE之CXF框架开发webservice
之前学习了使用jdk开发webservice服务,现在开始学习使用框架(cxf)开发webservice. 1.准备工作 A.使用cxf开发webservice服务,需要用到apache-cxf-3. ...
- Eclipse+CXF框架开发Web服务实战
一. 说明 采用CXF框架开发webservice. 所用软件及版本如下. 操作系统:Window XP SP3. JDK:JDK1.6.0_07,http://www.oracle.com/ ...
- CXF Spring开发WebService,基于SOAP和REST方式 【转】
官网示例 http://cxf.apache.org/docs/writing-a-service-with-spring.html http://cxf.apache.org/docs/jax-rs ...
- CXF Spring开发WebService,基于SOAP和REST方式
版本CXF2.6.9 添加的包文件 这个版本的不可在Tomcat7上运行,会出错. 配置文件 applicationContext.xml <?xml version="1.0&quo ...
- 利用General框架开发RDLC报表
RDLC是微软推出的自家的报表软件,虽然没有一些第三方的报表软件强大好用,但是作为VisualStudio集成的报表工具,在客户要求不高的情况下还是非常值得一用的,本文将介绍通过General代码生成 ...
- 利用SSH框架开发时遇到的各种Bug及解决方法
.hibernate自动生成的配置文件 hibernate.cfg.xml 有时候是有问题的,会出现 org.hibernate.HibernateException: Could not parse ...
- webservice第三篇【接口开发webservice、CXF框架使用、IDEA下使用webservice、小例子】
实现接口的webservice 服务端 import javax.jws.WebService; /**面向接口的webservice发布方式 * * */ @WebService public in ...
- struts1+spring+myeclipse +cxf 开发webservice以及普通java应用调用webservice的实例
Cxf + Spring+ myeclipse+ cxf 进行 Webservice服务端开发 使用Cxf开发webservice的服务端项目结构 Spring配置文件applicationCont ...
随机推荐
- 集合 Vector ArrayList 集合一
集合是存储对象的,与对象数组不同,集合可以自动的扩大自己的容量,像StringBuffer一样,存储的对象类型可以不一致,(object数组). 方法: add();remove();get();se ...
- ASP.NET中RegisterStartupScript和RegisterClientScriptBlock有区别吗
今天用RegisterClientScriptBlock()方法调用了alertify.js(绚丽的实现alert()同样的提示功能): Page.ClientScript.RegisterClien ...
- C#反射Assembly 详细说明(转)
1.对C#反射机制的理解2.概念理解后,必须找到方法去完成,给出管理的主要语法3.最终给出实用的例子,反射出来dll中的方法 反射是一个程序集发现及运行的过程,通过反射可以得到*.exe或*.dll等 ...
- js计算两个时间之间的间隔
计算时间间隔的方法有很多,这里只是一种方式,可以方法里直接传入两个时间,也可以传入两个字符串格式的时间,在方法里解析一下就ok,这个例子里不传入参数,直接在方法里随便写一个时间来演示一下 fun() ...
- 我的第一个JSP
首先在新建一个Webproject 再在WebRoot以下new一个HelloWorld.jsp 改动body里面的内容 <body> <h1>HelloWorld:& ...
- springboot 项目跨域问题 CORS
package com.example.demo.cors; import org.springframework.context.annotation.Bean; import org.spring ...
- Summaries On Java
@1:== 和 equals(): ==用于比较引用和比较基本数据类型时具有不同的功能: 比较基本数据类型:如果两个值相同,则结果为true. 比较引用:如果引用指向内存中的同一对象,结果为true( ...
- mssql 中文乱码 字库集 问题解决方法
The database could not be exclusively locked to perform the operation(SQL Server 5030错误解决办法) SQL S ...
- CSS3 animation-iteration-count:infinite
原文:http://www.w3chtml.com/css3/properties/animation/animation-iteration-count.html animation-iterati ...
- zabbix监控Mariadb数据库
1.介绍: zabbix自带的MySQL插件来监控mysql数据库,但是太过简陋,基本没有啥作用,所以需要做更详细的监控,而percona就有这个详细监控的模版以及脚本,正好拿过来用. percona ...