0

2 month ago i started to develop an android application which needs to call remote methods and receive complex objects (custom objects with custom feilds in it) from a server. My friend and I splitted the work so he worked on the android client and i on the server. Before we started, we built the base interfaces which provide the functions that the client needs from the server, so my friend can program easly the application (by using fake classes as implementation for the interfaces), and after i finish the implemntations of the interfaces in the server-side he will make the connection and call the functions from the server and not from the fake classes.

Now the problem is that we can't find a way to pass those interfaces from the server to the client. We tried to use java RMI, but we faild because android doesn't support java RMI, then we tried to use JAX-WS (with tomcat 7) and we also faild because JAXB can't handle intefaces. (-you can see more details here about jaxb issue-)

My friend and I feel really lost.. we don't have any idea how to pass those interfaces between the server and the android client. Is it possible what we're trying to do? if not, what other options avaible for us to call remote methods and receive complex objects from the server?

Thanks!

Community
  • 1
  • 1
Dave
  • 203
  • 1
  • 4
  • 8

3 Answers3

0

You can expose webservices on the Server, so the client can interact with the server whenever its needed that might be quickest solution.

Or you can write a kind of servlet programming to get the json request from the client, process it and send the json respoonse back to the client. If the application is data intensive, the JSON helps you a lot

Ramesh Sangili
  • 1,633
  • 3
  • 17
  • 31
  • I appriciate your help! i already made a webservice but i had a problem with jaxb - you can see here about the problem: http://stackoverflow.com/questions/14111925/creating-webservice-jax-ws-with-functions-which-return-custom-types – Dave Jan 03 '13 at 23:02
0

Not sure if this is too late now (after 2 months of development), but there are frameworks that should make RPC easier for you (take care of linking both ends). Two I know of are Apache Thrift (definitely usable with Android - there are apps that use it) or Apache Etch (possibly).

Apache Thrift: http://thrift.apache.org/

Apache Etch: http://incubator.apache.org/etch/

Blog about Evernote choice of Thrift: http://blog.evernote.com/tech/2011/05/26/evernote-and-thrift/

Swav
  • 841
  • 8
  • 24
  • thanks alot! it looks intresting. I tried to search on google but i couldn't really understand - can you tell me please the difference between apache thrift and apache etch? – Dave Jan 04 '13 at 15:51
  • They are very similar in what they do. You define your interfaces in the IDL of the framework, then you run the generator that gives you code that will handle the communication, then you link that to your code. Documentation for both is rather scarce. There is another alternative with dual license (GPL/Commercial) that has much better documentation, it's called ICE http://www.zeroc.com/ice.html. This post might be useful for thrift: http://stackoverflow.com/questions/7005482/how-to-i-get-started-with-apache-thrift – Swav Jan 04 '13 at 22:16
0

If your application is limited to communication between Java on the server and Android (no other clients e.g. IOS) then an easier RPC path compared with IDL based solutions is to use jsonrpc. This solution provides both server and Android client components. It is extremely easy to implement on both client and server. One limitation is that byte arrays have to be encoded because the JSON transport does not support binary.

user250343
  • 1,163
  • 1
  • 15
  • 24