Assignment 2. Start: 15 October 2010 End: 29 October 2010 VSWOT. Server. Spot1 Spot2 Spot3 Spot4. WS-* Spots

Similar documents
Distributed Systems 2017 Assignment 2

PROCE55 Mobile: Web API App. Web API.

IT6503 WEB PROGRAMMING. Unit-I

Develop Mobile Front Ends Using Mobile Application Framework A - 2

RESTful Web Service Composition with JOpera

Service oriented Middleware for IoT

SERVICE-ORIENTED COMPUTING

Getting started with OWASP WebGoat 4.0 and SOAPUI.

Composer Help. Web Request Common Block

Delivery Options: Attend face-to-face in the classroom or via remote-live attendance.

Web Mechanisms. Draft: 2/23/13 6:54 PM 2013 Christopher Vickery

XML Web Service? A programmable component Provides a particular function for an application Can be published, located, and invoked across the Web

SUN. Java Platform Enterprise Edition 6 Web Services Developer Certified Professional

XML Processing & Web Services. Husni Husni.trunojoyo.ac.id

02267: Software Development of Web Services

Delivery Options: Attend face-to-face in the classroom or remote-live attendance.

Managing Remote Medical Devices Through The Cloud. Joel K Young SVP of Research and Development & CTO Digi International Friday, September 9 11:30AM

Consumption and Composition of Web Services and non web services

WWW, REST, and Web Services

The Backend of OE Mobile in OpenEdge Mike Fechner, Consultingwerk Ltd. PUG Challenge Americas, June 2013

Services Web Nabil Abdennadher

JBoss SOAP Web Services User Guide. Version: M5

Distributed Systems Recitation 2. Tamim Jabban

Introduction to RESTful Web Services. Presented by Steve Ives

Aim behind client server architecture Characteristics of client and server Types of architectures

Copyright 2014 Blue Net Corporation. All rights reserved

What's New in ActiveVOS 7.1 Includes ActiveVOS 7.1.1

1 Getting Familiar with Datagrams (2 Points)

GeneXus for Smart Devices course - Architecture of Smart Device Applications

Lab Assignment 3 for ECE374

smap a Simple Measurement and Actuation Profile for Physical Information

An Overview of. Eric Bollens ebollens AT ucla.edu Mobile Web Framework Architect UCLA Office of Information Technology

DEVELOPER GUIDE PIPELINE PILOT INTEGRATION COLLECTION 2016

BEAAquaLogic Enterprise Repository. Automation for Web Services Guide

WebSphere MQ Update. Paul Dennis WMQ Development 2007 IBM Corporation

Webspeed. I am back. Enhanced WebSpeed

AppSpider Enterprise. Getting Started Guide

02267: Software Development of Web Services

JAVA COURSES. Empowering Innovation. DN InfoTech Pvt. Ltd. H-151, Sector 63, Noida, UP

Using the Cisco ACE Application Control Engine Application Switches with the Cisco ACE XML Gateway

INFOH-511 WEB SERVICES. LECTURE 1: Introduction

The SOAPbox User s Guide

Introduction to Web Services & SOA

Programming Web Services in Java

REST Easy with Infrared360

We are ready to serve Latest Testing Trends, Are you ready to learn? New Batch Details

Nasuni Data API Nasuni Corporation Boston, MA

AIM Enterprise Platform Software IBM z/transaction Processing Facility Enterprise Edition 1.1.0

CNIT 129S: Securing Web Applications. Ch 3: Web Application Technologies

Creating Web Server in Android Mobile and Easy Serving of Information to Clients

Introduction to Worklight Integration IBM Corporation

Web Services in Cincom VisualWorks. WHITE PAPER Cincom In-depth Analysis and Review

Learning vrealize Orchestrator in action V M U G L A B

edocs Home > BEA AquaLogic Service Bus 3.0 Documentation > Accessing ALDSP Data Services Through ALSB

Oracle. Exam Questions 1z Java Enterprise Edition 5 Web Services Developer Certified Professional Upgrade Exam. Version:Demo

Introduction... 4 I-Learn Introduction (Video)... 5 A Successful Start in Pathway (Video)... 6

Building the Web of Things: frameworks and tools for fast prototyping Web-based physical mashups

Lesson 14 SOA with REST (Part I)

Postman User Guide. Document Reference: July Version: 2

Schema Validation Errors While Parsing Weblogic

Migrating traditional Java EE applications to mobile

Spring Web Services Tutorial With Example In

Immigration and Reform Collection System submission Instructions

CMX Dashboard Visitor Connect

How A Website Works. - Shobha

Communicating with a Server

Assignment 1 Mobile client application

General. Analytics. MCS Instance Has Predefined Storage Limit. Purge Analytics Data Before Reaching Storage Limit

Automation for Web Services

Software Architecture

REST in a Nutshell: A Mini Guide for Python Developers

Web-APIs. Examples Consumer Technology Cross-Domain communication Provider Technology

IBM Image-Analysis Node.js

Web Services & Axis2. Architecture & Tutorial. Ing. Buda Claudio 2nd Engineering Faculty University of Bologna

BYU-Idaho Online Knowledgebase

Creating a REST API which exposes an existing SOAP Service with IBM API Management

Distributed Systems Recitation 2. Tamim Jabban

Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Active Endpoints. ActiveVOS Platform Architecture Active Endpoints

04 Webservices. Web APIs REST Coulouris. Roy Fielding, Aphrodite, chp.9. Chp 5/6

Nick Terkay CSCI 7818 Web Services 11/16/2006

Appendix C WORKSHOP. SYS-ED/ Computer Education Techniques, Inc.

Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Apache Axis2. XML Based Client API

Have you signed up? GO Have you searched for inspiration? GO Have you created a map (survey)? GO Have you collected data? GO

What is REST? ; Erik Wilde ; UC Berkeley School of Information

RESTful Web Services. 20-Jan Gordon Dickens Chariot Solutions

Lecture 13 IoT and Augmented Reality

Drupal Cloud Getting Started Guide Creating a Lab site with the MIT DLC Theme

Homework 9: Stock Search Android App with Facebook Post A Mobile Phone Exercise

Timelog System on Android OS

Creating an Online Catalogue Search for CD Collection with AJAX, XML, and PHP Using a Relational Database Server on WAMP/LAMP Server

Rob Weir, IBM 1 ODF and Web Mashups

Introduction to creating mashups using IBM Mashup Center

MSc. Software Engineering. Examinations for / Semester 1

Understanding RESTful APIs and documenting them with Swagger. Presented by: Tanya Perelmuter Date: 06/18/2018

REST in Peace Mastering the JSDO with a Dynamic ABL backend. Mike Fechner, Consultingwerk Ltd.

Distributed Systems Principles and Paradigms. Chapter 12: Distributed Web-Based Systems

Lab assignment 1. TI /18;; ti1506-students.slack.com

Introduction to Web Services & SOA

Transcription:

Assignment 2 Start: 15 October 2010 End: 29 October 2010 In this assignment you will learn to develop distributed Web applications, called Web Services 1, using two different paradigms: REST and WS-*. The Representational State Transfer (REST) is a style of software architecture for implementing Resource Oriented Architectures (ROAs). HTTP (1.1) 2, the application protocol of the Web, is an implementation of the REST principles. Distributed RESTful applications can be developed using the HTTP protocol using as a universal interface for interacting with services (called resources ) on the Web. Such applications make use of HTTP verbs (GET, POST, PUT, DELETE, etc.) and mechanisms (e.g., URLs, HTTP Content Negotiation). Furthermore, REST defines how to serve different formats (e.g., HTML, JSON, XML) for a given resource depending on the clients needs. WS-* services, sometimes called Big Web services, describe a set of XML-based standards (e.g., WSDL, SOAP, UDDI) that can be used to implement Service Oriented Architectures (SOAs). Rather than using HTTP as an application protocol, WS-* services use it as a transport protocol and define a number of additional layers to encapsulate distributed services. In this assignment you will implement a mobile phone application that gathers data from services provided over the Web by Wireless Sensor Nodes (SunSPOTs 3 ). The SunSPOTs expose their services (e.g., temperature, light, etc.) through two different interfaces: REST based and WS*- based. Figure 1 illustrates the setup. All subtasks should be accessible through separate buttons. Mobile phone 1. HTTP Request HTTP Basesta&on1: Web Server VSWOT Server 2. SOAP Request WS Basesta&on2: WS * App Server Spot1 Spot2 Spot3 Spot4 RESTful Spots WS-* Spots Figure 1: The mobile phone accesses the sensor values through HTTP or SOAP WS-* requests. 1 Experimenting with RESTful Web Services The SunSPOTs Spot1 and Spot2 deliver the sensor values through a RESTful interface. Open your browser and navigate to: http://vswot.inf.ethz.ch:8081/sunspots/. From there you 1 http://en.wikipedia.org/wiki/web_service 2 http://www.w3.org/protocols/rfc2616/rfc2616.html 3 http://sunspotworld.com/ 1

can explore the HTML representation of the RESTful SunSPOTs. Browse and experiment with the SunSPOTs Spot1 and Spot2 and look at the sensor values they offer through this Web interface (e.g., temperature, light, acceleration). You will write an Android application that requests the temperature measurement from Spot1 and displays the value on the screen. Implement each subtask in a new function and provide an additional button to perform the action. RESTful Web services can be invoked using the HTTP protocol. Several different libraries can be used to create HTTP calls. In this assignment, we start by making a raw request without the use of any external library. Open a TCP connection to vswot.inf.ethz.ch (port 8081) and make an HTTP GET request to obtain the temperature information of Spot1. Display the raw response on the screen. Hint: Use the Socket class in the java.net library. To send and receive data use the getinputstream() and getoutputstream() methods of the Socket class and read and write to the corresponding InputStream and OutputStream. For the HTTP protocol have a look at http://www.elektronik-kompendium.de/sites/net/0902231.htm or google for other howtos. Now use the Apache HTTP Client library (import org.apache.http.*, etc., or another HTTP Client/REST library of your choice) when placing an HTTP request to get the temperature resource from Spot1. Display the raw response on the screen. You probably noticed that, so far, we get HTML responses back from the SunSPOTs. As mentioned before, a RESTful architecture can offer several representations of the same resource. To get another representation we use the HTTP Content Negotiation mechanism. Set the Accept header of your HTTP request to application/json. Instead of an HTML page, the Web server will return a JSON file containing the temperature information. JSON is a lightweight version of XML which is often used in Web-mashups and RESTful interfaces because it can directly be translated to JavaScript objects. Display the raw JSON response. Parse the retrieved JSON response to extract the temperature value. Display this value only on the screen. Hint: You can find several libraries on the Web to parse JSON for many languages 4. Android already includes org.json.* so you can directly instantiate and work with these JSON classes (i.e., org.json.jsonarray and org.json.jsonarray). 2 Experimenting with WS-* Web Services Spot3 and Spot4 offer a WS-* Web Service interface. Start by opening your browser and navigating to: http://vswot.inf.ethz.ch:8080/webservicesapp/sunspotswsservice. From there you can access the WSDL (Web Services Description Language) description of the offered functionality. Have a closer look at the WSDL interface and try to understand its content and what it provides as you did for the RESTful version. Hint: Try to navigate to the schema specified in the WSDL file. 4 http://json.org 2

(report) WS-* Web services can be invoked by first getting their WSDL and then sending SOAP messages to the Web service end-point. A WSDL contains a description of these SOAP messages and end-points. Describe step by step how you would proceed to invoke a Web service using the java.net library only, as you did for RESTful Web Services. You do not need to implement it. Include this description in the report you submit. Create a new application and use a WS-* library to make a WS-* call from the Android device. Implement the subtasks with a button and function each. Use the ksoap2 library patched to work on Android 5 (or another WS-* library of your choice) to get the temperature data from Spot3. First, display the raw SOAP response on the screen. Hint: Check out http://code.google.com/p/ksoap2-android/wiki/links for help. When using WS-* services, messages are always represented using XML over the wire and then unmarshalled on the client side into platform specific objects (SOAPObjects in the case of ksoap2). Find out how to get the XML containing the temperature and simply display it as raw XML on your Android phone. Parse the retrieved SOAPObject (or XML response) to extract the temperature value. Display this value on the screen. Feel free to parse the value using a library. 3 Assessing Web Service Technologies Imagine that you are an IT consultant who needs to evaluate these two technologies, REST and WS-*, for working with embedded devices. Answer the questions at https://spreadsheets.google.com/viewform?hl=en&pli= 1&formkey=dFQ4WGM2Tkt2T0s0dWlCOXAwVXE0MUE6MQ#gid=0. This part of the assignment is to be done individually, so do not forget to state your ETH login name at the beginning of the form. 4 Cloud Services Use the Google Visualization APIs to display the sensor measurements you retrieved with your phone. You can read more about the specific display methods at: http://code.google.com/apis/ visualization/documentation/gallery.html. Pick your favorite visualization scheme. Send the measured values to the service and display the visualization image on the phone s screen. You may choose between REST and WS-* APIs for accessing the sensors. 5 http://code.google.com/p/ksoap2-android/ 3

5 Your Phone as a Server (+report) Similar to the SunSPOT sensor node, your phone can also act as a sensing device. Reuse your implementation in Assignment 1 and provide two sensors and two actuators through a REST server running on your mobile phone. Implement the server in a similar manner to the Socket client in Task 1, only now make use of ServerSocket. Wait for and accept incoming connections and then handle the requests according to the HTTP protocol. You will have to pick a port greater than 1024 (e.g., 8081). Hint: You should reuse your Service from Assignment 1. Also, your server does not have to be RFC-compliant. Just implement a minimal version that works with your browser (e.g., header options can be ignored). Run the Android 2.2 Wi-Fi Hotspot app and connect your laptop to the phone. Use your laptop s browser to test the functionality of your Android Web server. Describe your chosen architecture and control flow to fulfill client requests in the report, even if you might not be able to get the server running. The report has to be done individually. 6 Enhancements (+report) Pick at least one of the following and describe the corresponding code in the report: Implement a WS-* request by hand in a similar way to the REST request using raw sockets. Improve the Web server in Task 5 with multi-threading and additional services. The server should be able to accept and answer requests form several clients at once. Instead of using the Google Visualization API implement local visualization on your phone. Deliverables The following deliverables have to be submitted by 9:00am on October 29: 1. code.zip You should create a zip file containing the Eclipse projects created in this assignment. 2. report.[txt,pdf,doc,docx] Document explaining the architecture and control flow of your Web service invocation, Android Web Server, and enhancements. Feel free to make use of diagrams. The text should not exceed one page. 3. form for task 3 Technology-related questions at https://spreadsheets.google.com/ viewform?hl=en&pli=1&formkey=dfq4wgm2tkt2t0s0dwlcoxawvxe0mue6mq. 4. feedback form Tell us your experience with learning the REST and WS-* technologies: https://spreadsheets1.google.com/viewform?hl=en&formkey= dgqzovpgzgrbrw9iemnkb0hqbdnqzle6mq. 4

Marks The distribution of marks is as follows (partial solutions will be marked individually): Tasks 1-3 and report: 4.0 Tasks 1-5 and report: 5.0 All tasks and report: up to 6.0 Submission Code and report must be uploaded at http://www.vs.inf.ethz.ch/edu/vs/ submissions/. The submission script will not allow you to submit any part of this exercise after the deadline. However, you can re-submit as many times as you like until 9:00am on October 29. 5