Skip to content
itstamen edited this page Jul 3, 2012 · 14 revisions

Welcome to the rop wiki.Rop is the most simple rest service framework base on Spring 3.0. You can use it to build you EBS like the TOP(Taobao open platform)

    http://localhost?method=user.add&v=1.0&format=xml&...

You will get the xml format just like:

    <?xml version="1.0" encoding="utf-8" standalone="yes"?>  
    <sampleRopResponse1 createTime="20120101010101" userId="1"/>

And get json format like:

    {"sampleRopResponse1":{"userId":"1","createTime":"20120101010101"}}  

The only thing you need to do just write the request class with JSR303 annotation and write response class with JSR222(JAXB) annotatoin,rop will validate the request data and generate the "standard" error response and marshall the response use JAXB annotation. You just use the @ServiceMethod to make the bean's method to be a service handler:

    @ServiceMethodBean
public class UserRestService { 

	@ServiceMethod(value="user.add",version="1.0" )//define a rest service method
	public RopResponse addUser(CreateUserRequest request) {  
		CreateUserResponse response = new CreateUserResponse();  
		//add creaet new user here...  
		response.setCreateTime("20120101010101");  
		response.setUserId("1");  
		return response;  
	}  
}

Use rop to build you rest web service is mostly simple,you can focus on you business logic,and let the rop do the remain. Please try it ,make you live easy!

Summary rop not only provided the service method mapping,request data binding and response marshaller ,but also the "Application Layer" issue ,just like version management,service security,session management,error handle model and so on.

Clone this wiki locally