I am developing application for iPhone and android. In code i need to access the data from database(oracle) .
I am planning to use REST web services to return JSON data to devices. I dont know much about developing web servies(all i did is 'consumption' part).
Now the question came to my mind, i can still manage to return the JSON data from java servlets.
IS there any advantage of using web services. I know for sure I am missing something but want to know what is it.
Now the question came to my mind, i can still manage to return the JSON data from java servlets.
Yes, you can return JSON from java servlets. There are plenty of libraries out there for taking what ever data you've retrieved from you database and serializing it into JSON.
IS there any advantage of using web services. I know for sure I am missing something but want to know what is it.
This is a super general question, but yes. I think the best answer is that (among other things) it gives you an API that arbitrary clients can plug into. So you can expand to new platforms trivial. That's the main benefit as far I see it.
Related
let me ask my question with an example:
Assume that I have some PHP files for my android app that I put it on 000webhost[dot]com; so, my question is how can I use parse (parseplatform[dot]org) in this situation?
I'm new in backend, so I'm sorry if this question is stupid!
For some reason I can't use back4app, aws, etc.
Don't worry about php language, if it's necessary I can write it in another language. (my backend logic is not complex)
If you need a simple web-site with simple backend logic, I'd do that using Express.js. Since Parse Server is essentially an Express.js middleware, you can use the same process to serve both Parse Server and the web-site.
If you prefer to use a different technology, Parse Platform provides many different sdks (https://parseplatform.org/#sdks) that you can use for many different backend technologies (including PHP), or you can connect directly to the REST (https://docs.parseplatform.org/rest/guide/) or GraphQL (https://docs.parseplatform.org/graphql/guide/) apis using any client.
When I asked this question, I didn’t know what exactly should I search until I found this amazing article. This article opened my mind, the most helpful thing that I found there, was this:
Parse is more flexible. Given the freedom to host Parse on the
server of your choice.
You can choose the self-hosting option and deploy your Parse project
on your selected server, such as Digital Ocean.
And then I found this awesome video on youtube.
Now I can run parse on my own server (vps or cloud).
I know the title of this question may not be clear, but I don’t want to change it, because someone like me doesn’t know the right keyword for research.
Hope this help someone else too.
Ok so, I know the question is pretty much google-able and I did google it and found out a few answers ,so I am not asking this question knowing completly nothing.
So, I have an application (Cannot specify much about what it does or is or so...) and I need to get some data from a database.
As far as I know, the Volley is the best way to go ,but I am still looking for more details.
Could anyone tell me which is the best way to go?
NOTE: I am NOT looking for code,I am looking for methods.A name would sufice ,as I can do the digging myself.Eventually links to documentations would be awesome, but again, I can find documentations.I just need to know which is the fastest way and the most optimized.
Based on your comment, it looks like there are two different aspects to your application:
Sending out the HTTP requests from your client- i.e. your android app
Processing and sending the response to these requests on the server side, by setting up a web service
Looks like you have part 1 figured out. Note that, volley is a library, similar to android HTTP library, but optimized for faster networking.
For part 2, unless you're planning to use embedded database like sqlite, you'd need to learn about writing web services to provide database access.
Spring Data JPA is one of the many ways to do it.
I hear Parse is great too, but not free.
I've come across this problem when thinking about creating different apps for Android. I see these apps that show you the weather cast or sport results, and I wonder which is the source they get all data from.
I assume they don't have their own database which they fill with data manually and live. I suppose they use some kind of web service, data source or something like that. I don't know if web service is the correct term to use in this case (english is not even my native language).
So I would like to know the correct term for what I'm looking for, plus any guidance on finding this kind of services, in order to be able to develop apps using this kind of data sources.
I think this question will help many programming students like me.
It depends what you trying to develope- Some apps use simple GET/POST Requests and get it's data back formatted as JSON or XML (which is the common case).
Some uses SOAP for getting their data.
In some cases they are using plain Sockets or CouchDB.
In some cases they are using Push Mechanism (specially for android) like GCM to send their data to the client.
It always depends what you want to do.
I'm working on an Android application which is fetching data from internet among other things. Actually, the project was started by someone else which is not here anymore,
and now that I have to turn it into a light client application and implement the server side (in Java), I'm wondering what would be the best tools/patterns to use to fit my needs.
Let's say I have to deal with several models (class representing a category) of objects which all inherits from one class : they have common attributes (such as name, attache thumbnail...) but specific properties too.
Because of this,you can understand that I can't afford to manage one specific table to map each single class.
However, I still want to be able to cache my objects somewhere in the Android device to populate the views of the application when working in offline mode.
Currently, the solution used by the previous developer was to store data directly into a TEXT field in the SQLIite database, as serialized objets.
This should be ok on the server side but I've read that the usual Java serializaton was very slow on the Android platform, although it is not really noticeable now because I work with around ~50 objects, I was looking for more performant alternatives for the future.
I've came across the JSON solution which can easily handle complex structures and Jackson library seems very interesting with its simplified data binding to POJO objects and its well-known performance.
But then, how should I store my Json objects ?
Is it possible to keep a json string in a TEXT field of a SQlite table ?
Or should I rather store them as .json file for each object ?
Which one is the more efficient to retrieve later lot of data?
Plus, I was thinking that JSON would be a very good exchange format between the Android client application and my server whould is in charge of processing the information from internet third-parties apis and exposing this data with webservices. (rather than trying to implement some RMI-like solution)
Is using the usual Apache HTTPClient enough on Android to communicate with the server?
For those who successfully developped client-server application (which seems very common to me) is this a good approach for Android ?
It seems to me that with mobile platforms, you can't really use the approach that you've learned for more classic J2EE app and such...
Any advice would be greatly appreciated because I'm a student and Android beginner who really want to improve her mobile development skills !
Thanks :)
That's open to discussion, so SO is probably not the best place to ask. In general, before declaring something is too slow (or fast), measure, compare and pick the one that works best for you. Yes, you can save JSON in a DB, an it will generally be faster than having separate files on the FS. But, again, benchmark and compare.
BTW, most J2EE 'approaches' (patterns) are overkill for any platform, let alone mobile.
I have a WCF RESTful application I wrote based off of WcfRestContrib and hosting in iis7.5, which passes a pdf as a byte[]. I'm trying to figure out how, and what the best way would be, to consume this service in an Android application. I believe I took care of all the Java/WCF interop issues because the service is used by an outside company that uses java. But I don't see to many examples out there. I've read that I'm going to have to make a method that passes JSON instead XML, but otherwise I believe it should be usable for an Android app. I'm not seeing too many examples of Android apps that consume RESTful services, is this not the preferred method for Android?
I seen a couple articles (http://romenlaw.blogspot.com/2008/08/consuming-web-services-from-android.html) but most seem kind of old, though they still may be useful. I'm just curious how any experts out there would suggest I handle such a project, I can create another kind of service if need be. I just want to be able to load pdf's from a service based on some parameters. Security is a concern, but not mandatory at this stage. Service currently uses basic auth and is on a https.
Any thoughts? Suggestions?
While also adressing your security concernt, you could use an HttpsURLConnection and then use getInputStream() from that to put it in a bytearray using read().