The last post presented the motivations about using SOA for mobile applications. It described where and how SOA technologies could be used in mobile solutions and the interests to follow such approach. This post describes a product recently developed by akquinet following this approach. This is a concrete demonstration of the advantages of using SOA in mobile solution.
SOA-based mobile application development
To explain how the service orientation can drastically simplify the composition of mobile solutions, I use a system pretty simple to understand. The goal is to read bar-codes from items with mobile phones. Then the user, fill a form and send it to the server. The current position is automatically added to the collected data.
This message is not directly sent to the server, but is first processed inside a mediation chain (ran on the top of an enterprise service bus). This mediation chain pre-processes the data, adds some content (as the zip code of the collected location) and dispatches the message to the adequate server. Then the message is stored into a database.
The mobile part
The mobile part is the application executed on the mobile phone. The application manages connectivity disruptions and stores all collected event in a local database. At anytime the user can review unsent collected data and try to send them.
The below images present the application for Android phones. The Android application used a service provided by another activity to scan bar-codes. The location is computed thanks to the location service provided by the OS. Finally, the database is also provided by the OS.
By reusing functionalities already provided either by the OS or others applications, the development of the mobile application was definitely simplified. The high majority of the code is just the business code.
Communication middleware and pre-processing
In order to deal with scalability issues and to provide a very flexible way to managed collected items, the messages are sent to an Enterprise Service Bus. This bus executes a mediation chain that pre-processes messages. Mediators just filter events, or rely on remote services (such as to compute zip codes for the collected locations). Depending on the scanned barcode, the message is also stored in different databases. Messages enter into the ESB thanks to a REST-based service.
The middleware used between the mobile devices and the server side is generally the less tailored part of mobile solutions. However it’s one of the most critical parts. This communication middleware definitely impact the success of the whole system and so has to be carefully chosen. It has to be well designed and flexible because it’s where critical issues generally occur.
The last part of the system is a web view displaying collected data on a map. The data is retrieved from the database. This web application is able to use different map providers (see when substitution matters below).
This web application runs on the top of an OSGi platform. The application relies on OSGi services in order to access maps, databases, user management, preferences, etc. Moreover, technical services such as transactions are also provided. Thanks to such design, any part of the system can be updated dynamically.
When substitution matters
Using OSGi brings us a great flexibility. For example, maps are provided by remote services (OpenStreet Map, Yahoo Maps). The application was designed in term of an abstract service. During the development of the system several implementation of this service were developed. Thanks to OSGi, the application dynamically reacts to the availability of such implementations, and the users can choose one map provider among the set of available providers. This small screen cast illustrates this substitution.
Being able to substitute components by others components brings a great flexibility. It is then easy to adapt the system to others domain or requirements as well as to update the existing system. Such property will not be possible without a good service-based design.
Mobility is one the key challenge for innovative applications. Being able to cross the company compound is just awesome and opens new markets. However, this is still challenging despite the proliferation of new smart mobile phones.
This post and the previous one presents how akquinet uses service-oriented architectures to build mobile solution in a very elegant and efficient way. Feel free to contact us or post a comment if you have any question.