I'm interested in building a Google Web Toolkit (GWT) application that will run on the Google App Engine (GAE). I'd also like to expose a web service that shares the same datastore and can receive posted data from a different web application hosted elsewhere.
Would using Restlet be a good solution, or is there a simpler approach that doesn't require the use of a 3rd party library? Is there some way for the GWT client to accepted json that can then be serialised over GWT-RPC to the GAE datastore? Do I need to write a servlet that can parse and persist jsonp?
I suspect my thinking may be a bit muddled here... any assistance is appreciated!
As per http://groups.google.com/group/google-appengine-java/web/will-it-play-in-app-engine
Restlet
Version(s): 2.0 M5 +
Status: COMPATIBLE
The team has created an adaptation of Restlet just for App Engine.
See http://wiki.restlet.org/developers/172-restlet/251-restlet.html for instructions on tuning a standard installation of Restlet for App Engine.
Here's another blog post from the team about Restlet: http://blog.noelios.com/2009/04/11/restlet-in-the-cloud-with-google-app-engine/
GWT has native support for JSON, You just need a library on the server to parse/create JSON. (GWT JSON Sample)
GAE uses Servlets, so any Servlet would do if you wanted to go that route. There is nothing to say that your client needs to be GWT.
You can use the persistence JDO, JPA or Raw APIs for persistence, They are a little tricky and not that clearly documented (it is complex).
See these articles for a clear explanation and sample code:
http://www.ibm.com/developerworks/java/library/j-gaej1/
http://www.ibm.com/developerworks/java/library/j-gaej2/index.html
http://www.ibm.com/developerworks/java/library/j-gaej3.html
Related
I used GAE on and off during the last few years, mostly in Java, but looks like recent migration of GAE into "Google Cloud" left a lot of documentation, examples and tools in disarray.
I need to get brand new Backend server started for Cordova/PhoneGap based Mobile App. It naturally needs Authentication, both internal and with Google+, Facebook, etc and needs DB access naturally.
What is the Best example you recommend for backend code in open-source (GitHub or Google's own?) where Best Practices and Architecture/Design Patterns were followed.
Preferably backend should show/make use of:
Login/Authentication Session management on GAE
All RESTFul APIs with JSON
JDO or Hibernate DB interactions, with auto-schema management (on Google Cloud SQL presumably) -
Bonus points for OAuth 2.0 and Push messaging inclusion, but I know I am asking too much...
Thanks a lot!
I want to create to applications one written for Google App Engine (strictly Java) and the other an Android app. I want the android app to connect to the GAE server. Via what API will I get support for JAX-WS?
Google App Engine from what I've seen promotes the usage of RESTful architectural style and thus is a JAX-RS reference implementation which is pretty straightforward (annotations on WebService methods, parameters etc.)
Plus, some of the packages you need in order to marshal-unmarshal request and responses are not included
If you so insist on using JAX-WS I would suggest you take a look at this blog entry.
I would strongly advice you not to delve into a web service implementation with this approach, google app engine has already the endpoints API in order to deal with developers wanting just a backend to their apps.
I've 2 questions about Java Rest APIs
1'st:
I would like to create a Rest API with Java Servlets for using in the mobile applications(IOS and Android)
and before doing that I would like to clarify the rest api content. However as much as I search through google all I found was automatic API creators from your Java code. But what I want is different first I want to document our Json Rest API so mobile and server developers can start to work independently.
Do you know any tool for that?
2'nd:
What I want to achive in our java server application is simple. Get simple json requests from mobile clients and do some database query and respond back with simple json objects.
For achiving this do I need to use any additional Rest API framework such as spring mvc (or something else) or just using Java Servlets and parse the request in doPost method and respond it there
Which one do you suggest?
Thanks
Restlet Studio (http://restlet.com/technical-resources/restlet-studio) or APISpark (http://restlet.com/products/apispark/) can bring you what you expect.
Restlet Studio allows you to define / design you API with a Web IDE: resources and their methods, representations (exchanged data structures). You can then have access to corresponding Swagger content and generate online client SDKs and even server skeletons for your API (this is internally based on Swagger Codegen)...
To implement your RESTful applications, Restlet can help you. It's a Java REST framework to access and / or implement RESTful applications. Restlet can be used within a servlet container with its servlet extension (see this link https://github.com/restlet/restlet-tutorial/blob/master/modules/org.restlet.tutorial.markdown/02_Server_Side/04_Server_Deployment/02_Servlet_Deployment.md).
Hope it helps you.
Thierry
I aggree with Stephan comment.
With Spring Boot and Spring Data Rest, the only code you will need to write is the mapping between your DB and your DAO Entities.
To document your API before writing it, you can use in fact any regular tools.
REST APIs don't have anything specific compared to others APIs to be documented.
Much of the documentation of APIs I've written were using Ms-Word...
Swagger provide a Json syntax to document a REST API, but it is mainly useful when used with Swagger-Ui, which allow to request the deployed server dynamically. You can use Swagger for your documentation, but as there will be no already existing server, I'm not sure it is worth the cost of learning its syntax. The main benefits is to give you constraints (like predefined fields) to follow.
By the way, I think that writing a REST Api Mapping or just document it takes the same amount of time, so I'm not sure it is really worth making all the documentation in a stand-alone way.
I have created .NET web services. I want to run it on a remote server and have the Java Applications (clients) contact the server for data. How should I implement the Server such that the Clients can make use of the org.apache.xmlrpc.client.XmlRpcClient package?
I just want the clients to generate a request for data and does not want to have any other dependencies.
Here is a good material on using eclipse for this purpose: http://wso2.org/library/tutorials/creating-web-service-client-3-steps-using-eclipse
Thanks.
Although both are rightfully called "web services" the SOAP based web services usually created in .net are incompatible with web services following the older XML-RPC standard.
In my opinion you can follow 2 routes to solve your problem:
either you go the SOAP route under Java, one of the most common API's for that purpose would be jax-ws - some excellent pointers to tutorials here, in Pascal Thivent's answer
or you transform your .net webservices to XMl-RPC by using xml-rpc.net
Both routes have advantages and disadvantages, it's hard to make that choice for you without knowing more about your project. A priori choosing the SOAP route might look "safer" as there the entire communication will be based on standard components.
If you have the Web Services on the .NET side, you must have a Web Service Description Language (WSDL) (if you are not talking about REST), you can easily create the client classes to consume this Web Service using an IDE, check this link here: http://netbeans.org/kb/docs/websvc/client.html
If you are using Eclipse I suggest you this tutorial to build a simple WS client.
You can adapt this example application to your real needs.
NOTE the example uses an old version of Eclipse, but the wizard is very similar also in newer versions.
I have a GWT application, with a Native Java backend, and a compiled Javascript front-end (as usual).
My GWT service should also be accessible from other clients, including a java applet. Initially my idea was to double the GWT service as a SOAP service, and use a soap client from the applet to access the GWT service, but I am wondering if it might be possible to use the built-in GWT client infrastructure to call the server from Java.
The problem with this approach is serializing the request and deserialize the response so as to be compatible with the GWT service.
One solution is to use GWT SyncProxy:
http://code.google.com/p/gwt-syncproxy/
which is explained here:
(dead) http://www.gdevelop.com/blog/2010/01/testing-gwt-rpc-services/
(Wayback Archive) http://wayback.archive.org/web/20130107141210/http://www.gdevelop.com/blog/2010/01/testing-gwt-rpc-services/
You can use it directly or, since they provide the source, you take a peek to see how they serialize the request and deserialize the response.
Another approach is to use Restlet to provide the services and then convert your GWT client to make REST calls. The Restlet people provide a GWT library to facilitate this.
http://wiki.restlet.org/docs_2.0/13-restlet/275-restlet/144-restlet.html
They provide an example of calling the REST service via Restlet from different clients, including GWT client, Java SE, and Android:
http://wiki.restlet.org/docs_2.0/13-restlet/21-restlet/318-restlet/303-restlet.html
Edit:
I only know RESTlet from evaluating it last year for my GWT project. I'm no expert and I didn't end up using it, but this is no reflection, good or bad, on RESTlet.
OP asks:
What would be the advantage of using the Restlet framework over JAX-RS ?
Essentially, JAX-RS is an just API (like JDBC) - you still need to pick an implementation or use the reference implementation Jersey. RESTLet has an extension for supporting JAX-RS API.
http://www.restlet.org/about/faq#07
7. What is the link between Restlet and JAX-RS (JSR-311)?
...
To summarize, both APIs have very different designs but are potentially complementary. The good news is that Jérôme Louvel (Restlet's creator) is an active member of the JSR-311 Expert Group and that an implementation of the JAX-RS API was made on top of the Restlet API. This "JAX-RS extension for Restlet" was developed by Stephan Koops in the context of his Master thesis and is one of the most advanced implementations available. For more documentation on this extension, please refer to this page.
OP asks:
Is it possible to use Tomcat / web.xml infrastructure instead of org.reslet.server
http://wiki.restlet.org/docs_2.0/13-restlet/275-restlet/312-restlet.html
This edition is aimed for development and deployment of Restlet applications inside Java EE application server, or more precisely inside Servlet containers such as Apache Tomcat.