Developing Mobile Application Framework By Using RESTFul Web Service with JSON Parser Ei Ei Thu,Than Nwe Aung University of Computer Studies Mandalay (UCSM), Mandalay, Myanmar. eieithuet@gmail.com, mdytna@gmail.com Abstract. Nowadays, mobile devices offer new ways for users to access information. Web service can be built by using two separate ways: standard SOAP based and RESTFul web service. This paper presents the motivations and technical choices for creating RESTFul API integrated with mobile application. This application framework easy to deploy, test, maintain and rely on scalable and easily integrated infrastructure. And also explain why choose REST rather than SOAP and why choose JSON parser rather than XML. Keywords: Web Service, RESTFul, JSON 1 Introduction Mobile web service provisioning is substantially expanding on the concept of anywhere, anytime and on any device to a new paradigm ubiquitous mobile computing. It is used to improve access to meaningful, quickly and required information and content through mobile web services. Many of the problems of mobile web services can be solved by targeting the distributed nature and isolated deployment of mobile applications. One of the most promising ways to create viable web services for mobile devices is to add extra intelligence to the web services, both on the web service provider and the web service consumer. Mobile devices with their hardware limitations are generally not suitable to use Internet Services via Web Pages. The separations of user interface and service logic offered by Web Services are a new chance to bring internet services to mobile devices. Applications running on mobile devices, providing access to Web Services, can thereby be adapted to the specific device capabilities. To integrate Web Service technologies in mobile devices one has to consider the restrictions of these devices and the mobile communication system. Mobile Technology has now come up with Libraries in Hand trend. Our librarians are in move to determine how these devices are affecting information access and ensure that they are communicating with patrons and providing web content in the most appropriate and effective ways. Our Librarians must be prepared to take this challenge and put his efforts to increase the market and demand for mobile access to personalized facts and information anytime, anywhere on one s own handheld device. Web Services can be classified into two main categories: RESTFul and SOAP-based Web Services. This classification is based on the architectural style used
in the implementation technology. SOAP stands for Simple Object Access Protocol. It is an object oriented technology that defines a standard protocol used for exchanging XML-based messages. REST stands for Representational State Transfer; it is a resource oriented technology that consists of a set of design criteria that define the proper way for using web standards such as HTTP and URIs. Although REST is originally defined in the context of the Web, it is becoming a common implementation technology for developing web services. RESTFul Web Services are implemented with Web standards (HTTP, XML and URI) and REST principles. REST principles include addressability, uniformity, connectivity and stateless. RESTFul Web Services are based on uniform interface used to define specific operations that are operated on URL resources [3]. The rest of the paper is organized as follow: In section 2, related works are introduced; this includes introductions to XML vs. JSON, web services in mobile devices and some android based applications. Section 3 briefly introduces multi-tire application of Web API, RESTFul Web Service and JSON parser. Section 4 presents overview system architecture and implemented screen shots. Finally, section 5 concludes this work. 2 Related Works Varun Goyal [7], This paper described various aspects of web services in mobile devices, i.e. what are the limitations of mobile devices, connectivity issues, how to optimize the web service, comparing different protocols and frame work that can be used, performance analysis of SOAP and RESTFul web services, various libraries that can be used to create web services. Anil Dudhe, etc. [4] analyzed the performance of SOAP and RESTFul web service in cloud environment. They have run and collected the results of REST and SOAP web service on Google App Engine 1.8.2. They showed that REST web services take less time for responding data by comparing the tested results. Feda AlShahWan, etc. [5] showed that using a REST-based framework leads to a better performing offloading behavior, compared to SOAP-based mobile services. Distributed mobile services based on REST consume fewer resources and achieve better performance compared to SOAP based mobile services. Dunlu Peng, etc. [6] investigated how to employ JSON as the data exchange format for web service applications. They compared with XML, using JSON-style data for exchanging can improve the performance of web service applications. Their experimental results showed that JSON performs better than XML in being parsed, being serialized and being deserialized. Isak Shabani, Besmir Sejdiu [8] implemented MyParking android application that helps users to find parking lots depending on their location. This application is executed in Android mobile platform and which accesses the SOAP Web services server. Sarawut Markchit [9] proposed offering library resources system for web-based and mobile application with SOAP web services. Author developed web-based application with ASP.NET and mobile application with HTML5 and JQuery.
3 Web Service Technology A web service is a method of communication between two or more electronic devices over the World Wide Web. W3C defines web services as a software system designed to support interoperable machine-to-machine communication over a network. It has a network described in a machine process able format. Other systems can communicate with the web service in a manner recommended by its description using SOAP messages, typically transferred using HTTP with an XML or JSON serialization in conjunction with other Web-related standards [10]. Web services are platform neutral and generally text based which can developed, run and accessed on heterogeneous technologies. So they are interoperable. 3.1 Web API Web API is a development in Web services where emphasis has been moving to simpler representational state transfer (REST) based communications. RESTFul APIs may not require XML based Web service protocols (SOAP and WSDL) to support their interfaces. RESTFul web APIs or RESTFul web service is a web API implemented using HTTP and basis of REST. RESTFul API separates user interface involved from data storage. It improves flexibility of interface over multiple platforms and simplifies server components by making them stateless. Each request from client comprises all the state information and server does not hold client context in the session. Figure 1 illustrates the consuming web service for multi-tire application with application server and database server. Fig. 1. Multi-tire application with application server and database server
3.2 RESTFul Web Service REST is a software application architecture modeled after the way data is represented, accessed, and modified on the web. It is an architectural style for distributed hypermedia systems. In the REST architecture, data and functionality are considered resources, and these resources are accessed using Uniform Resource Identifiers (URIs), typically links on the web. The resources are acted upon by using a set of simple, well defined operations. The REST architecture is fundamentally client-server architecture, and is designed to use a stateless communication protocol, typically HTTP. In the REST architecture, clients and servers exchange representations of resources using a standardized interface and protocol. These principles encourage REST applications to be simple, lightweight, and have high performance. RESTFul web services are web applications built upon the REST architecture. They expose resources (data and functionality) through web URIs, and use the four main HTTP methods to create, retrieve, update, and delete resources. RESTFul web services typically map the four main HTTP methods to the so-called CRUD actions: create, retrieve, update, and delete [1]. Figure 2 shows the RESTFul web services architecture. Fig. 2. RESTFul Web Service Architecture 3.3 JSON (JavaScript Object Notation) Parser For the past few years, XML web services have dominated the arena for web services, as XML was touted as the ubiquitous medium for data exchange. However, using XML as the medium for data payload suffers from the following problems: XML representation is inherently heavy. The use of opening and closing tags add a lot of unnecessary weight to the payload. XML representation is difficult to parse. While on the desktop, the DOM (Document Object Model) and SAX (Simple APIs for XML) are the two commonly used method for parsing XML Documents; on the mobile platform using DOM and SAX are very expensive, both computationally and in terms of memory requirements.
In recent years, another data interchange format has been gaining in popularity - JSON, or JavaScript Object Notation. JSON is a lightweight, text-based, languageindependent data interchange format. It was derived from the ECMAScript (European Computer Manufacturers Association) programming language, but is programming language independent. JSON defines a small set of structuring rules for the portable representation of structured data. Like XML, JSON is a text-based open standard for representing data, and it uses characters such as brackets "[{]}", colon ":" and comma ",", to represent data. Data are represented using simple key/value pairs, and more complex data are represented as associative arrays. JSON is agnostic about numbers. In any programming language, there can be a variety of number types of various capacities and complements, fixed or floating, binary or decimal. That can make interchange between different programming languages difficult. JSON instead offers only the representation of numbers that humans use: a sequence of digits. All programming languages know how to make sense of digit sequences even if they disagree on internal representations. That is enough to allow interchange [2]. The following figure 3 shows the applying JSON parser in proposed work. 4 System Analysis Fig. 3. Applying JSON Parser in Proposed Application System consists of two mobile application modules: Library management module and University student and staff information management module. Student and staff information module can perform CRUD (create, read, update, delete) action for staff and student information. This application intends to use for university student
affair and manage department. Library management module offers to support for librarian, student, teacher and staff. In this module, librarian also performs CRUD action for e-book and can also create unique user ID for user. Firstly, the user needs to sign up to use the library application. This library module will automatically check the signing up user is teacher or student or staff by accessing information from student and staff manage module. And then the system will automatically create unique user ID according to their occupation (teacher, student, and staff). Because the librarian needs to classify access permission for each user. User will be access e- book according to their permission. So this application framework can support even librarian in offline. And also provide interoperability and transparently exchanging information through RESTFul web service by using proposed two application module. These two applications can easily integrate to university s existing wireless network by changing http protocol. So that this proposed work can provide efficient and usable mobile network infrastructure for university environment. Figure 4 shows the proposed mobile network infrastructure. 4.1 Testing Fig. 4. Mobile Application Network Infrastructure The proposed mobile framework developed with java based android programming language for mobile app and server side implemented with RESTFul technology based java servlet programming language. The proposed work implement RESTFul web service and deployed on Apace Tomcat 7.0 web server. And two mobile applications implemented using Android Developer Tool (ADT) bundle, Android 4.2.2-API level 18 and runs on Android Emulator. To parse the multimedia and text format data through web service using gson-2.2.4 and apache-mime4jcore.the following figure 5 shows the testing two mobile apps on android emulator.
Fig. 5. Testing on Android Emulator 5 Conclusion The processing capabilities of mobile devices have increased enormously in the recent years. This paper aims to develop the RESTFul web service to access e-book from university library with mobile network framework. The proposed system implemented android based mobile library infrastructure and tested successfully using RESTFul web service provisioning concept. The proposed work can support efficient mobile library framework with usability and interoperate-ability. At the present, the proposed mobile network framework includes two application modules; in the future this framework can easily integrate with other application module. And also, the proposed work can extend as a mobile learning framework within university and can also implement with other web service technology and other parser. References 1. Bohara, Mishra, M.:RESTFul Web Service Integration using Android Platform. M.H. DAIICT, Gandhinagar, India, pages 1-6, July (2013) 2. ECMA-262 (ISO/IEC 16262), ECMAScript Language Specification, 3 rd edition (October 2013) 3. Hatem Hamad, Motaz Saad, Ramzi Abed.:Performance Evaluation of RESTful Web Services for Mobile Devices. Computer Engineering Department, Islamic University of Gaza, Palestine. International Arab Journal of e-technology, Vol.1, No.3, January (2010) 4. Anil Dudhe, S.S.Sherekar.:Performance Analysis of SOAP and RESTFul Mobile Web Service in Cloud Environment. Department of Advanced Software and Computing Technologies, Pune, India, International Journal of Computer Applications, (2014)
5. Feda AlShahWan, Klaus Moessner.: Evaluation of Distributed SOAP and RESTFul Mobile Web Services. Centre for Communications Systems Research, University of Surrey, UK, International Journal on Advances in Networks and Services, (2010) 6. Dunlu Peng, Lidong CAO, Wenjie XU.: Using JSON for Data Exchanging in Web Service Applications. School of Optical-Electrical and Computer Engineering, University of Shanghai for Science and Technology, China, Journal of Computational Information Systems, (2011) 7. Varun Goyal.: Web Services in Mobile Devices. Computer Science Department, Rochester Institute of Technology, (2013) 8. Isak Shabani, Besmir Sejdiu.: Consuming Web Services on Android Mobile Platform for Finding Parking Lots. University of Prishtina, Republic of Kosovo, IJACSA, Vol.6, No.2, (2015) 9. Sarawut Markchit.:Offering Library Resources through Web-site and Mobile Systems with Web Services for Central Library Suratthani Rajabhat University. Faculty of Science and Technology, Suratthani Rajabhat University, Thailand, World Journal of Computer Application and Technology 3(1), (2015) 10. Web Service Glossary. W3C. Retrieved (April 2015)