Creating Java Web Service using Google AppEngine

Jeremy Edwards picture Jeremy Edwards · Feb 7, 2010 · Viewed 18.1k times · Source

I'm trying to create a simple web service application where I can retrieve a collection of strings and store them into a data store on the AppEngine server.

I have knowledge in Java and barely any knowledge of Java Servlets and its WAR standards.

I would like to at least have some direction on how to create a web service using the Java technology AppEngine provides. I've searched but the articles are sparse and too lengthy while not providing any simple solutions.

I'd love it if I can create a web service using Java's annotations just like you can do in .NET with attributes.

I'd appreciate links to articles and guidance a full source answer is not required but would be appreciated.

No python based answers please.

Answer

rochb picture rochb · Feb 7, 2010

IMO, there is no simple solution to build a Web Service on GAE with Java.

But, it's still achievable. Let's start with the Web Services we want to build.

In common usage the term refers to clients and servers that communicate over the Hypertext Transfer Protocol (HTTP) protocol used on the web. Such services tend to fall into one of two camps: Big Web Services and RESTful Web Services.

"Big Web Services" use SOAP/RPC format and RESTful Web Services use REST style one. You can read more about SOAP vs REST.

There are lots of Java open source Web Services frameworks out there. Most of them are generally based on the Java API for XML Web Services (JAX-WS), part of the Java EE platform. JAX-WS is not supported by Google App Engine as specified in the list Will it play in App Engine. So forget about the "cool Java's annotations".

But, Restlet seems compatible with GAE. So if you think REST could be an option for you, I would go ahead and take a look at the Hello World tutorial of Restlet. Then, I'd go ahead and read the article on how to integrate Restlet with GAE.