What would be best and simplest way to call Yahoo weather webservice/any json webservice in android?
Some people suggest not to use Ksoap for mobile application instead use Restful or Json webservice.
TIA
Bhaskar
In short, use HttpClient, HttpGet, and JSONObject
Without any more details, this is probably similar to what you are attempting: http://www.josecgomez.com/2010/04/30/android-accessing-restfull-web-services-using-json/
Here's another post where this is discussed:
How to call a SOAP web service on Android
If you really want to be simple, just embed the content of the message in a HttpClient (included with Android by default) and manually parse the result.
Here (http://breaking-catch22.com/?p=127) is a link to an example of calling a REST web service.
Have a look at how Google APIs Client Library for Java does it, for example in this YouTube sample using HttpTransport and JSON:
http://code.google.com/p/google-api-java-client/source/browse?repo=samples#hg%2Fyoutube-jsonc-sample%2Fsrc%2Fcom%2Fgoogle%2Fapi%2Fclient%2Fsample%2Fyoutube
Related
I'm new to android, I'm trying to build an android app that is a front for a web portal. For example, Airbnb. They have a website, but they also have an android app that, using it's own layout, will show listings from their website.
There are many websites that teach how to or even directly convert your website to android apps. However, this will result in an app that loads too slowly and is unresponsive due to CPU usage.
Could anyone share any tutorial/guide to learn how to do this myself?
Million thanks.
To actually load data from a web server you're gonna need and API which usually delivers the proper date using JSON or XML format so that you can properly parse and display that data. Building this API is in it self a complete course on its own.
But connecting to and requesting data from the API is usually done using some networking libraries. These are some of the better know libraries for this purpose.
OkHttp: A complete library with a set of tools for handling network connections and HTTP requests.
RetroFit:Type-safe HTTP client for Android and Java by Square, Inc. which is built on top of OkHttp.
Async-Http-Client:
The Async Http Client library's purpose is to allow Java applications
to easily execute HTTP requests and asynchronously process the HTTP
responses. The library also supports the WebSocket Protocol. The Async
HTTP Client library is simple to use.
There tons of other good libraries.
its called webservices
Through android you get data in form of json from a web server and then return in custom view as you want.
Follow this link hope it will help
Step by Step Method to Access Webservice from Android
you would have to write an API/Web service or use if already exits to fetch data from web server. Basically the concept is that, the website itself must be pulling data from some database, so write an API which would fetch the data from same API and return JSON data and consume the API from your android app.
If you know PHP refere to this for the help :http://www.codeproject.com/Articles/267023/Send-and-receive-json-between-android-and-php
You can write WebService, in programming it generally refers to a web page(ex. Airbnb), that can be called from your android application which can pass in data to it, or receive data from it.
WebService is basically like a 'method' or 'function' in a normal programming language; except you're calling it over the internet.
The first thing is you have to create a Web Service. The Web Service will be your "bridge" to consume the data from other Website like airbnb or others and return the data to your android through json format for example.
You can create a Web Service using many languages like C#, Java, PHP, etc. I would like to recommend you to use the language that you know the most.
You can try to google this
Cheers
This may be a very basic question. But please clear a doubt that I have. Does the time in which response is received in Android App from the web service depends on the library we use for http connection? I mean is some library give faster response than others?
Thanks
Use Volley library that is recommended by Google.
Here is nice example of caching your response. How to use this
http://www.androidhive.info/2014/05/android-working-with-volley-library-1/
I am new to android & web services.I I want to create an android app which consume a webservice using HttpClient.
Yet i am confused with, how to do this. I'll explain what i've needed to do.
Say,we have a webservice at http://www.w3schools.com/webservices/tempconvert.asmx
WSDL url=http://www.w3schools.com/webservices/tempconvert.asmx?WSDL
What I need is to call the method "FahrenheitToCelsius" & return values from it in an android app.Can't i do this using HttpClient? Since it seems to get only the HTTP methods like GET and POST.
When I search on this ,I found the below site as a more frequent suggestion. But it doesn't contain ,what I need to do.
http://lukencode.com/2010/04/27/calling-web-services-in-android-using-httpclient/
(I could call "FahrenheitToCelsius" method & return values using ksoap library.But now i need to do it using HttpClient too)
To clarify- When you connect to a webservice via its WSDL file, you're consuming a very specific kind of webservice— specifically, a SOAP webservice.
The typically way to connect to a SOAP webservice is to either find a library in your language of choice, or find a utility that will use the WSDL to generate code for you that communicates with the webservice.
One popular utility for connecting to SOAP on Android is called ksoap-android.
I need a tutorial on how to do a basic web service call in android. I currently use ksoap but I and getting an error when I make the call and I need to know what the response from the server was. ksoap wont give me that information because it parses the response in the api where I am getting the error.
I am new to all this web service stuff so please help me out
Well it depends what you want to develop it using
A good tutorial using PHP, MySQL is here
I know you are using KSOAP at the moment but here is a nice tutorial that uses KSOAP and in explained in nice detail.
i want to access a java web service Running on a Server. which one SOAP or JSON is good to access this web service. i dont want to put overhead on the Server and want the calling of web service to be Fast. plz suggest better way to do this.
JSON and SOAP are two different things. JSON is just a data format while SOAP act as Manager on server side that manage request and response from client.. it can return JSON as a result which is a data format likehttp://stackoverflow.com/questions/9382864/answer/submit XML
You do not access a Web Service with JSON, that is just a format. Depending on the Web Service you might need to communicate with it by sending SOAP envelopes or using REST.
Ok, there is a lot of confusion here. SOAP/REST are two approaches to managing services ON THE SERVER SIDE. SOAP is XML-based, while REST is URL based. Assuming you are writing an Android app, you won't be implementing the SOAP/REST/WSDL interfaces-- you will get them from the service team.
So, if the web service you are using provides both REST and SOAP, then you can choose which set of endpoints to hit.
When you are packaging up your request and sending it to the service, you probably want to package it as JSON. JSON is just "Object Notation." Inherently, it is nothing more than a way to format data in such a way it universally recognized. Alternatively, you can package your request as XML. But JSON is more light-weight, as XML has a lot of required redundancy (unless it is compressed).