how create a webservice with a database connection? - android

I want create a android application and i need to connect to a webservice and this web service should have connection to a database.
How is the simple way and free to implement this solution?

How about a PHP server which is (managing a database and) handling HTML POST requests? You could use JSON as communication format. On client side you could even use GSON to hide the JSON handling.

Related

Is it possible to connect an Android device to a WCF or any other .NET web service?

I want to create an Android app to connect with a server and it's DB. In order to communicate with the server can I use a .NET web service? and what sort of a service should I use?
Webservices is the bridge between the server and your android app.For accessing the DB from the server you have to write the webservices that returns the data in json format or other.
For JSON you have to use JSON Parsing that will parse the data coming from the server and get it on to your app. And for sopa webservices you have to use KSOAP library and parse the data.
FOr JSON Parsing refer this:-http://www.androidhive.info/2012/01/android-json-parsing-tutorial/
For soap webservices:-http://seesharpgears.blogspot.in/2010/11/basic-ksoap-android-tutorial.html
Hope it helps you a lot.

How to connect Android App connecting to a web service

I created a small app and with this app I want to send the data (over wifi or bluetooth) to a PC/server.
I am thinking of creating a webservice that will run on the PC and will be listening constantly to any incoming client requests.
Once it receives request from client, the data transfer takes place.And after the webservice receives the data it should automatically open an application/GUI window showing the data received.
My question is Can I create a webservice using TCP/IP in JAVA and have it constantly run in background and listening to client request?
Also how do I start a GUI as soon as the webservice detects a client request and receives the data?
Use SQL Server to manage the data on your desktop and create a web-service in .NET on Visual Studio.
Then connect to the web-service in your application and set/get data from the DB, using web-services.
Links which might be useful :
How to make a web-service in .NET (does not include the implementation in Android) : http://srikanthtechnologies.com/blog/dotnet/wsdaljava.aspx
How to connect your service with Android :
http://seesharpgears.blogspot.in/2010/11/basic-ksoap-android-tutorial.html
http://www.codeproject.com/Articles/304302/Calling-Asp-Net-Webservice-ASMX-From-an-Android-Ap
http://adrianandroid.blogspot.in/2012/05/access-c-net-web-service-in.html
the best way is to create a web service and connect your application to the web service, you can use the tool http://www.wsdl2code.com that create all the needed code for connecting and parsing the data :)
I recommend to use WS on the server-side and you can use Ksoap android library on the client-side. Create a background thread which updates the UI with the new data with. Use AsyncTask, Loader or Handler which is fit for your solution. (Read the official reference for more info).
you can easily achieve this by creating an end-points/routes using node.js or php then host it on the cloud. I think I like firebase for hosting for now, u might wonna try that it really cool. after creating those endpoint which will be connected to ur database then u use http get or post request depending on what u want from ur database in ur mobile app.
if u are creating for android use Retrofit for http connection.

Read and write data from server

I want to read and write data on my server database from android UI.
I have a host which has MySQL.
any suggestion for me?
Create php to create json for your data on the server.
Use RoboSpice for aysnc loading your json via the network.
See https://github.com/octo-online/robospice
This is your friend. On server side you should create php pages (or another ones) and make requests from your app to these pages.

Android database connection how to connect with serverdb?

How to connect the live database in android? if anyone know pls tell me how?
You should either use web services or implement an HTTP handler and transfer in a RESTful manner
you use the webservice (url) like php,.net,python.then data stored in the database using the webservice.and response from the server like xml and json.you make the connection to the sever through the get and post request from the server.

Should i use SOAP or REST in accessing Web service?

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).

Categories

Resources