tesi di laurea
Developing Google Android Mobile Clients
for Web Services: a Case Study
relatore
Ch.mo prof. Stefano Russo
correlatore
Ing. Marcello Cinque
candidato
Vito Daniele Cuccaro Matr. 885/83
Main issue
Main issue
Is the new Google Android platform mature for developing
Is the new Google Android platform mature for developing
mobile clients for Web Services?
mobile clients for Web Services?
Goal of the Thesis
Goal of the Thesis
Goal of the Thesis
Goal of the Thesis
Evaluating the Android platform through a case study (porting
Evaluating the Android platform through a case study (porting
of a J2ME client for accessing Wireless Sensor Networks).
of a J2ME client for accessing Wireless Sensor Networks).
Contributions
Contributions
Pros and Cons of Android for WS mobile clients.
Pros and Cons of Android for WS mobile clients.
Fitting and Testing of the KSOAP solution for WS on Android.
Fitting and Testing of the KSOAP solution for WS on Android.
Proposal of a new Android
Proposal of a new Android--specific design pattern (AVA) for
specific design pattern (AVA) for
translating the popular MVC pattern.
Background:
Background:
Web Services
Web Services
The most common The most common
implementation of SOA implementation of SOA
Key benefits:
Key benefits:
Operational Model
Operational Model
Key benefits:
Key benefits:
Accessible by anyone, Accessible by anyone,
anywhere and from any device anywhere and from any device
B2B and EAI supportB2B and EAI support
Dynamic location and Dynamic location and invocation of services invocation of services
Interoperability among Interoperability among
heterogeneous applications heterogeneous applications
Standard protocols and Standard protocols and data exchange format data exchange format
Core Standards
Core Standards
XML and XML and ebXMLebXML
WSDL and UDDIWSDL and UDDI
SOAPSOAP, the , the de facto de facto standardstandard
for invoking Web Services for invoking Web Services
Background
Background: The Google Android Mobile Platform
: The Google Android Mobile Platform
Software Stack
Software Stack
Developed within OHADeveloped within OHA
A software stack for mobile devices including A software stack for mobile devices including OS, middleware and key applications
OS, middleware and key applications
Key features:
Key features:
Developed within OHADeveloped within OHA
Open source under Open source under Apache license
Apache license
Laying on a Linux 2.6 Laying on a Linux 2.6 Kernel
Kernel
Applications written in Applications written in Java
Java
Has its own APIs (as well Has its own APIs (as well as some of Java)
as some of Java)
Developing an Android Application
Developing an Android Application
ActivityActivity
Main components:
Main components:
Toolbox
Toolbox
::
Eclipse (or Eclipse (or NetBeans
NetBeans) plugin) plugin Application Lifecycle
Application Lifecycle
ServiceService
Broadcast ReceiverBroadcast Receiver
Content ProviderContent Provider
Other key concepts:
Other key concepts:
IntentIntent
Intent FilterIntent Filter
NotificationNotification
ManifestManifest
XMLXML--defined GUIdefined GUI
R.java
R.java
NetBeansNetBeans) plugin) plugin
FullFull--featured SDK featured SDK with Debug Monitor with Debug Monitor
Device EmulatorDevice Emulator
Online Doc and Online Doc and Support
Android and Web Services: state of the art
Android and Web Services: state of the art
No native solutions available yet No native solutions available yet (SOAP APIs for WS invocation) (SOAP APIs for WS invocation)
KSOAP
KSOAP
Main Developers’ proposals
Main Developers’ proposals
“Homemade” solution: “Homemade” solution: HTTP connection +
HTTP connection +
manual XML parsing (SAX) manual XML parsing (SAX)
kXMLkXML--RPC (lightweight solution) RPC (lightweight solution)
KSOAP KSOAP
KSOAP
KSOAP
A popular openA popular open--source source mobile
mobile--oriented oriented SOAP implementation
SOAP implementation
Basically a client library for Basically a client library for invoking web services
invoking web services
Tested on JavaTested on Java--based based devices
devices
Now in version 2 Now in version 2 (1 is deprecated) (1 is deprecated)
Case Study:
Case Study:
the ICAAS framework for accessing WSN
the ICAAS framework for accessing WSN
Software architecture for accessing Wireless Sensor Networks Software architecture for accessing Wireless Sensor Networks developed at
developed at MobilabMobilab within the REMOAM project within the REMOAM project (by CINI and
(by CINI and Strago s.r.l.Strago s.r.l.))
Non standard implementation Non standard implementation The ArchitectureThe Architecture
Non standard implementation Non standard implementation of the OGC Sensor Web
of the OGC Sensor Web Enablement specifications Enablement specifications
Key features:
Key features:
Interoperable & ConfigurableInteroperable & Configurable
ExtensibleExtensible
Requests optimization Requests optimization (Caching and Filtering) (Caching and Filtering)
ICAAS Web Services
ICAAS Web Services
for SOA access:
for SOA access:
ICAASMobile: a J2ME test client
ICAASMobile: a J2ME test client
SOA access to ICAAS through WSSOA access to ICAAS through WS
Real Time monitoring of WSNReal Time monitoring of WSN
Session managementSession management
Tested with a WSN simulatorTested with a WSN simulator
Notification ServiceNotification Service
Observation ServiceObservation Service
Collection ServiceCollection Service Tested with a WSN simulatorTested with a WSN simulator
Technology note: Technology note:
Apache Axis Apache Axis
(a Java
(a Java--based SOAP based SOAP implementation)
implementation)
used for WS deployment used for WS deployment
Collection ServiceCollection Service
Alert ServiceAlert Service
Case Study:
Case Study:
Porting ICAASMobile from J2ME to Android
Porting ICAASMobile from J2ME to Android
A typical porting process A typical porting process
Assessing Migration Feasibility
Assessing Migration Feasibility 1.1. All functions of the original client are All functions of the original client are achievable on Android (doubts were achievable on Android (doubts were raised about invoking Web Services) raised about invoking Web Services)
5.
5. ++ approach: add one function at a ++ approach: add one function at a time and make it work before going on time and make it work before going on Understanding Initial Application
Understanding Initial Application
Deciding Target Development Tools Deciding Target Development Tools
Validating Original Design Plan Validating Original Design Plan
Deciding about Porting Strategies Deciding about Porting Strategies
raised about invoking Web Services) raised about invoking Web Services)
2.
2. Reverse Engineering of ICAASMobile Reverse Engineering of ICAASMobile to get SRS and software architecture to get SRS and software architecture
3.
3. Eclipse with Android SDK pluginEclipse with Android SDK plugin
4.
4. Decision to keep the same Decision to keep the same architecture and code base architecture and code base
Invoking Web Services in Android:
Invoking Web Services in Android: the KSOAP2 solution
the KSOAP2 solution
Reliable (tested on other Reliable (tested on other mobile platforms)
mobile platforms)
Advantages:
Advantages:
Disadvantages:
Disadvantages:
Introduces overhead on Introduces overhead on constrained devices
constrained devices
Easy to use Easy to use
Facilitates porting (the Facilitates porting (the original application uses original application uses KSOAP1)
KSOAP1)
Some effort is needed to Some effort is needed to port a client from KSOAP1 port a client from KSOAP1 to KSOAP2
to KSOAP2
Motivations for the choice:
Motivations for the choice:
Reusing the original business Reusing the original business logic as much as possible
logic as much as possible
Relying on a widely tested solutionRelying on a widely tested solution
Implementation
Implementation
Stub restructuring neededStub restructuring needed
The thread responsible for The thread responsible for WS invocation (through the WS invocation (through the stub) can be reused
Porting the MVC Pattern to Android:
Porting the MVC Pattern to Android: the AVA solution
the AVA solution
Model
Model--View
View--Controller
Controller
Separating GUI from Business Separating GUI from Business Logic and Data Access
Logic and Data Access
Adapter
Adapter--View
View--Activity
Activity
Main issues: Main issues:
Android Views are not JavaAndroid Views are not
Java--Logic and Data Access
Logic and Data Access Android Views are not JavaAndroid Views are not
Java--coded but xml
coded but xml--defineddefined
Who is the Controller?Who is the Controller?
Who is the Model?Who is the Model?
Answers Answers
Activity builds View from xmlActivity builds View from xml
Activity acts as ControllerActivity acts as Controller
Adapter plays Model’s roleAdapter plays Model’s role
Contribution:
DroidICAASMobile:
DroidICAASMobile: a Conceptual Model
a Conceptual Model
Adapter Adapter notifyDataSetChanged notifyDataSetChanged creates creates change dataset change dataset Thread Thread change dataset
change dataset
KSOAP
KSOAP--based
based
WS invocation
WS invocation
AVA
AVA--based GUI
based GUI
View View
user inputs user inputs
builds
builds Layout.xmlLayout.xml
-- ---Activity Activity setContentView setContentView notifyDataSetChanged notifyDataSetChanged update update user inputs user inputs Stub Stub KSOAP KSOAP creates creates creates creates uses uses Web Services Web Services invokes invokes response response response response