3

I have a ado.net data service created using VS 2008 sp 1 that is hosted that I want to consume via HTTP and JSON from Android 2.1? Does anyone have sample code on how to do CRUD operations easily do this? I heard Restlet makes this very easy but can't seem to find sample Android code on doing this. If someone can post a tutorial with some actual code that would be greatly appreciated.

Bryan C
  • 1,594
  • 4
  • 16
  • 30

3 Answers3

3

here is a good link..

http://composedcrap.blogspot.com/2009/08/connecting-to-net-web-service-from.html

It uses ksoap2 API

http://www.tuxpan.com/android-soap/android-ksoap2-build.zip

another link from right here on SO...

How to call a .NET Webservice from Android using KSOAP2?

And here is a link for Android to WCF....

Can't connect to WCF service on Android

For a RESTful WCF service, here is a good tutorial...

http://mypetprojects.blogspot.com/2009/05/communication-between-wcf-service-and.html

Community
  • 1
  • 1
Ryan Alford
  • 7,514
  • 6
  • 42
  • 56
1

I found another link: http://wiki.restlet.org/docs_2.0/13-restlet/28-restlet/287-restlet/288-restlet.html

Seems usefull.

(+1 for Eclipsed4utoo for all the links!)

Rhapsody
  • 6,017
  • 2
  • 31
  • 49
0

Reached here late(or very late) but may help someone in present or future. If you are looking to consume a ado.net data service(now renamed WCF Data Service) from android client, I would recommend you to have a look at the OData4j library. It provides an easy way to access such a service in both xml and json format. Also, it is faster than RESTlet.
Sample code:

ODataConsumer c = ODataJerseyConsumer.create("http://url/WebService.svc");

List<OEntity> listEntities = c.getEntities("Movies").execute().toList();

if (listEntities.size() > 0 ) {

for(OEntity entity : listEntities) {

System.out.println(entity.getProperty("MovieID").getValue().toString());
   }
}

You can find more on WCF Data Service and OData4j here.

ThePCWizard
  • 3,338
  • 2
  • 21
  • 32