5

I am in the process of writing a JSON based web service. The service will accept two types of requests: commands (e.g. createOrder) and queries (e.g. getOrders). Each request needs to send user credentials (username/password) for authentication (perhaps in HTTP headers). The service needs to be implemented in Java.

Which frameworks would you recommend for this use case? The very basic stack that I am thinking of is servlets backed by a JSON framework like Jackson. Are they any other frameworks that you would recommend and why? There is no need or desire to make the service RESTful, however smooth integration with Java EE 6 or Spring would be a plus.

Thanks in advance for your time.

Naresh
  • 23,937
  • 33
  • 132
  • 204

5 Answers5

2

Can I then interest you in RESTful Web Services (which is a JAX-RS API)? A library that implements JAX-RS is Jersey, Apache CXF, which is suited to allow JSON Web Service.

A related StackOverflow Post which shows REST clients that conforms to JAX-RS.

Community
  • 1
  • 1
Buhake Sindi
  • 87,898
  • 29
  • 167
  • 228
1

You should take a look at spring mvc and read this blog post which cover using spring mvc for restful WS.

  • 1
    Why Spring MVC? Isn't that a presentation framework? I don't need to send HTML responses, only pure data in JSON format. Also I do not need a RESTful protocol - only simple commands and queries. – Naresh Sep 19 '11 at 05:25
  • I understand your question, but a lot of people are using spring mvc for that. –  Sep 19 '11 at 05:30
  • 2
    @Naresh, A web service MVC is also a presentation framework (in which the presentation can be XML, JSON, raw data in byte arrays, etc.) Besides, RESTful Web Services uses HTTP responses (some implemented as an MVC pattern) – Buhake Sindi Sep 19 '11 at 05:31
  • I have to agree with Naresh. Single Page Applications have the tremendous benefit of eliminating a tier from N-tier applications. The SPA can communicate directly with the back end. In robust MVC architectures, the MVC tier frequently used a service call to the back end. The MVC tier is essentially deprecated. – Steve11235 Apr 07 '14 at 16:19
1

Play! Framework would definitely fit your bill. It is not servlet-based but fulfills all of your requirements. Plus development with Play is very fast, you can get a prototype up and running in no time.

Tommi
  • 8,550
  • 5
  • 32
  • 51
1

I personally use Apache CXF, with JAX-RS and jackson libraries. They are easy to implement and integration is dead easy. JAX-RS is a java standard, Jackson library is fast and handles circular references and Apache CXF needs only a couple of lines of configuration to setup and start running. Go for it!

Varun Achar
  • 14,781
  • 7
  • 57
  • 74
0

An Open-Source Services Framework From Apache

-CXF has been designed to provide a pluggable architecture that supports not only XML but also non-XML type bindings, such as JSON and CORBA, in combination with any type of transport.

-Java EE integration: deploy services in Java EE application servers such as Apache Geronimo, JOnAS, Redhat JBoss, OC4J, Oracle WebLogic, and IBM WebSphere -Standalone Java client/server

gokhansari
  • 2,379
  • 1
  • 27
  • 33