1、安装tomcat

2、安装CXF

一、为新渠道webservice加入到项目中
首先,创建一个springboot项目,名为webservice-baffle(附件中)。
第二步,新建web service 服务端
右击webservice-baffle项目,新建“other”,在弹出框中选择“web service”,出现如下弹出框
截图中:
1、web service type:选择 Top down java bean web service
2、web service的http url
3、选择tomcat,如果没有环境,自己下载tomcat并安装配置下
4、选择apache CXF 2.x,如果没有,自己下载和安装下
下一步,出现如下提示框,默认到完成。
最后,生成一个WebServiceProject项目。
第三步:将生产的java类拷贝到webservice-baffle项目中:

第四步:注册webservice接口到servlet中:
该操作的代码在com.xxx.xxx.config.EndpointConfig.java
@Configuration
public class CxfConfig { @Autowired
private Bus bus; //private SpringBus bus;
@Autowired
private CommonService commonService; // 配置CXF服务发布,默认服务是在host:port/services/发布地址
// 访问地址 http://127.0.0.1:8080/Service/common?wsdl
@Bean
public Endpoint another_endpoint() {
EndpointImpl endpoint = new EndpointImpl(bus, commonService);
endpoint.publish("/common"); //发布地址
return endpoint;
}
// 访问地址 http://127.0.0.1:8080/Service/hello?wsdl
@Bean
public Endpoint endpoint() {
EndpointImpl endpoint = new EndpointImpl(bus, new HelloServiceImpl());
endpoint.publish("/hello"); //发布地址
return endpoint;
}
完成。

 

问题:

1、与Spring整合问题
Caused by: org.apache.cxf.ws.policy.PolicyException: These policy alternatives can not be satisfied: 
{http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}SupportingTokens
{http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}UsernameToken
at org.apache.cxf.ws.policy.AssertionInfoMap.checkEffectivePolicy(AssertionInfoMap.java:166)
at org.apache.cxf.ws.policy.PolicyVerificationInInterceptor.handle(PolicyVerificationInInterceptor.java:101)

解决方法
esb-server.xml配置增加
<cxf:bus>
<cxf:properties>
<entry key="org.apache.cxf.message.Message.ENCODING" value="UTF-8"/>
</cxf:properties>
<cxf:features>
<cxf:logging/>
<p:policies enabled="false" />
</cxf:features>
</cxf:bus>

    @Bean(name = Bus.DEFAULT_BUS_ID)
public SpringBus springBus() {
SpringBus springBus = new SpringBus();
WSPolicyFeature wpf = new WSPolicyFeature();
wpf.setEnabled(false);
Collection<Feature> features = springBus.getFeatures();
features.add(wpf);
return springBus;
}

用 Eclipse 开发 WebService 项目的更多相关文章

  1. 使用Eclipse开发Web项目(JSP)——简单登录、无sql

    1.使用Eclipse开发Web项目(JSP) tomcat 2.在Eclipse中创建的Web项目: 浏览器可以直接访问webContent中的文件 例如http://localhost:8080/ ...

  2. Eclipse开发Web项目连接MySQL时找不到驱动的解决办法

    当我们使用Eclipse开发Web项目连接MySQL时后台报找不到驱动的错误,如下:解决办法: 1.这时我们首先要检查我们是否导入了连接MySQL数据库的jar包,如图,是否已经将jar包复制到项目下 ...

  3. Apache axis2 + Eclipse 开发 WebService

    yd小结注意:1.axis2的2个插件的版本必须与引入的jar包匹配,如果不同则可能报以下错误 “没有实现序列化方法”或 “org.apache.axis2.databinding.utils.wri ...

  4. Eclipse开发Python项目

    最近倒腾python自带的开发工具idle,用的很不习惯,还是用Eclipse编写python项目方便(自动补齐,智能报错,调试方便),下面就说说怎么用Eclipse编写python代码吧~ 1.安装 ...

  5. Eclipse开发Android项目报错解决方案详细教程,最新版一篇就够了!

    本文记录刚接触Android开发搭建环境后新建工程各种可能的报错,并亲身经历漫长的解决过程(╥╯^╰╥),寻找各种偏方,避免大家采坑,希望能帮助到大家. 报错信息 出错一:The import and ...

  6. Android开发:《Gradle Recipes for Android》阅读笔记(翻译)2.2——将Eclipse开发的项目导入到AndroidStudio

    问题: 你想要将一个Eclipse ADT项目导入到Android Studio中. 解决方案: Android Studio提供了一个导入向导,可以重写已有的项目. 详细: 在Android Stu ...

  7. Eclipse开发Android项目安装配置

    在windows安装Android的开发环境不简单也说不上算复杂,本文写给第一次想在自己Windows上建立Android开发环境投入Android浪潮的朋友们,为了确保大家能顺利完成开发环境的搭建, ...

  8. JavaWeb核心编程之使用Eclipse开发JavaWEB项目

    文章目录 1.eclipse切换到javaee项目 2.创建服务器(如果没有server选项, 怎么做) 3.定制新建面板内容 4.创建动态web工程 1.eclipse切换到javaee项目 如图 ...

  9. Eclipse开发Maven项目提示:程序包org.junit不存在解决方案

    原因: 个人考虑产生此错误的原因是因为Eclipse中对于测试和开发的鉴定不明?Intellij中没有错误,因为Intellij对项目的管理就是同Maven结构的. 解决方案: 原来的junit的sc ...

随机推荐

  1. C#基础知识之父子类,实例、静态成员变量,构造函数的执行顺序(经典示例)

    父子类.示例.静态成员变量.构造函数的概念的基础理解完全可以利用下面的示例诠释,非常经典,直接上代码: public class ShowInfo { public ShowInfo(string i ...

  2. springboot easyexcel

    pom..xml <dependency> <groupId>com.alibaba</groupId> <artifactId>easyexcel&l ...

  3. Linux php.ini的安全优化配置

    Linux php.ini的安全优化配置   (1) PHP函数禁用找到 disable_functions = 该选项可以设置哪些PHP函数是禁止使用的,PHP中有一些函数的风险性还是相当大的,可以 ...

  4. 一、创建并打包Cordova的App工程

    1.创建ionic4 & Angular项目 ionic start myApp tabs --type=angular 2.添加ios和android平台 ionic cordova pre ...

  5. vue props父组件与子组件传值方法

    /~~父组件 runshow.vue~~/ <template> <div> <conditions :fenxiConditonsList="propCond ...

  6. css语法以及css选择器

    CSS语法 CSS的标准语法主要由两方面构成一是 选择器.二是 声明框. 一.选择器      通过选择器可以选定页面指定的元素,并将声明块中的样式应用在选择器选中的元素中去. 二.声明框       ...

  7. asp.net能否上传文件夹下所有文件

    HTML部分 <%@PageLanguage="C#"AutoEventWireup="true"CodeBehind="index.aspx. ...

  8. Java——面向对象编程

    在面向对象的编程中,不能再有第一步.第二步怎么做的概念.   [对象和类]  

  9. 【bzoj3277&&3474】串

    *题目描述: 字符串是oi界常考的问题.现在给定你n个字符串,询问每个字符串有多少子串(不包括空串)是所有n个字符串中至少k个字符串的子串(注意包括本身). *输入: 第一行两个整数n,k.接下来n行 ...

  10. VS2015中添加QT5.9.0插件

    https://blog.csdn.net/hhhuang1991/article/details/79768595 VS2015里使用QTDIR路径查找QT开发包目录 路径配置操作系统环境变量里添加 ...