How to call external JSON Rest service from GWTP ?

404 views
Skip to first unread message

sbeex sbeex

unread,
May 4, 2014, 5:09:01 AM5/4/14
to gwt-pl...@googlegroups.com
Hello guys,

I have done a REST/Json server in PHP that return data on demand. That works pretty well with my android app.

Now I would like to make a GWTP client with GXT that can communicate with that same server.

Is there a way to do that ? Because I really don't know how I can do that with GWTP. I only used that framework with GWT-RPC until now.

Thank you for your help and tips.

Cheers,
Sébastien Vermeille

Richard Wallis

unread,
May 4, 2014, 5:51:14 AM5/4/14
to gwt-pl...@googlegroups.com
Hi Sevastien

Are you familiar with jsonp? http://en.wikipedia.org/wiki/JSONP

You first need to make your REST server support jsonp before gwt can communicate with it.


--
You received this message because you are subscribed to the Google Groups "GWTP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gwt-platform...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

sbeex sbeex

unread,
May 4, 2014, 6:41:29 AM5/4/14
to gwt-pl...@googlegroups.com
Hello thank you for this tip ! In fact currently both server are hosted on the same machine. My problem is how to get remote json to my actionhandler ... I really don't know how to do that

Maxime Mériouma-Caron

unread,
May 7, 2014, 2:09:23 PM5/7/14
to gwt-pl...@googlegroups.com
You can use GWTP REST dispatcher (https://github.com/ArcBees/GWTP/wiki/Rest-Dispatch)
The Car Store sample is a good place to start to see how it's used (https://github.com/ArcBees/GWTP/tree/master/gwtp-carstore). There's actually no example with a remote server, but the REST dispatch supports absolute URL in the @Path annotation you put on your client service class. If all your REST paths are going to point to your external server, you can also bind @RestApplicationPath to your external server's url with gin.

Eric Chabot

unread,
May 7, 2014, 4:27:25 PM5/7/14
to gwt-pl...@googlegroups.com
Actually in the carstore the phonegap module uses remote server.

Sébastien Vermeille

unread,
Jun 1, 2014, 10:53:33 AM6/1/14
to gwt-pl...@googlegroups.com
Ok so it is still a lot of work for something that is really easy behind... I'm thinking more and more of Vaadin looks simpler.

Christopher Viel

unread,
Jun 1, 2014, 11:51:40 AM6/1/14
to gwt-pl...@googlegroups.com
Look at the Rest Dispatch: https://github.com/ArcBees/GWTP/wiki/Rest-Dispatch. When it comes to bind the API path change the value for the path of your api. Absolute paths should work as well.
eg: bindConstant().annotatedWith(RestApplicationPath.class).to("http://myserver.com/api/v1");

--
Reply all
Reply to author
Forward
0 new messages