Web Service Example - both Android and Server portions - android

I am looking to create a simple service to learn calling a service from android.
What I want to do is an app to call a system over the web provide some parameters and the system respond. Very simple (hopefully)
But I want to build both ends.. not just the android end.
What tools would the community recommend that are industry standard and hopefully easily accessible.
I am hoping TomCat can do the hosting, but don't know if this should be a JSP or EE application.
Can anyone point me to an email of setting this up, again with both sides.
Hopefully Tomcat is a decent enough server to be both easy to setup and robust enough if enough calls are made to it.
Once that is done then I only need to do the android portion with Ksoap or anything else that is recommended.
Thanks in advance and I hope this is not too general a question.

I recommend using Apache CXF for a server. It does pretty much everything that you need in a web service. It does have a client part, but so far, I have implemented web services on Android myself, rather than using libraries. But that was a while ago, maybe today libs are better customized for Android.

Related

How to invoke a call to a URL from an Andorid app?

Disclaimer. I'm asking this on someone else's behalf and given that I know as much about Android development as penguins about flight, it may be clumsy. In such case, let me know and I'll remove it or try to reformulate.
I've created a web service that's reachable at the URL on the following form.
http://server/Blopp.svc/Store/value1/value2
The back-end part I've got covered but I'm worried about the front-end development. I've got a colleague that's making the app and he's got the rudimentary GUI done. However, in order not to do a lot of convoluted coding, he's heard that there's a certain library for making such URL calls.
What's the name of it? Is there certain other aspects to take into consideration or is there an (almost) standard one that everybody uses?
Please not that the app's functionality is at the moment limited to providing the web service with data. All the logic and presentation is done on the website and not inside the app.
I've never built up an Android app, so I'm asking for understanding if this is a dumb formulation. I just want to help my co-worker and he seemed to struggle with the details.
Is there perhaps a smoother way to make the call to a web service if I substitute the patter of the URL to use query strings? Any other approach that makes it easier for an Android developer? I'm not familiar with the area but I want to make things easy for my team-mate.
There are quite a few different HTTP libraries available and it would really depend on your specific requirements which one you used (if any - you can roll your own HTTP requests using HttpURLConnection) Two of the more popular ones are:
Volley
http://developer.android.com/training/volley/index.html
Written by one of the guys on the Google Play team and part of the AOSP. Very flexible and easy to use however I would hesitate to recommend it as it relies on the now deprecated Apache Http classes in its public API.
Retrofit
http://square.github.io/retrofit/
From Square. Version 2 is currently in late stages of beta. It allows you to define your API as an interface. It has dependancies on their OkHttp library as well. Very fast and also has RxJava support baked in.

Android 3 calling WCF REST

I'd like to create a RESTful WCF service and then call it from an Android 3.2 or 4.0 app. I have this sample here, but it dates back to May 2010. I'd like to know if that is still the best way of doing this?
The WCF part is OK, I can handle it (since I'm a .NET guy), but I'm looking for the best (both performance and security) way of calling the service.
If you have any links, samples or even books to suggest, I'd be more than happy.
Have a look at this https://sites.google.com/site/androidosbeginning/cosuming-restful-webservice-in-android
As long as you can get the WSDL from the WCF service, you should be able to interact with it using something like AXIS for Java and use wsdl2java to generate the client stub to interact with the service... though AXIS is relatively heavy to use on Android devices. I've never done anything like that with Android, but that's how it's done with Java. Perhaps there are some lighter-weight libraries you can use.
Here's a similar post: How to Consume WCF Service with Android

Architecture for webservices and android

I'm going to develope an application based on web services (axis2) and android (clients).
I'm now planning the logic architecture for my system and I supose that it should be like a SOA architecture. I have seen that a SOA architecture is based on layers.
So, this would be a "correct" logic architecture for my application? (with some changes of course)
http://geeks.ms/cfs-filesystemfile.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/unai/DDD_5F00_NLAYER_5F00_ARCHITECTURE_5F00_SMALL_5F00_6ADA95E1.png
Android code (activities) would be on Presentation Layer?
EDIT
April 2014
Now, 3 years later with some more experience... REST is the best :)
Warning, it may that this answer is not at all an answer to you question but anyway, here is my thoughts.
I'm definitely not a SOA specialist but since SOA can be implemented with REST, it should not have any consequences on a SOA architecture. Android is REST-ready (see that Google IO 2010 session on REST) and there is only little SOAP support on android (afaik, but I may be wrong).
At some point, you'll have to evaluate the feasibility of the interop. between your Axis WS-* with any existing android SOAP support (the well-known ksoap2 project for example). The result could be not without impact on your architecture design.
The point here is: if you do use Rampart to use WS-Security, for example, on top of Axis2, it seems to me there are little chances that ksoap may interact at all (technically) with your service provider. On the one hand, if the service is simple and can be bound with ksoap2, great, go on. On the other hand, if you would use a not so simple security or authentication scheme, it could just be a nightmare to get the things done with the simple SOAP support on android. In the latest case and as the REST approach seems to be the preferred philosophy on android, you may be confronted to the decision to have a REST proxy dedicated to android between your Axis2 business WS and the android client-side application.
In the hope it may be of any help.
Perhaps you could even try SOAP. Android supports SOAP web services and provides ksoap2 libraries which you can use for sending request and getting response from your server easily.
For starters just check this out. Now, the latest version of ksoap also supports passing of Object Arrays.
For more information of ksoap2, I suggest to read this
Cheers
All the best

server javaEE technology

I want to build a server that communicates with an android phone
based on a request/response model
At first i thought i will use Httpservlets and communicate with the android
by Http messages. but i need to be able to access a pretty big object with every
request so i guess i cant really transfer the object to the servlet.
so i know this is a pretty newbish question but iv'e been searching for days
what kind of java EE tech should i use(i thought of EJB but as i understand they cant communicate with android)?
Thanks in advance
I think the right question is how to implement service layer for your android application:
Basically there are two options REST based web services and SOAP. Android's support for SOAP is inadequate and I personally prefer REST over soap any day. If you have decided to go with REST, your options in Java are Jersey, RESTlets or Spring Rest services. I will prefer Jersey, but you can also look in to Spring ( although not strictly complaint with the JSR).
(note: look in "SO" for comparison on various rest based frameworks in Java)

implement WebServices on Android

I have to integrate an existing javabased Framework (whith different components which communicate via SOAP) in my Android. Every Component needs to receive and send SOAP-Messages, needs to act as a Server.
Is it true that Android OS < 2.0 does not support Server functionalities? What would be the min. Version?
Which framework can i use? I only found a few kSOAP examples for the client side, but none for servers.
Thanks for every hint, link, idea... help:)
Fabi
You best bet would be to run e.g. jetty as a server on Android but I would seriously reconsider your architecture. Why do the devices need to act as server? Are they being contacted in a pull way by another device or server?
yeah you're right... reconsidering the architecture would be best. But i can't change the existing framework which comnponents i have to use.(yes, a pull way communication is implemented)
Thanks for your help. But i just decided to use the framework by implementing a polling-service. A lot of extra work... but it will do it:)
fabi

Categories

Resources