1.jar包已上传百度云盘,在jar包目录下

2.web.xml配置

<web-app

  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

  xmlns="http://java.sun.com/xml/ns/javaee"

  xsi:schemaLocation="

    http://java.sun.com/xml/ns/javaee

    http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">

  <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>
  <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>WEB-INF/application/applicationContext-*.xml</param-value>
  </context-param>
  <servlet>
    <servlet-name>springmvc</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>springmvc</servlet-name>
    <url-pattern>*.do</url-pattern>
  </servlet-mapping>
  <servlet>
    <servlet-name>CXFServlet</servlet-name>
    <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
    <load-on-startup>2</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>CXFServlet</servlet-name>
    <url-pattern>/*</url-pattern>
  </servlet-mapping>
</web-app>

2.WEB-INF新建springmvc-servlet.xml  (由于web.xml没有配置该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:mvc="http://www.springframework.org/schema/mvc"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:tx="http://www.springframework.org/schema/tx"
  xsi:schemaLocation="
    http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context-4.1.xsd
    http://www.springframework.org/schema/mvc
    http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd
    http://www.springframework.org/schema/tx
    http://www.springframework.org/schema/tx/spring-tx-4.1.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/beans/spring-beans-4.1.xsd ">

  <!-- 启动注解驱动-->
  <mvc:annotation-driven/>
  <!-- 启动包扫描功能,你的代码-->
  <context:component-scan base-package="com.cxf.*" />
</beans>

3.src目录,包名一定要com.cxf.*,因为springmvc-servlet.xml配置自动扫描的这个。

com.cxf.service.imp就是你要发布的webservice。

先说一下com.cxf.service实现类代码注意点:

上面注解不要漏就行了;

com.cxf.service.imp代码注意点:

第一个红线是接口路径。

第二个红线随便取名,但是不能不取名。发布后,在wsdl上会看看这个。

4.WEB-INF下新建目录和文件   application/applicationContext-cxf.xml,文件名和路径就是这个,不准改。因为web.xml这样配置的。哈哈哈。(其实applicationContext-cxf.xml的名字可以小改,自己理解吧)

内容:

<beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"
  xsi:schemaLocation="http://www.springframework.org/schema/beans
  http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
  http://cxf.apache.org/jaxws
  http://cxf.apache.org/schemas/jaxws.xsd">

  <!-- cxf3.0及以上版本不需要再手工引入
  <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" /> -->

  <!-- webservice服务l,implementor对应的是实现类,address,是访问的名字-->
  <jaxws:endpoint id="HelloWorld" implementor="com.cxf.service.imp.SB_SOA_SOA_ImportOrgBpelInfoSrv" address="/org" />

  <!--启动后,访问:http://localhost:8080/ws/org?wsdl 会出现xml那就ok了。ws是我项目名字-->
  <!--<jaxws:endpoint id="HelloWorld2" implementor="com.cxf.service.imp.SB_SOA_SOA_ImportEmpBpelInfoSrv" address="/emp" />-->

  <!--启动后,访问:http://localhost:8080/ws/emp?wsdl 会出现xml那就ok了。ws是我项目名字-->
</beans>

转载于:https://www.cnblogs.com/sss-justdDoIt/p/9300210.html

java - springmvc整合cxf发布webservice相关推荐

  1. IDEA快速 实现 SpringMVC 整合xfire 发布 WebService 服务

    文章目录 一.idea快速搭建web项目 二.xfire 服务方搭建 1. pom依赖 2. web.xml 3. 创建一个entity 4. 创建一个接口 5. 创建接口实现类 6. 在WEB-IN ...

  2. spring boot整合cxf发布和调用webservice

    一.前言 说起web service最近几年restful大行其道,大有取代传统soap web service的趋势,但是一些特有或相对老旧的系统依然使用了传统的soap web service,例 ...

  3. Spring集成CXF发布WebService并在客户端调用

    Spring集成CXF发布WebService 1.导入jar包 因为官方下载的包里面有其他版本的sprring包,全导入会产生版本冲突,所以去掉spring的部分,然后在项目根目录下新建了一个CXF ...

  4. 使用cxf发布webservice接口,以及调用webservice接口

    一.cxf发布webservice接口 添加maven依赖 <dependency><groupId>org.apache.cxf</groupId><art ...

  5. 使用CXF发布WebService服务简单实例

    一.说明: 前面介绍了使用axis2来发布Webservice服务,现在介绍一种更popular,更高效的Webservice服务发布技术:CXF Apache CXF = Celtix + XFir ...

  6. SpringBoot+CXF发布Webservice时报错:counts of IllegalAnnotationExceptions

    由于项目需要,与生成环境的其他系统对接,对方采用的是Webservice的接口方式,为了验证我们自己开发的对接是否正常,因此,自己写了对应的接口来验证,结果发布Webservice的时候报错: Cau ...

  7. Java笔记-使用CXF开发WebService服务器

    这里使用CXF开发WebService,要引入下面这个Maven <dependency><groupId>org.apache.cxf</groupId>< ...

  8. cxf发布 webservice服务

    导包 antlr-2.7.7.jar aopalliance-1.0.jar asm-3.3.jar commons-collections-3.2.1.jar commons-lang-2.6.ja ...

  9. CXF发布webservice

    2019独角兽企业重金招聘Python工程师标准>>> CXF 是两个框架集合,基于XFire. 下载地址http://cxf.apache.org/download.html 我使 ...

最新文章

  1. 运行cmd直接进入指定目录下的命令
  2. 用php表示0123,php易错笔记-类型
  3. 创业感悟:技术兄弟为什么一直没有起来(1)
  4. Java中怎么把文本追加到已经存在的文件
  5. xp系统一直跳出宽带连接服务器,XP系统网络问题解决方案
  6. linux命令——crontab的使用方法
  7. Crontab作业时间设置
  8. Java基础学习总结(134)——JDK 11 是否值得更新的思考
  9. 9.template -- basic concepts
  10. AS中几个较好的插件
  11. Jquery一款非好的图片轮换效果
  12. 动软代码生成器使用心得
  13. 5G无线技术基础自学系列 | 5G RAN网络架构关键技术
  14. 基本矩阵运算法则之笔记
  15. JAVA记忆翻牌游戏制作
  16. 分门别类刷leetcode——递归和回溯搜索(C++实现)
  17. 博客图床最佳解决方案
  18. 如何拆分PDF成多个文件?这样拆分非常简单
  19. 浙江万里学院计算机期末考,期末复习看这一篇推送就够了
  20. Gorilla源码分析之gorilla/context源码分析

热门文章

  1. 【机器视觉学习笔记】直方图的绘制及直方图均衡化(C++)
  2. Exynos4412裸机开发 —— RTC 实时时钟单元
  3. Linux 系统应用编程——网络编程(TCP 协议三次握手过程)
  4. mac下使用sshpass实现ssh记住密码
  5. 提示缺少Qedit.h问题
  6. 怎么把OCX打包成cab文件
  7. 关于头文件中的 static inline函数
  8. [react] 在React中如果去除生产环境上的sourcemap?
  9. [css] 说说你对CSS样式覆盖规则的理解
  10. [css] css的加载会阻塞js运行吗?为什么?