Justin Kredible
Justin Kredible

Reputation: 8414

How do I easily expose CRUD operations, via a Java based Web Service, on an existing data model?

I have an existing domain model annotated with JPA annotations that I would like to easily expose CRUD operations on via Web Services. I already have DAOs to perform CRUD operations on all of my entities in my domain.

Does anyone know of an way to do this that does not involve a tremendous amount of effort?

Upvotes: 0

Views: 1431

Answers (3)

les2
les2

Reputation: 14479

Throw some annotations on that DAO, like @WebService and @WebMethod and use your JAX-WS implementation of choice. You can use JAX-WS Commons Spring for Spring integration.

Upvotes: 0

anubhava
anubhava

Reputation: 785761

You can use Apache CXF in combination with Spring ROO to achieve this.

Please see this post for more details: http://forum.springsource.org/showpost.php?p=284028&postcount=4

Upvotes: 0

duffymo
duffymo

Reputation: 308986

It depends on how my operations and services and what you call "a tremendous amount of effort." You're likely to be disappointed if doing anything more than pushing a button and having your wishes come true is too much.

But there are three parts to your problem:

  1. Writing DAOs that expose the CRUD operations. I'd recommend an interface-based approach.
  2. Exposing these as "contract-first" web services, either SOAP or REST.
  3. Mapping HTTP requests and responses to your API.

I'd recommend Spring, because it'll help with DAOs, web services, and mapping. But I don't know if it'll be as effortless as you want it to be.

Upvotes: 1

Related Questions