Vaadin consuming RESTful web-services

Hi there,

my first post here.

Some members of the
Brazilian Vaadin Community
are willing to participate in one of my pet projects (
arena-puj
). Arena-PUJ is exposing the business data through two channels:

  1. a RESTful web-service
  2. EJB 3.x interface (local/remote)

So, I have these two choices. Since Vaadin is pure Java, I suppose the EJB integration is quite easy, but I am also interested to know how to consume the RESTful service with the Vaadin frontend. So, the question is:


How to consume RESTful web-services with Vaadin?

  • this project has already a module coded with DWR and other module coded with JSF2.0, so Vaadin has a chance to compete in this arena :slight_smile: Everyone is invited to help if you believe the project is interesting and if you like to learn while coding.

Since all Vaadin code runs on a java as a servlet (under servlet control), I do not see any problems for calling web services from an application code. You only need to make sure your web services accessible from the server machine as it will act as a web service client to your web services. So, create your web services client the same way, you’re creating it in a desktop java application, that’s it.

We’re successfully calling web services API of our ERM system from several web front-ends, made with Vaadin.

Thanks Livotov,

the question here is about serialization and de-serialization of the data.

We are using Jerey-Client in the DWR project but so far I see a degraded performance of the whole application due to the serialization/de-serialization of the data.

I was asking about Vaadin support to consume JSON data, for example.

Is it supported in any special way in Vaadin, or we are just open to plug an external component ?

That’s ok, I will start from that …

  • in the JSF2.0 module, after connecting the frontend directly in the EJBs facade I got a 10x faster GUI, what is the same I expect with Vaadin.

  • JQuery and other frameworks provides built in facilities to consume JSON data, what makes the code more complicated but also much faster …

Let’s see, I will create the Vaadin module and wait for the Brazilian developers to code their first experiments, than I will have better arguments about Vaadin performance and robustness in front of the service …

examples:

the business case:
http://kenai.com/projects/puj/pages/Home

the service:
http://fgaucho.dyndns.org:8080/arena-http/institution

the dwr GUI:
http://fgaucho.dyndns.org:8080/arena-dwr/

the jsf GUI:
http://fgaucho.dyndns.org:8080/arena-jsf20/

The arena-vaadin is coming soon :slight_smile:

Felipe,

VAADIN internally has nothing with web services. It only implements it’s own protocol for communication between the web browser and the server side, but this is completely transparent for you, as an application developer, unless you’re going to create your own client-side widgets.

So, you’re free to use any technique for consuming data from other systems - they only need to be able to work at the server machine. But once you got the data from the third-party system, you probably will want to display it, say, in a table - in this case you should wrap your received items into one of the built-in VAADIN containers, say, BeanItemContainer, or write your own to support specific features. You mat take a look at HibernateContainer, which made to support fetching huge amount of data form the database via Hibernate and avoid excessive memory consumption on the server (note, VAADIN takes care for you for the same goal for the client side, so you don’t need to worry about how your table will display million of rows in a browser - you provide a container with this million of items added on the server and it will just work on a client :slight_smile:

very nice :slight_smile:

I am the server side developer, I will not interfere in the Vaadin code… I am just setting up the project here…

The main reason I am avoiding to connect Vaadin to the EJB facade is to make the developers environment more simple … without a dependency to a Java EE container…

I was just interested about the “feeling” of the vaadin experienced users about this topic.

your responses helped a lot… thanks… now it is time to cook some maven configurations here :slight_smile:

the first result:
http://fgaucho.dyndns.org:8080/arena-vaadin/

the application source code:
http://kenai.com/projects/puj/sources/arena/content/arena-vaadin/src/main/java/com/kenai/puj/arena/vaadin/VaadinTest.java

to checkout the source code:
http://kenai.com/projects/puj/sources/arena/show/arena-vaadin

Congratulations, new Vaadin framework member :slight_smile: