Sun gives Java a REST
October 13, 2008 —
(Page 1 of 2)
Related Search Term(s): Java, REST, Sun
The JCP is hoping to give SOAP a REST. Today, Sun Microsystems will release JAR files for the JAX-RS, the new Java API for RESTful Web services. REST (Representational State Transfer) substitutes the traditional SOAP practices in favor of a natively Web-based solution by encoding information directly into URLs and allowing the HTTP protocol to do much of the heavy lifting.
Dr. Marc J. Hadley, a senior staff engineer in the office of the CTO at Sun, was co-spec lead on JSR 311. He's been working with Web services since their inception and was also co-lead on the JAX-WS specification, JSR 224. After years of experience with SOAP, Hadley said he now prefers REST.
"I think it's simpler,” said Hadley. “There's so much in HTTP that is still to be fully exploited. Without going to SOAP, there's so much you can already do that people don't realize. I can see there are cases where you can step up to SOAP. But JAX-RS is of the Web, whereas JAX-WS sort of inherits that SOAP thing where the Web is just a transport. JAX-WS is over the Web, rather of the Web.”
Hadley learned a great deal about the capabilities of HTTP during his time on JAX-RS. “One of the biggest thing is the whole precondition processing,” said Hadley, citing what he learned about HTTP. “It solves lots of problems, like lost updates. There's a lot of depth there that you don't realize when you first start working with HTTP. There's also a whole bunch there for a bunch of standard patterns for the Web, like creating a resource. You don't have to make a new method to do that, it's already baked into the protocol."
JAX-RS is built specifically to make the design process for RESTful Web services simple. And because of REST's new and simplistic design, Hadley said that this was an easier API to write than previous Java Web services APIs.
“We didn't really have a lot of baggage to bring along," said Hadley. "In JAX-WS, we had the JAX-RPC legacy, and for a long time JAX-WS was going to be JAX-RPC 2. That complicated things a lot. In JAX-RS, we didn't really need to do much about content mapping. We didn't have to bake in the things in SOAP where you serialize the messages. A final thing is that there's no real description side to JAX-RS, although we've implemented something. We didn't have to do all the mapping from WSDL."