Exposing my GWT API via web/RESTful service - can it be done (easilyish)?

855 views
Skip to first unread message

Richard Berger

unread,
Dec 20, 2010, 5:16:51 PM12/20/10
to Google Web Toolkit
Apologies in advance if I am not using the right terminology in
describing my question. English is my first language. But COBOL was
my first programming language :).

I am investigating using GWT/GAE for an upcoming project and one of
the requirements is that we provide an engine that will be used by our
GWT front-end as well as potentially being used by other clients -
perhaps over a web service (or a RESTful interface).

In creating the GWT application, one obviously has to define an API
between the "client side" and the "server side". This appears to be
precisely the API I would want to expose to others. It would also
seem to be redundant to have a second implementation of the API that
works with non-GWT front ends.

Thus, I am guessing there is a way to expose my GWT API to others.
More specifically, since I am using RequestFactory, I am talking about
exposing the methods defined in the RequestContext for each of my
entities (and implemented in the entity itself - at least as of GWT
2.1.0).

I have looked at the restlet project and it seems that that *might* be
what I need. But it's hard for an ex-COBOL programmer to know for
sure :).

Thanks in advance for your help!
RB

zixzigma

unread,
Dec 20, 2010, 6:13:29 PM12/20/10
to Google Web Toolkit
I am interested in the very same thing.
So far my questions have left unanswered.
http://groups.google.com/group/google-web-toolkit/browse_thread/thread/b86693200c8f3179

You can find similar thread here:
http://groups.google.com/group/gwt-platform/browse_thread/thread/39bbc24842168f6a

Based on my understanding,
some of the challenges for doing REST with GWT are:

1- JSON<->POJO conversion (especially for complex objects, maps,
polymorphic types)
on the client side (since GWT ends up as JavaScript, and there is
no Reflection support there)
2- Data Binding
3- URL handling etc


there are a number of third-party open-source projects
that provide libraries that one can put together to do REStul apps
with GWT.

However there is no unified framework, and no official solution/best
practice from Google.

I am afraid if you use the open-source tools, you might eventually get
your app working (RESTful),
but you have to deal with the risk of these tools not being around, or
being experimental or buggy,
also not being able to take advantage of many interesting features of
GWT 2.1
and down the road, Google Team going in one direction, you might be
left on your own with limited support.
and the skills you learn might not be transferable in another team/
company

recently with 2.1.1 Google team released AutoBean which seems to help
with JSON/POJO handling
however there are virtually no clear documentation and not even a
basic hello world sample of those.

I prefer REST over RPC/RequestFactory, because REST/JSON is universal/
service oriented
rather than binary (in case of RPC) and data oriented in case of RF.

RPC/RequestFactory somehow remind me of old days of Distributed
Objects/CORBA/DCOM
and I'm afraid sooner or later Google Team/Community might realize
this.

Lets say you want to host part of your app on Amazon EC2, and part of
it on GAE.
(GAE poses many restriction that one has to chose this approach),
and lets say you want to use a mature serverside framework such as
Spring for the back end.
(to take advantage of enterprise integration features it offers :
Spring Security etc)

GWT RequestFactory, ties the client to server,
they are decoupled through the use of Interfaces,
but so was CORBA/DCOM.
it might be de-coupled but not loosely coupled enough.

the entire point behind SOA was LooseCoupling.
but with GWT I have the feeling that we are going backwards instead of
forward.

GWT is rich and has many aspects.
Ofcourse I am not talking about the Compiler/Widget Library/Model View
Presenter,
my comment was mainly the Client/Server Communication mechanism.

Gal Dolber

unread,
Dec 20, 2010, 6:25:32 PM12/20/10
to google-we...@googlegroups.com
You can manage to use gwt's serialization with rest. Checkout this post:

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.




--
Guit: Elegant, beautiful, modular and *production ready* gwt applications.

http://code.google.com/p/guit/




Sean

unread,
Dec 21, 2010, 12:54:29 PM12/21/10
to google-we...@googlegroups.com
I have used GWTRPCCommLayer with much success. I have my normal GWT App on the web, and I also have a service running on my home PC that also calls some of my RPC functions to find status, keep things updated, etc.,

zixzigma

unread,
Dec 22, 2010, 12:40:50 AM12/22/10
to Google Web Toolkit
Two great open-source projects I came across today are:

RestyGWT
http://restygwt.fusesource.org/documentation/index.html

GWT-JSON-CommandPattern
http://code.google.com/p/gwt-json-commandpattern/

they are pretty straight forward with clean API.

Richard Berger

unread,
Dec 27, 2010, 1:50:29 AM12/27/10
to Google Web Toolkit
Thanks to all for the feedback - just wanted to share some
reactions....
1. I was surprised by the lack of responses re: restlets - that seemed
to be a promising technology
2. Some of the suggestions/links seemed a little bit over my head -
but that is probably just because my head is at a pretty low place :).

But, pondering this a little more, I thought of a different approach
that might make a lot more sense. The bottom line is that my
application will need an API that can be called by many clients,
including the GWT UI that we would like to build. I was thinking of
trying to expose the Service API that is in the GWT application. But
wouldn't another approach be to build a RESTful interface to my data
as the API and then use that API from my GWT application (as there
seem to be standard ways of accessing REST APIs from the GWT server
side). Other apps could get to the REST API using whatever method
they chose and I don't have to end up implementing the API twice.

Thoughts and comments are definitely appreciated! Esp those using
short words :).

RB

On Dec 21, 9:40 pm, zixzigma <zixzi...@gmail.com> wrote:
> Two great open-source projects I came across today are:
>
> RestyGWThttp://restygwt.fusesource.org/documentation/index.html
>
> GWT-JSON-CommandPatternhttp://code.google.com/p/gwt-json-commandpattern/

Konstantin Chvilyov

unread,
May 31, 2018, 3:25:56 AM5/31/18
to GWT Users
Hi Richard,
Have you succeed?
Is it possible to add Swagger UI for existing GWT-RPC REST requests?

Thomas Broyer

unread,
May 31, 2018, 6:15:46 AM5/31/18
to GWT Users
There's no such thing as "GWT-RPC REST", so no.

Konstantin Chvilyov

unread,
May 31, 2018, 6:52:47 AM5/31/18
to GWT Users
Thank you Thomas,
Is there such thing as "GWT-RPC POST" ?
If yes: Is it possible to add Swagger UI for existing GWT-RPC POST requests?

Jens

unread,
May 31, 2018, 10:23:02 AM5/31/18
to GWT Users

If yes: Is it possible to add Swagger UI for existing GWT-RPC POST requests?

No. You would need to make a REST API using the OpenAPI specification (swagger) and let that REST API call your GWT-RPC services.

GWT-RPC isn't REST / JAX-RS. 

-- J.
Reply all
Reply to author
Forward
0 new messages