CXF集成spring做webservice接口
一 . cxf 的jar包
1.cxf-2.3.3.jar
2.wsdl4j-1.6.2.jar
3.wss4j-1.5.11.jar
4.wstx-asl-3.2.0.jar
5.XmlSchema-1.4.7.jar
以上没有spring和cxf的依赖包后续更新
二. web.xml
<!-- cxf servlet -->
<servlet>
<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>/webservice/*</url-pattern>
</servlet-mapping>
三.applicationContext.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:jaxws="http://cxf.apache.org/jaxws"
xmlns:http-conf="http://cxf.apache.org/transports/http/configuration"
xmlns:cxf="http://cxf.apache.org/core"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
http://cxf.apache.org/transports/http/configuration
http://cxf.apache.org/schemas/configuration/http-conf.xsd http://cxf.apache.org/core
http://cxf.apache.org/schemas/core.xsd"> <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" /> <!-- 同步用户 -->
<bean id="synchronousUserImpl" class="cn.chinaunicom.pmis.interfaces.sso.server.impl.SynchronousUserImpl"></bean>
<jaxws:endpoint id="synchronousUser" implementor="#synchronousUserImpl" address="/synchronousUser"/>
</beans>
四.接口
import javax.jws.WebService; /**
* 同步用户webService
* @author duwenlei
*
*/
@WebService
public interface SynchronousUser {
/**
* 同步用户
* @param json
* @return
*/
boolean syncUser(String json);
}
五.接口实现
import javax.jws.WebService; import cn.chinaunicom.pmis.interfaces.sso.server.SynchronousUser; @WebService(endpointInterface="cn.chinaunicom.pmis.interfaces.sso.server.SynchronousUser")
public class SynchronousUserImpl implements SynchronousUser { @Override
public boolean syncUser(String json) {
System.err.println("success");
return false;
} }
六 . 运行tomcat
访问 http://localhost:8080/pmisx/webservice/synchronousUser?wsdl 成功则cxf部署成功
未完待续
CXF集成spring做webservice接口的更多相关文章
- CXF集成Spring实现webservice的发布与请求
CXF集成Spring实现webservice的发布(服务端) 目录结构: 主要代码: package com.cxf.spring.pojo; public class User { int id ...
- 一个CXF集成SPRING的WEBSERVICE完整实例
1 首先准备以下JAR包 activation.jar commons-logging-1.1.1.jar cxf-2.5.6.jar jaxb-api-2.2.1.jar jaxb-impl-2.1 ...
- CXF整合Spring开发WebService
刚开始学webservice时就听说了cxf,一直没有尝试过,这两天试了一下,还不错,总结如下: 要使用cxf当然是要先去apache下载cxf,下载完成之后,先要配置环境变量,有以下三步: 1.打开 ...
- loadrunner做webservice接口之简单调用
今天听大神讲了webservice做接口,我按照他大概讲的意思自己模拟实战了下,可能还有很多不对,一般使用webservice做接口,会使用到soapui,但是用了loadrunner以后发现lr很快 ...
- cxf设置代理访问webservice接口
由于业务上的需要,需要访问第三方提供的webservice接口,但由于公司做了对外访问的限制,不设置代理是不能外网的,如果使用http设置代理访问外网还是比较容易的,但使用cxf有点不知道从哪里入手. ...
- CXF整合Spring发布WebService实例
一.说明: 上一篇简单介绍了CXF以及如何使用CXF来发布一个简单的WebService服务,并且介绍了客户端的调用. 这一篇介绍如何使用CXF与spring在Web项目中来发布WebService服 ...
- 学习总结——JMeter做WebService接口功能测试
用JMeter作WebService接口功能测试(可以借助SoapUI来完成) SoapUI里面的操作: Wsdl文件或链接导入或添加到SoapUI打开待测请求:运行请求:取URL SOAPActi ...
- 使用cxf做webservice接口调用
一.服务端 建javaweb工程,去官网下载所需的cxf接口发布的jar包,导入到工程.官网地址:http://cxf.apache.org/download.html 1.建立调用接口 packag ...
- 使用CXF和spring搭建webService服务
虽然下一个项目需要使用xfire,但是在查资料的过程中还是看到有不少地方都说cxf比xfire更好,cxf继承了xfire,但是不仅仅包含xfire,因此便也一起来尝试尝试.大概是有了xfire的经验 ...
随机推荐
- codeforces 446C DZY Loves Fibonacci Numbers(数学 or 数论+线段树)(两种方法)
In mathematical terms, the sequence Fn of Fibonacci numbers is defined by the recurrence relation F1 ...
- 反射认识_03_改变成员变量Fields
包01:package ReflectionChange; public class ReflectionPoint_AB { String str1="access"; Stri ...
- 一天弹出一次广告cookie
function setCookie(name, value, expire) { window.document.cookie = name + "=" + escape(val ...
- 夺命雷公狗---TP商城----TP之配置环境---1
下载到tp3.2.3版本后架设到自己的wamp环境下,然后配置虚拟主机,完事后直接开工 环境下创建一个文件夹,然后里面存放这这两个文件即可开始新的旅途了 这里完了,下一步就开始配置index.php文 ...
- LDA-math-认识Beta/Dirichlet分布
http://cos.name/2013/01/lda-math-beta-dirichlet/#more-6953 2. 认识Beta/Dirichlet分布2.1 魔鬼的游戏—认识Beta 分布 ...
- PAT乙级 1029. 旧键盘(20)
1029. 旧键盘(20) 时间限制 200 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 CHEN, Yue 旧键盘上坏了几个键,于是在敲一段文字的 ...
- 手机端js实现滑块推动
代码编写:(写的格式有点差,凑合看吧,但是功能是实现了的) <html><head><meta http-equiv="Content-Type" c ...
- [Ubuntu] Autostart nginx, php-fpm and mysql in Ubuntu14.04
[nginx] Step 1 Download the shell script wget https://raw.github.com/JasonGiedymin/nginx-init-ubuntu ...
- 似是而非的k=sqrt(n)
//题目:输入一个大于3的整数n,判定它是否为素数(prime,又称质数)#include <stdio.h>#include <math.h>int main(){int n ...
- scrapy学习记录
scrapy是一个用来爬取一个或多个网站的数据,提取数据的应用框架.下载过程非常复杂,而且会遇到各种问题.所以写个博客来记录下. 安装好python2.7之后,就可以开始.安装scrapy前还需要安装 ...