Restful Web Service部署到weblogic 12c
介绍一下环境:
首先需要下载一个jaxrs-ri-2.22.2.zip的包
采用Jdeveloper 12c版本,jdk1.8
WebLogic Server 12.2.1版本
Restful项目建立
在Jdeveloper 12c中建立一个项目,先建立一个application.

建立一个项目.

在项目中建立一个person的类,在建立一个personService类.

代码如下:
Person.java
|
package restfulproject; import java.util.Date; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement private Long id; public Person() { public void setId(Long id) { public Long getId() { public void setFirstname(String firstname) { public String getFirstname() { public void setLastname(String lastname) { public String getLastname() { public void setHiredate(Date hiredate) { public Date getHiredate() { public void setAddressId(Long addressId) { public Long getAddressId() { |
PersonService
|
import java.util.ArrayList;
import java.util.Date;import java.util.List; public class PersonService {
private List<Person> persons; public PersonService() { public List<Person> getPersons(){
return this.persons; } public void addPerson(Person person) {
System.out.println("add person " + person); if(person != null){ |
生成restful Service.


选择consume和product支持的格式

修改代码最后变成:
|
package restfulproject; import java.util.ArrayList; import javax.ws.rs.Consumes; @Path("restfulproject") private List<Person> persons; public PersonService() { @GET @POST @Consumes(MediaType.APPLICATION_JSON) public void addPerson(Person person) { if(person != null){ this.persons.add(person); } } @GET |
同时web.xml也加入了内容
|
<?xml version = '1.0' encoding = 'GBK'?> |
部署
生成部署profile.

选择生成War包

然后部署.

测试
在WebLogic管理控制台上找到部署的url

然后找到WADL地址

通过SOAPUI生成WADL项目,然后运行测试Perons,获取所有的person信息

如果需要得到xml,需要在head中加入Accept=application/xml

getperson/{userid}的测试界面

添加用户

Restful Web Service部署到weblogic 12c的更多相关文章
- Building a RESTful Web Service Using Spring Boot In Eclipse
一.构建restful web service 创建Maven的java web工程,maven的pom文件加入依赖包 创建包hello Greeting.java package hello; pu ...
- Apache CXF实现Web Service(4)——Tomcat容器和Spring实现JAX-RS(RESTful) web service
准备 我们仍然使用 Apache CXF实现Web Service(2)——不借助重量级Web容器和Spring实现一个纯的JAX-RS(RESTful) web service 中的代码作为基础,并 ...
- 【转】Spring 4.x实现Restful web service
http://my.oschina.net/yuyidi/blog/352909 首先我们还是跟之前一样,创建一个maven项目,不过因为Spring Restful web service是基于Sp ...
- 构建一个基于 Spring 的 RESTful Web Service
本文详细介绍了基于Spring创建一个“hello world” RESTful web service工程的步骤. 目标 构建一个service,接收如下HTTP GET请求: http://loc ...
- 在GlassFish应用服务器上创建并运行你的第一个Restful Web Service【翻译】
前言 本人一直开发Android应用,目前Android就业形势恶劣,甚至会一路下滑,因此决定学习服务器开发.采用的语言是java,IDE是Intellij,在下载Intellij的同时看到官网很多优 ...
- Java Restful Web Service 学习指南
Restful是一种架构style,目前常说的有restful web service, resultful http.现在热搜榜的微服务,大多数会采用Restful方式. JAX-RS 作为一个Re ...
- 译:3.消费一个RESTful Web Service
这节课我们根据官网教程学习如何去消费(调用)一个 RESTful Web Service . 原文链接 https://spring.io/guides/gs/consuming-rest/ 本指南将 ...
- 如何使用 JMeter 调用你的 Restful Web Service?进行简单的压力测试和自动化测试
表述性状态传输(REST)作为对基于 SOAP 和 Web 服务描述语言(WSDL)的 Web 服务的简单替代,在 Web 开发上得到了广泛的接受.能够充分证明这点的是主流 Web 2.0 服务提供商 ...
- RESTful Web Service实战 小结1
1 REST的基本实现形式HTTP+URI+XML,但不是唯一形式.XML后来被Json格式替代.REST是一中架构风格(Representational State Transfer,表述性状态转移 ...
随机推荐
- 阶段性总结⓵触摸事件&手势识别⓶Quartz2D绘图⓷CALayer图层⓸CAAnimation⓹UIDynamic UI动力学⓺KVC&KVO
知识点复习 1. 触摸事件&手势识别 1> 4个触摸事件,针对视图的 2> 6个手势识别(除了用代码添加,也可以用Storyboard添加) 附加在某一个特定视图上的, ...
- 【洛谷 P1364】医院设置(树的重心)
树的重心的定义: 树若以某点为根,使得该树最大子树的结点数最小,那么这个点则为该树的重心,一棵树可能有多个重心. 树的重心的性质: 1.树上所有的点到树的重心的距离之和是最短的,如果有多个重心,那么总 ...
- js获取上个月日期
javascript根据当前日期获取上个月日期 function lastMonthDate(){ var Nowdate = new Date(); var vYear = Nowdate.getF ...
- LeetCode 4 :Majority Element
problem:Given an array of size n, find the majority element. The majority element is the element tha ...
- Oracle 11g 安装环境配置脚本
#!/bin/bash #Test in RHEL 5.5 for 11g c=`cat /etc/shadow | grep oracle | wc -l`if [ $c != 0 ]then w ...
- python gui tkinter用法杂记
1.treeview遍历 iids = tree.selection() t = tree.get_children() for i in t: print(tree.item(i,'values') ...
- Selenium2+python自动化33-文件上传(send_keys)【转载】
前言 文件上传是web页面上很常见的一个功能,自动化成功中操作起来却不是那么简单. 一般分两个场景:一种是input标签,这种可以用selenium提供的send_keys()方法轻松解决: 另外一种 ...
- 使用bottle进行web开发(4):HTTPError
from bottle import error @error(404) def error404(error): return 'Nothing here, sorry' 上述代码,是对404的定义 ...
- AC日记——平衡树练习 codevs 4244
4244 平衡树练习 思路: 有节操的人不用set也不用map: 代码: #include <cstdio> #include <cstring> #include <i ...
- easyui中导航菜单accordion与tree的动态添加
博客分类: Java Web开发 Js代码 $.parser.parse(); $.ajax({ url:my.bp()+'/main/menuaction!createMenu.action ...