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;
}

JAX-RS -- Java API for RESTful Web Services的更多相关文章

  1. jboss7 Java API for RESTful Web Services (JAX-RS) 官方文档

    原文:https://docs.jboss.org/author/display/AS7/Java+API+for+RESTful+Web+Services+(JAX-RS) Content Tuto ...

  2. Jersey the RESTful Web Services in Java

    Jersey 是一个JAX-RS的实现, JAX-RS即Java API for RESTful Web Services, 支持按照表述性状态转移(REST)架构风格创建Web服务. REST 中最 ...

  3. 使用 Spring 3 来创建 RESTful Web Services

    来源于:https://www.ibm.com/developerworks/cn/web/wa-spring3webserv/ 在 Java™ 中,您可以使用以下几种方法来创建 RESTful We ...

  4. cxf开发Restful Web Services

    一.restful web services rest全称是Representation State Transfer(表述性状态转移).它是一种软件架构风格,只是提供了一组设计原则和约束条件.在re ...

  5. RESTful Web Services测试工具推荐

    命令行控的最爱:cURL cURL是一个很强大的支持各种协议的文件传输工具,用它来进行RESTful Web Services的测试简直是小菜一碟.这个工具基本上类Unix操作系统(各种Linux.M ...

  6. 使用 Spring 3 来创建 RESTful Web Services(转)

    使用 Spring 3 来创建 RESTful Web Services 在 Java™ 中,您可以使用以下几种方法来创建 RESTful Web Service:使用 JSR 311(311)及其参 ...

  7. 基于Spring设计并实现RESTful Web Services(转)

    基于Spring设计并实现RESTful Web Services 在本教程中,你将会使用Spring来创建一个具有生产力的RESTful网络服务. 为什么用RESTful网络服务? 从和Amazon ...

  8. Spring 3 来创建 RESTful Web Services

    Spring 3 创建 RESTful Web Services 在 Java™ 中,您可以使用以下几种方法来创建 RESTful Web Service:使用 JSR 311(311)及其参考实现 ...

  9. RESTful Web Services: A Tutorial--reference

    As REST has become the default for most Web and mobile apps, it's imperative to have the basics at y ...

随机推荐

  1. 现代php开发

    最近在看 Modern PHP 很薄的一本书,有种发现新大陆的感觉,强烈推荐.php是一门脚本语言,随着web的发展而发展起来,最早的时候大家还是混编html,php,完全没有工程项目的概念,(我们公 ...

  2. 可以自动安装mysql数据库的一个shell脚本

    发布:thatboy   来源:脚本学堂     [大 中 小] 分享一例shell脚本,可以实现mysql数据库的自动安装,脚本写的不错,无论是用来学习,还是生产环境中应用,都是不错的,有需要的朋友 ...

  3. 4、Hbase

    1).逻辑模型 Hbase 以表的形式存储数据,每个表由行和列组成,每个列属于一个特定的列族. 表中由行和列确定的存储单元称为一个元素,每个元素保存了同一份数据的多个版本,由时间戳来标识.行健是数据行 ...

  4. sbrk and coreleft

    一.sbrk 函数来源:TC2.0.Linux 函数名: sbrk 功 能: 增加程序可用数据段空间,增加大小由参数 incr决定 . 返回值:函数调用成功返回一指针,指向新的内存空间.函数调用失败则 ...

  5. 关于《一步步学习ASP.NET MVC3》系列发布时间的说明

    在写这个系列的时候,老魏也是下了很大的决心,因为平时基本上没有时间写文章,这回我要挑战我自己的意志力,决定要把这个系列写完整. 再次呢,老魏不能向大家保证什么时间结束,但基本上要保持一天一篇的进度,如 ...

  6. 微信web开发者工具调试

    微信web开发者工具调试 前几天写了一篇使用fiddler调试微信端页面的,然后博友评论说使用fiddler太麻烦了,推荐使用微信web开发者工具调试微信页面,这两天弄着玩了一下,很强大.这篇文章只是 ...

  7. npm常用命令解析

    npm是什么 NPM的全称是Node Package Manager,是随同NodeJS一起安装的包管理和分发工具,它很方便让JavaScript开发者下载.安装.上传以及管理已经安装的包. npm ...

  8. 图片生成操作属性导致WP内存溢出解决办法

    在开发的项目中,发现经常会出现异常 “内存溢出,不能再继续执行程序”,通过搜索一些国外的文章,发现原来是由于项目中的图片比较多,而生存操作设为了“内容”.通过设置图片的生成操作为“无”,复制操作为“如 ...

  9. nodejs 第一次使用

    在win7下安装与使用 1 nodejs官网下载,安装  https://nodejs.org/ 2 下载最新的 npm,在E:\nodejs\中解压  http://nodejs.org/dist/ ...

  10. Python 学习日志(一)

    第一天: (一)安装Python3.3: (二)试运行: 1.在IDLE中输入:print("Hello,world"); //回车查看结果 2.使用"File" ...