I am creating an app in android. It will be calling a webservice to fetch some confidential info. I need to verify that the user is authenticated to access the info and the service shouldn't be called from any other source even if the user has all the required credentails to access the service.
What should be used to ensure the security.... REST or SOAP?
For security you should use SSL with client authentification and possibility to revoke cvlient certificates (though not every appplication server will support this). SOAP or REST do not have differences in this context.
In my experience REST is easier to build and has less overhead. I used to build soap services with CXF, which is really easy, but now I use Restlet for the server, which is even easier and quicker. Restlet has integration for Json, Guice, JPA, and all the good stuff. At the Android side, I use a simple rest interface with httpClient, Roboguice and Jackson.
Related
I want to use android application to pass and get data from webservice, I have the wsdl of that webservice. So which of the one i can use for data manipulation ksoap2 or retrofit 2 which is better.And if i use one of these what else is needed.
It depends on the architecture in which your services are written. Retrofit is used for rest services where as ksoap is used for soap services.
REST vs. SOAP
There are significant differences between SOAP and RESTful web services. The bullets below break down the features of each web service based on personal experience.
REST
RESTful web services are stateless. You can test this condition by restarting the server and checking if interactions survive.
For most servers, RESTful web services provide a good caching infrastructure over an HTTP GET method. This can improve the performance if the information the service returns is not altered frequently and is not dynamic.
Service producers and consumers must understand the context and content being passed along as there is no standard set of rules to describe the REST web services interface.
REST is useful for restricted-profile devices, such as mobile, for which the overhead of additional parameters are less (e.g., headers).
REST services are easy to integrate with existing websites and are exposed with XML so the HTML pages can consume the same with ease. There is little need to refactor the existing site architecture. As such, developers are more productive because they don't need to rewrite everything from scratch; instead, they just need to add on the existing functionality.
A REST-based implementation is simple compared to SOAP.
SOAP
The Web Services Description Language (WSDL) describes a common set of rules to define the messages, bindings, operations and location of the service. WSDL is akin to a contract to define the interface that the service offers.
SOAP requires less plumbing code than REST services design (e.g., transactions, security, coordination, addressing and trust). Most real-world applications are not simple and support complex operations, which require conversational state and contextual information to be maintained. With the SOAP approach, developers don't need to write plumbing code into the application layer.
SOAP web services, such as JAX-WS, are useful for asynchronous processing and invocation.
SOAP supports several protocols and technologies, including WSDL, XSDs and WS-Addressing.
Consuming a web service via a database stored procedure allows users to straight away update a database with information from different sources. Users can also schedule a job at regular intervals to get data updated periodically in the database.
For further details visit following link:
http://searchmicroservices.techtarget.com/tip/REST-vs-SOAP-Choosing-the-best-web-service
Retrofit, A type-safe HTTP client for Android and Java
Retrofit can be used to consume any type of web services, be it REST or SOAP, though typically used for REST APIs. I do not know much about SOAP standards but you can definitely do SOAP using Retrofit.
https://github.com/asanchezyu/RetrofitSoapSample
I am working on a sensor app in android and I've to store the accelerometer readings on a django server and then retrieve them on my device. I am new to django and I don't know how to communicate with Android's HttpClient and a django server.
Django doesn't care what the client is, and Android's HttpClient don't care whether the url are served by Django, Tomcat, Rails, Apache or whatever. It's only HTTP. IOW:
learn to write a Django App (it's fully documented)
learn to use the Android's HttpClient (it's fully documented too IIRC)
connect the dots...
I believe the simplest way is using Django Rest Framework.
In this scenario, the steps are:
Install Django.
Create the the Django App and the Model for the data you want to store and access through the API.
Setup Django Rest Framework. There are many tutorials that can help you here, for example Getting Started with Django Rest Framework and AngularJS .
Access your new API from a browser and your Django App. Here is going to be very useful the browser Django Rest Frameworks will automagically create for your API.
Unless you need to do something 'special', Django Rest Framework will help you a lot, generating views, dealing with JSon serialization and so on. Basically, the only thing you will need to care is the model definition.
From the Android side, you will need:
Access your API using HttpClient. However, HttpClient library it is not recommended anymore to use it, as Google is focusing their efforts on improving the HttpURLConnection implementation.
Parser the data you got, in this in JSon format. To do this, you can use JsonReader.
Another alternative is using Retrofit, a very popular REST client for Android and Java, which solves the two problems very easily.
I need to build proxy from a "WSDL" to call "WCF" services.
please provide me info. about tolls required and steps to do.
i have wsdl document.
and want to create a android client to consume the services.
i have spend a lot time on tht.
Android doesn't have built in SOAP API. You must use some additional library like kSoap2 but those libraries doesn't provide automatic client generation - you must code it. There are products which are able to generate clients but I expect them to be commercial like WSClient++.
I have a set of computations that I am currently running on the Android. I want to move these computations from Android to a cloud (possibly google c2dm architecture or any other free service) but I dont have enough knowledge on how to use the c2dm. I will be sending a list of strings to the cloud, do lots of computations on the cloud and then return the rearranged list of strings to android.
Can anybody help me with this (as to how to connect the cloud with an android app)?
Thanks
Anks
You could use HTTP POST-GET requests to communicate with server, send and receive JSON/xml data.
EDIT that's almost enough to leverage client-server communication in your app.
http://developer.android.com/reference/java/net/HttpURLConnection.html
http://www.ibm.com/developerworks/opensource/library/x-android/
http://www.ibm.com/developerworks/xml/library/x-andbene1/
I am unsure what you mean by "google cloud".
One way to achieve this would be to use Google App Engine. It allows you to run server applications developed in Java/Python on Google's infrastructure.
What this means is that you can develop the server side yourself, and therefore implement any protocol you like to communicate with clients, that is, create your own web service.
As Mighter mentioned you could perform raw HTTP requests. However, there are a number of existing protocols for remote procedure call: SOAP, XML-RPC, etc..
I personally tend to like JSON-based protocols. It's easy to make your own implementation for that type of protocol, but you may be interested by this JSON-RPC library for Android, as an example.
Also check this other question: How to call a SOAP web service on Android
Once you'll have your web service ready, whether using SOAP, JSON-RPC or else, then you should be able to create a client, and expose the remote service calls through Java classes. If well designed, it could 1. feel as if you were calling methods on a local object, and 2. allow you to swap with a local implementation in case the network is unavailable.
I think it depends of how heavy your computations are, or how much computation power do you need. you can try to write a simple app engine server which handles post requests and return a JSON format answer. in case your computations are complex i would use google compute engine and install my custom stack.
in both cases you would need to write a server side to handle your data. if you use google app engine you can write it in java, python, php or go. if you use compute engine you can basically write it in any language that you can run on linux.
hope it helped!
I'm creating a Client/Server application with Android (Client) and WCF (Web Service).
From reading quite alot of discussions, I'm under the impression that there is no tool available to create the web service client in android automatically from a WSDL file.
If this is the situation, what is the easiest approach for creating a communication infrastructure between the client and server, that can be updated easily in the future (plain GET, REST, use SOAP and manually parse responses)
Initially, I wanted to build the web service and have the client created automatically with the provided WSDL file.
Thanks
AFAIK, there is no tool for automatic client generation based on a WSDL.
Android doesn't come with any soap related library.
BTW you can look for ksoap2-Android libraries and see if it's suitable for you.
More infos about using ksoap with Android should be found here