Wednesday, June 3, 2009

JavaOne 2009: Coding REST and SOAP together

Martin Grebac and Jakub Podlesak from Sun Microsystems on Coding REST and SOAP together

  • Using METRO = JAXB + JAX-WS + WSIT and Jersey

  • No deployment descriptors needed (use annotations) but still available if required; part of Java EE 5 and 6

  • Why REST? Simplicity, Takes advantage of the existing caches and proxies, Serendipity, Scalability (HTTP load balancers)

  • Common JAX-WS/RS concepts should be supported

  • Heavy using of annotations: @Path, @WebService, @GET, @Produces, @WebMethod, @XmlRootElement, @XmlAttribute etc.

  • Take care: do not fall into RPC over HTTP (REST-RPC hybrid), use compatible security (Securing SOA does not automatically secure the REST), annotation hell

  • Think about the consumers of your services and ask yourself if you really need SOAP and REST; consider using REST only in some parts of your application

  • Use @WebMethod annotations to enable control over exposed SOAP methods

No comments: