How to consume SOAP in android?

How to consume SOAP/REST web services on Android (Service/Broadcast/Intent/etc)

  • Is there a common way to consume web services from Android applications (aside from the protocol)? What I need is a Service or Intent or Thread (or anything else) that is capable of: staying alive no matter what Activities are open; be able to perform multiple requests at the same time; accept input values and return output values to the right caller; be able to discard an ongoing operation (while keeping to run all the others) and not to return the output value if it is no longer desired; (of course) run asynchronously. Is there a common way to accomplish this? I've had some issues while using Services, primarily because I wasn't able to discard an ongoing operation, so the results were colliding with each other.

  • Answer:

    mmm you need a combination of things here. First of all, you need a service layer implement it with a http://developer.android.com/guide/topics/fundamentals/bound-services.html (inherits). Your UI activities must call this service through an http://developer.android.com/guide/topics/intents/intents-filters.html. Then, this layer that would be execute it in a different thread than your UI layer, must have a Rest Client object to perform services calls. Here you have lot of approaches, I recommend you http://www.springsource.org/spring-android implementation as well as http://wiki.restlet.org/developers/172-restlet/g1/271-restlet.html. As is a pretty big discussion, anything else please tell me.

frapontillo at Stack Overflow Visit the source

Was this solution helpful to you?

Other answers

You should use Service for this task. This is the only component that was designed to handle background long-running tasks. Most likely you need to use this service as a "locally bound" to pass complex requests and responses without need for serialization, and to perform other tasks that are relatively hard to implement via Intents. Read more about locally bound services here: http://developer.android.com/guide/topics/fundamentals/bound-services.html.

inazaruk

This question was posted earlier on stack. Take a look at this thread http://stackoverflow.com/questions/3197335/android-restful-api-service You can also look at gdd sched, this is exactly what you want - http://code.google.com/p/gddsched/

Pradeep Sharma

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.