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 ...
随机推荐
- Percona-Server-5.5.15源码安装
[root@localhost rpm]# ll total 19148 -rw-r--r-- 1 root root 562628 Jan 18 2007 bison-2.3-2.1.x86_ ...
- 队列(顺序存储)C++模板实现
队列:一端进行插入,另一端进行删除的线性结构,具有先进先出性.利用数组来实现队列将面临"假溢出"的情况,如下图所示: front:永远指向队首元素,队首在本文中是允许删除元素的一端 ...
- 网站开发常用jQuery插件总结(一)提示插件alertify
1.alertify插件功能 主要实现提示功能,用于代替js中的alert,confirm,prompt,显示友好的提示框 2.alertify官方地址 http://fabien-d.github. ...
- App开发中甲乙方冲突会闹出啥后果?H5 APP 开发可以改变现状吗
随着各种应用的全面App化,因App而起的合作纠纷也日益增多,其中不乏最终对簿公堂的情形.WeX5(html5开发工具)为您汇总了三个典型的真实案例,方便您体会甲乙方冲突情景. 在围观别人争吵之余,您 ...
- 为什么Laravel是最成功的PHP框架?
Laravel 是一个有着美好前景的年轻框架,它的社区充满着活力,相关的文档和教程完整而清晰,并为快速.安全地开发现代应用程序提供了必要的功能.在近几年对PHP 框架流行度的统计中,Laravel始终 ...
- Python和C++交互
关键字:Python 2.7,VS 2010,swig OS:Win8.1 with update. 1.下载swig:http://www.swig.org/download.html 2.将swi ...
- Python的传值和传址与copy和deepcopy
1.传值和传址 传值就是传入一个参数的值,传址就是传入一个参数的地址,也就是内存的地址(相当于指针).他们的区别是如果函数里面对传入的参数重新赋值,函数外的全局变量是否相应改变,用传值传入的参数是不会 ...
- 一步步学习NHibernate(4)——多对一,一对多,懒加载(1)
请注明转载地址:http://www.cnblogs.com/arhat 通过上一章的学习,我们学会如何使用NHibernate对数据的简单查询,删除,更新和插入,那么如果说仅仅是这样的话,那么NHi ...
- mysql的错误:The server quit without updating PID file /usr/local/mysql/data/door.pid).
mysql错误解决: 先 参考:http://www.jb51.net/article/48625.htm 参考第四条: mysql在启动时没有指定配置文件时会使用/etc/my.cnf配置文件,请打 ...
- delphi xe5 android iny绿色版+最新SDK/NDK安装方法
转自: http://bbs.2ccc.com/topic.asp?topicid=438595 首先感谢iny的绿色版,因为我的精简Win7 32位安装原版镜像4.63G过程正常,但是编译出错,后来 ...