JAX-RS -- Java API for RESTful Web Services
1、安装tomcat
2、安装CXF

.jpg)

.jpg)

@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;
}
.jpg)
问题:
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的更多相关文章
- 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 ...
- Jersey the RESTful Web Services in Java
Jersey 是一个JAX-RS的实现, JAX-RS即Java API for RESTful Web Services, 支持按照表述性状态转移(REST)架构风格创建Web服务. REST 中最 ...
- 使用 Spring 3 来创建 RESTful Web Services
来源于:https://www.ibm.com/developerworks/cn/web/wa-spring3webserv/ 在 Java™ 中,您可以使用以下几种方法来创建 RESTful We ...
- cxf开发Restful Web Services
一.restful web services rest全称是Representation State Transfer(表述性状态转移).它是一种软件架构风格,只是提供了一组设计原则和约束条件.在re ...
- RESTful Web Services测试工具推荐
命令行控的最爱:cURL cURL是一个很强大的支持各种协议的文件传输工具,用它来进行RESTful Web Services的测试简直是小菜一碟.这个工具基本上类Unix操作系统(各种Linux.M ...
- 使用 Spring 3 来创建 RESTful Web Services(转)
使用 Spring 3 来创建 RESTful Web Services 在 Java™ 中,您可以使用以下几种方法来创建 RESTful Web Service:使用 JSR 311(311)及其参 ...
- 基于Spring设计并实现RESTful Web Services(转)
基于Spring设计并实现RESTful Web Services 在本教程中,你将会使用Spring来创建一个具有生产力的RESTful网络服务. 为什么用RESTful网络服务? 从和Amazon ...
- Spring 3 来创建 RESTful Web Services
Spring 3 创建 RESTful Web Services 在 Java™ 中,您可以使用以下几种方法来创建 RESTful Web Service:使用 JSR 311(311)及其参考实现 ...
- 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 ...
随机推荐
- msSQL数据库备份还原小结
MSSQL自带了一个样例数据库pubs,就拿这个举例好了. 首先,来一次完全备份.对于数据量很大的数据库,这样的操作当然很费时间.所以我们采用每天凌晨4点一次完全备份,每个小时一个差异备份,每分钟一次 ...
- dataTable 禁止分页
$("#id").DataTable({ "paging": false, // 禁止分页 });
- 使用ECLIPSE+MINGW搭建C/C++开发环境
有个朋友要我帮忙跑一个C程序而我现在主要用java,电脑上也就没有C语言的编译和开发环境,在学习java的这段期间,接触到了Eclipse这个强大的IDE,用惯了.就为调试一个程序,去安装一个VS觉得 ...
- JAVA入门第二季(mooc-笔记)
相关信息 /** * @subject <学习与创业>作业1 * @author 信管1142班 201411671210 赖俊杰 * @className <JAVA入门第二季&g ...
- writeToFile 读写文件问题
关于 writeToFile 读写文件:当字典中键值对以 Model(例如:studentModel)为值时发现 Dictionary 调用 writeToFile 方法无法生成 plist 文件,经 ...
- 解决Deprecated: preg_replace(): The /e modifier is deprecated, use
使用php5.5运行ecshop的时候出现如下错误Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace ...
- Seven Python Tools All Data Scientists Should Know How to Use
Seven Python Tools All Data Scientists Should Know How to Use If you’re an aspiring data scientist, ...
- MySql排序性能对比
- Burp Suite教程(英文版)
In this article, we are going to see another powerful framework that is used widely in pen-testing. ...
- CF 279A. Point on Spiral
http://codeforces.com/problemset/problem/279/A 题意 :就是给你一个螺旋形的图,然后给你一个点,问从(0,0)点到这个点需要转几次弯,当然,是按着这个螺旋 ...