简体   繁体   中英

How to build a REST web service with top-down approach?

I'm new in REST web services. I've always used SOAP to build a web service since WSDL and auto generate web service logic in Java code, but REST has a uniform contract so, we don't need to create a contract definition, SOA says top-down approach is the best way to create a decoupled web service but I have no idea how to create a REST service in top-down or bottom-up approach either.I would like something of your experience and how to create a REST web service with Java. It doesn't matter IDE or API.

Until very recently this was not possible. You could not do top down with REST due to the lack of a REST WSDL. This is why a lot of enterprises never moved to REST, for example in banking transactions you want the interface to be well defined and strict. You can create this strict definition in SOAP but previously it was hard in rest.

REST is busy becoming more SOAP like some aspect with the need for well defined interfaces now being addressed by various competing standards. Or in plain english there is a lot of projects which are competing to become the WSDL of the REST world they are but no limited to:

  1. RAML.
  2. Swagger.
  3. WADL.

I have used some top down code generation in RAML and it was relatively good but very bleeding edge then.

The question would be if you need such well defined interfaces why do you want to go REST? The whole XML vs JSON argument is not a valid reason. Bloated JSON can be bigger than optimal XML.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM