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的经验 ...
随机推荐
- 对ImageView.ScaleType的详解
设置的方式有两种: 1.在layout.xml里面定义android:scaleType = "center" 2.在代码中调用imageview.setScaleType(Ima ...
- AngularJS 全局scope与Isolate scope通信
在项目开发时,全局scope 和 directive本地scope使用范围不够清晰,全局scope与directive本地scope通信掌握的不够透彻,这里对全局scope 和 directive本地 ...
- MVC模型 简介
MVC (Modal View Controler)本来是存在于Desktop程序中的,M是指数据模型,V是指用户界面,C则是控制器.使用MVC的目的是将M和V的实现代码分离,从而使同一个程序可以使用 ...
- Open quote is expected for attribute "property" associated with an element type "result".错误
java Mybatis 框架下的项目 报 Open quote is expected for attribute "property" associated with a ...
- sdf
SDF(Standard Delay Format)是一种存储timing data的文件,其中的数据是tool-independent的 可以包括: 1)Delay: module path, de ...
- C动态内存分配
全局变量:静态存储区 非静态局部变量(包括形参):动态存储区------>栈(stack) 建立内存动态分配区域,存放临时数据---------->堆(heap)由于未在声明部分定义他们为 ...
- 关于centos更新后virtualbox无法使用的问题
http://blog.csdn.net/zgglj/article/details/50325675
- 七、Java基础---------JDK安装与配置
配置环境变量名词说明 path:通过path系统去寻找可执行的java文件. JAVA_HOME:JDK的安装目录 classpath:加载目录 为什么需要配置path,什么时候需要classpath ...
- BPM 应用系统开发案例实战
概述 IBM BPM 的前身是 Lombardi,是由 IBM 于 2009 年收购的产品,之后产品更名为 IBM WebSphere Lombardi Edition,目前最新版本称为 IBM BP ...
- imread函数、namedWindow函数、imshow函数、imwrite函数
1.imread函数 首先,我们看imread函数,可以在OpenCV官方文档中查到其原型如下: Mat imread(const string& filename, int flags=1 ...