java - springmvc整合cxf发布webservice

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

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/413740.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Vue报错:Elements in iteration expect to have ‘v-bind:key‘ directives的解决办法

1.我们在使用v-for的时候&#xff0c;在v-for 后添加 v-bind:key"ite Vue 2.2.0的版本里&#xff0c;当在组件中使用v-for时&#xff0c;key是必须的。 1.我们在使用v-for的时候&#xff0c;在v-for 后添加 v-bind:key"item" <div v-for"todo in to…

vue报错:error Strings must use singlequote quotes 字符串必须使用单引号

例出现下面报错 这个问题说明必须使用单引号&#xff0c;在vue的项目开发中&#xff0c;如果我们在通过vue-cli脚手架构建项目的时候使用了Eslint严格模式&#xff0c;那么对于字符串类型的数据String必须要使用单引号&#xff0c;不能使用双引号&#xff0c;否则会报异常。所以…

工作327:uni-数据格式处理

allPrpos(obj) { // 用来保存所有的属性名称和值let list[]var props "";// 开始遍历for(var p in obj){ // 方法if(typeof(obj[p])"function"){ obj[p]();}else{ // p 为属性名称&#xff0c;obj[p]为对应属性的值if(p.indexOf("apic") ! -1){…

mysql数据库的设计

数据库的设计有一个严谨的流程&#xff0c;根据流程制作一个完整的数据库&#xff0c;可以省去很多的时间&#xff0c;也可以最大程度上与客户的想法契合。 需求分析阶段&#xff1a;分析客户的业务和数据处理需求 概要设计阶段&#xff1a;设计数据库的E-R模型图&#xff0c;确…

NTP服务器时间同步

一、简要说明 二、安装步骤 三、配置文件 四、常用命令 五、注意事项 六、运行截图 七、参考资料一、简要说明 搭建Kubernetes环境&#xff0c;需要几台、几十台机器配合运作&#xff0c;许多集群服务比如Etcd等都依赖系统的时间&#xff0c;如果机器的系统时间不一致…

[bug] uni-app 支付宝小程序 上传文件uni.uploadFile 报错 errMsg: “uploadFile:fail 无效参数“

首先看报错 就挺奇怪的 uni.chooseImage返回的参数都没问题&#xff0c; H5上也能正常运行 看下我的uni.uploadFile函数 uni.uploadFile({url: baseUrl params_.url,name: file,filePath: params_.query.files,formData: param_,success: (res) > {uni.hideLoading() …

【bug】HbuilderX运行到微信小程序 报错

首先&#xff0c;大前提是代码本身在HbuilderX里运行H5是没问题的&#xff0c;不报错 。然后运行到微信小程序报错了。&#xff08;注&#xff1a;以下所说小程序代指微信小程序&#xff09;。 我来这里分享一下我报了什么错&#xff0c;怎么解决的和我浅薄的理解。 报错位置…

php 获取某个月的周一

今天有个朋友问了一个问题&#xff0c;最后解决了下&#xff0c;先整理记下来&#xff0c;后面用到了再说 function getMonday($month ){if(empty($month)){$month date("Y-m");}$maxDay date(t, strtotime($month."-01"));$mondays array();for($i1;…

Mac安装brew及报错处理办法

brew又叫Homebrew&#xff0c;官网安装方式 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" MacOS系统使用Homebrew官方地址时&#xff0c;报错&#xff1a; curl: (35) LibreSSL SSL_connect: SSL_ERROR_SYS…

微信小程序复制到剪切板及换行问题

wxml <textarea type"text" v-model"copyContent" placeholder"请输入内容" style""/> <button type"default" click"copy">复制内容</button> data中声明变量 data(){return{copyContent: …

Object Tracking using OpenCV (C++/Python)(使用OpenCV进行目标跟踪)

本博客翻译搬运自https://www.learnopencv.com/object-tracking-using-opencv-cpp-python&#xff0c;用于初入目标跟踪的新手学习&#xff0c;转贴请注明&#xff01; 使用OpenCV进行目标跟踪&#xff08;C/Python&#xff09; 在本教程里&#xff0c;我们将学习OpenCV3.0中引…

Sublime Text 3 、WebStorm配置实时刷新

本文所用软件版本Sublime Text 3(Build 3143)、WebStorm 2017.2.4(Build #WS-172.4155.35)、Google Chrome v61.0.3163.100&#xff0c;其他版本软件配置过程可能不一样&#xff0c;请知悉&#xff01; 一.Google Chrome安装LiveReload插件 1.下载插件 LiveReload 2.1.0 链…

#0 scrapy爬虫学习中遇到的坑记录

python 基础学习中对于scrapy的使用遇到了一些问题。 首先进行的是对Amazon.cn的检索结果页进行爬取&#xff0c;很顺利&#xff0c;无碍。 下一个目标是对baidu的搜索结果进行爬取 1&#xff0c;反爬虫 1.1 我先对ROBOTSTXT_OBEY进行设置&#xff0c;结果找到了scrapy的默认参…

Sublime Text 3 、WebStorm配置护眼主题(浅绿色)

本文所用软件版本Sublime Text 3(Build 3143)、WebStorm 2017.2.4(Build #WS-172.4155.35)&#xff0c;其他版本软件配置过程可能不一样&#xff0c;请知悉&#xff01; 1.Sublime Text 3护眼主题 &#xff08;1&#xff09;下载配置文件 链接&#xff1a;http://pan.baidu.…

angular - 如何运行在起来 - 使用nginx

nginx下载地址&#xff0c;使用的是标准版的&#xff1a; 点击下载nginx nginx下载完后&#xff0c;解压 dist文件夹下面所有angular文件放入html文件夹中. 最后命令行cd到当前nginx.exe目录&#xff0c;启动命令&#xff1a;nginx 再配置一下conf文件夹下面的nginx.conf 再loc…

深度学习之Batch Normalization

1、Batch Normalization的引入 在机器学习领域有个很重要的假设&#xff1a;IID独立同分布假设&#xff0c;也就是假设训练数据和测试数据是满足相同分布的&#xff0c;这是通过训练数据获得的模型能够在测试集上获得好的效果的一个基本保障。在深度学习网络中&#xff0c;后一…

调用支付宝接口 alipay.data.bill.accountlog.query,提示:ISV权限不足

使用环境&#xff1a;正式环境 接口名称&#xff1a;alipay.data.bill.accountlog.query(支付宝商家账户账务明细查询) 提示&#xff1a;ISV权限不足&#xff0c;建议在开发者中心检查签约是否已经生效 参考&#xff1a; 支付宝商家账户账务明细查询接口文档 自己按照支付宝官…

工作309:uni-获取vuex里面的值

marketId:this.vuex_user.market_id

web自动化测试(java)---测试过程中遇到的错误合集

摸索测试&#xff0c;不管是安装、调测第一个用例都会遇到各种各样的问题&#xff0c;或是自己的问题或是程序本身设置问题 只有把所有问题记录下来&#xff0c;才对得起自己的经历 1、设置firefox的执行文件错误 Exception in thread "main" org.openqa.selenium.We…

CentOS7 3.项目持续交付脚本

#停止原有工程 ps -ef | grep demo | grep -v grep | awk {print $2} | xargs kill#删除原有工程 rm -rf /opt/app/demo.jar#解压压缩包指定文件&#xff0c;并存入指定路径 #tar -zxf 压缩包 -C 解压到的路径 压缩包中指定文件名 tar -zxf /opt/app/demo.tgz -C /opt/app .…