CXF+Spring 搭建的WebService
1.创建类

2.接口编写
package com.fan; import javax.jws.WebService; @WebService
public interface IHelloWorld {
void SayHi(String str);
}// end
3.实现类编写
package com.fan;
import javax.jws.WebService;
import org.springframework.stereotype.Service;
@Service("RHelloWorld")
@WebService(endpointInterface = "com.fan.IHelloWorld")
public class RHelloWorld implements IHelloWorld {
public void SayHi(String str) {
// TODO Auto-generated method stub
System.out.println("SayHi:" + str);
}
}// end
4.web配置文件编写
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>Fan</display-name>
<filter>
<filter-name>characterEncodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>characterEncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<servlet>
<display-name>CXFServlet</display-name>
<servlet-name>CXFServlet</servlet-name>
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/*</url-pattern>(ps:编写路径)
</servlet-mapping> <listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener> <context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:beans.xml(ps:beans配置文件)
</param-value>
</context-param>
</web-app>
5.编写beans.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation=" http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd"> <import resource="classpath:META-INF/cxf/cxf.xml"/>
<import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
<context:component-scan base-package="com.fan" />
<jaxws:endpoint id="appWsServer" implementor="#RHelloWorld" address="/appWsServer"/>(ps:实现类) </beans>
6.关键步骤,导入所需要的包
暂时没有精选最少导入哪些包,这里是我导入的包。



7.验证路径
http://localhost:8888/MyWebService/appWsServer?wsdl
请大神将需要的包给我精简一下。
CXF+Spring 搭建的WebService的更多相关文章
- 解决cxf+spring发布的webservice,types,portType和message以import方式导入
用cxf+spring发布了webservice,发现生成的wsdl的types,message和portType都以import的方式导入的.. 原因:命名空间问题 我想要生成的wsdl在同个文件中 ...
- CXF+Spring搭建webservice服务
Apache CXF 是一个开源的 Services 框架,CXF 帮助您利用 Frontend 编程 API 来构建和开发 Services ,像 JAX-WS .这些 Services 可以支持多 ...
- cxf+spring+数字签名开发webservice(一)
数字证书的准备 下面做的服务端和客户端证书在例子中无法加解密,不知道什么原因,我是使用正式环境中的客户端和服务端进行开发测试的,所以需要大家自己去准备证书,或者有人知道为什么jdk生成 ...
- cxf+spring+数字签名开发webservice(二)
场景 上一章中的webservice接口,因为现场正式环境的项目与外部单位网络不通,是通过前置机与外部进行数据交换,所以我们将webservice部署在前置机,在使用HttpURLCo ...
- cxf + spring + maven 开发webservice
1.maven 配置 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://ww ...
- 解决cxf+springmvc发布的webservice,缺少types,portType和message标签的问题
用cxf+spring发布了webservice,发现生成的wsdl的types,message和portType都以import的方式导入的.. 原因:命名空间问题 我想要生成的wsdl在同个文件中 ...
- 使用CXF和spring搭建webService服务
虽然下一个项目需要使用xfire,但是在查资料的过程中还是看到有不少地方都说cxf比xfire更好,cxf继承了xfire,但是不仅仅包含xfire,因此便也一起来尝试尝试.大概是有了xfire的经验 ...
- 客户端(C#)调用CXF搭建的webservice的出现一些问题记录
最近把XFire框架搭建的一个webservice换成CXF框架.访问webservice的客户端是C#写的.客户端调用webservice,数据能在客户端得到.看起来显然是成功了. 但其中在VS中添 ...
- Spring+CXF整合来管理webservice(服务器启动发布webservice)
Spring+CXF整合来管理webservice 实现步骤: 1. 添加cxf.jar 包(集成了Spring.jar.servlet.jar ),spring.jar包 ,serv ...
随机推荐
- RMAN - "丢失控制文件的恢复"
OS: Oracle Linux Server release 5.7 DB: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - ...
- Transact-SQL 语句
当流程控制语句必须执行一个包含两条或两条以上Transact-SQL语句块时,可以使用BEGIN...END语句进行控制 use testDB; go declare @name varchar() ...
- uva 11922 Permutation Transforme/splay tree
原题链接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=18902 伸展树的区间翻转剪切... 如下: #include< ...
- Mysql海量数据存储和解决方案之一—分布式DB方案
1) 分布式DB水平切分中用到的主要关键技术:分库,分表,M-S,集群,负载均衡 2) 需求分析:一个大型互联网应用每天几十亿的PV对DB造成了相当高的负载,对系统的稳定性的扩展性带来极大挑战. 3 ...
- Spring原来属于这家公司
Spring几年前被VMware公司收购,如今Spring版权隶属于Pivotal.Pivotal ONE对Spring提供整合.Greenplum提供了大数据服务,GEMFIRE内存集群技术帮助12 ...
- Linux 编辑器
vim编辑器 vi作为Unix上的一个编辑器,一直广受欢迎.之后GUN将其移植到开源世界中,经过开发人员对其进行了改善,被称为vi improved,就是现在的vim.为了方便使用,几乎所有的Linu ...
- Entity Framework 学习第一天
文章是作为初学者记录之用,没有学习过的同学可以借鉴一下,至于用过和高手嘛,就算了吧.仅是入门.废话不多说了,马上新建个项目,添加Entity Framework,这个词以下将用EF代替. 本文使用的I ...
- hmmer 使用(转载)
hmmer 使用 » 转载文章请注明,转载自:博耘生物 » <hmmer的安装与使用> » 原文链接:http://boyun.sh.cn/bio/?p=1753 从功能基因研究的角度 ...
- pb对Web Service的操作可使用两种方式实现
从PB8.0/9.0开始,就已经提供Web Service Proxy功能,能够直接进行相关程序的编写. 但是,部分老项目使用PB6.5开发 研究后发现,其实PB6.5要操作Web Service也挺 ...
- javascript面向对象分层思维
js本身不是面向对象语言,在我们实际开发中其实很少用到面向对象思想,以前一直以为当要复用的时候才封装成对象,然而随着现在做的项目都后期测试阶段发现面向对象的作用不仅仅只是复用,可能你们会说面向对象还有 ...