Jan 2 2009

Ejb, Android and Web Services

Cansin

This week, I tried to build a simple system where I combine EJB and Android technologies. The idea was simple, I would have an EJB application at server-side which has an Entity Bean to fetch some data and using a Session Bean I would forward this data to a Dynamic Web Application (a Local JSP Client). And another Remote Android Client would show this data too.

To begin my experiment, I first installed JBoss5 Application Server, XDoclet, Eclipse Java EE and its related plugins.

After lots of experiments and trying to follow this tutorial, I was able to create an Dynamic Web Project having a JSP which gets it data from an EJB Project’s Session Bean. Before I began to connect a database to this EJB Project using an Entity Bean, I tried to bind a Remote Android Client to this EJB. But, unfortunately there was no sources for this at web and I couldn’t get it done myself. Also from what I read at blogs, It seems that it’ll be wise to use Web Service approach instead of EJB.

So, I tried to implement a Web Service using my EJB Project. But, it was also another mystery for me. There is no good documentation/tutorial about how to create anything using Eclipse. Using Murat’s previous notes, I tried to generate my EJB based Web Service but, It was also another failure. So I simply create a regular Web Service using regular Java Classes.

But there is also a problem about Web Service approach. Android SDK doesn’t support a high level remote protocol like SOAP. To have SOAP support, we must use kSoap2 engine, which I had no time to look up.

This week was most of a failure for me, next week I’m planning to reach my regular Web services using Android with kSoap2.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • FriendFeed
  • LinkedIn
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • Twitter

5 Responses to “Ejb, Android and Web Services”

  • Pablo Says:

    Hi, i saw your article because i`ve been working with android and web service using tomcat. I lost a lot of my time trying to connect but is impossible. You can do it? if your answer is “yes” please let me know .
    My email is ppasten@nectia.com Thanks and greetings from chile

  • ale Says:

    hi~ i meet the same problem with android and web service. i’m trying to get android work with web service based on Axis2.
    my email is yoslee@gmail.com. Hope i can be given some tips on that issue~

  • Jingwen Xiong Says:

    Thank you for sharing that. Is there any successes with ksoap2?

  • Tal Says:

    Hi, can you please post your solution on the site and not via mail so everyone could make use of it ?

  • Cansin Says:

    @jingwen
    Nope, we leave SOAP approach and moved entire application to server-side. We only have HTTP connection now.

    @ale, tal
    As mentioned above, unfortunately we leave SOAP approach, so I only have a guess that it should be done by creating a web-service and calling it using ksoap2 at android. We do have a web service tutorial at here, and also there is this guy at android-developers group who told he implemented a class at android which calls SOAP service using ksoap2. It is worth a try.

Leave a Reply