0
votes

I'm a seasoned Java developer but new to GWT.

Consider a 3rd party http POST based webservices api, not completely REST based since there's configuration of servlets, among other things, to invoke these services. I'm building gwt components extending the base gwt composites and using these 3rd party data services to fetch/mutate the data.

In the normal java world, I'd have build a REST wrapper on these services and exposed them as Pojos via JaxB Xml/Json. In GWT, however, I read GWT-RPC will be the fastest, given the serialization required. The data is expected to be large (several thousands, paginated).

What's the best way to design the 'bridge' between the 3rd party data services and the gwt client components?

  1. I ruled out RequestFactory since we have a custom servlet provided by the 3rd party that fetches the webservices.
  2. Adding a rest wrapper adds a 3rd layer of indirection (3rd party api+rest+gwt-rpc serialization) that felt too heavy

Suggestions for a low latency design, where I don't have to write too many wrapper classes for each service call (pojo)?

I'd like to consider jaxb on the server side, making schema as the new contract, and converting them to JSON for gwt-client.

2
Worth pointing out that RPC, like RF, requires its own servlet, though you extend it to provide methods instead of using it to reference service methods and entities. - Colin Alworth
Please be aware of the Same origin policy which requires the GWT JavaScript to be loaded from the same server as you like to communicate with AJAX later on. Solely for this reason you might need an addidional server-side layer. - Alexander Kiel

2 Answers

0
votes

I am using RestEasy on the server side, which uses Hibernate JPA to access database. With a little modification, I should be able to switch over to Datanucleus JPA.

I am using RestyGWT on client side.

With careful consideration on the DTOs, I am able to - share the same DTO between server and client - share the same REST interface between server and client (after running a script over the server side REST interface to transform the return type into an async callback).

Integrating multiple GWT applications into a pluggable platform.

Currently I am also trying to merge JPA DTO with REST DTOs so that I have a single set of POJOs between server, database and client. Each DTO POJO would therefore have a mix of JAX-RS, JAXB, Jackson JSON and JPA annotation.

To reduce unnecessary client-server traffic, I use JSP as GWT hosting file in tandem with GWT Dictionary class to transfer all session-specific session-static information to the client.

0
votes

My Suggestion would be to use Spring RestTemplate, Gwt-RPC and have a RemoteServiceServlet/Spring bridge - that would give you RPC calls via a POJO from Server-Client and a clean tier to communicate with your external web services..

This will be lightweight and clean..