Download presentation
Presentation is loading. Please wait.
1
1 HyCon Framework Overview Frank Allan Hansen and Bent Guldbjerg Christensen ! Run this presentation in presentation mode to watch animations.
2
2 Agenda Introduction to Web services HyCon platform and architecture Implementing services with the framework
3
3 Old School Web Services Web services, in the general meaning of the term, are services offered on the Web. http://www.google.com/search?q=Webservice&start=0&start=0&... Google Web serverhttp Html document
4
4 Web services Web services, in the general meaning of the term, are services offered on the Web. In a typical Web services scenario, a business application uses the SOAP protocol over HTTP to send a request to a service at an URL. The service receives the request, processes it, and returns a response.
5
5 Web Services Programmatic interfaces Access and execute remote objects –Well-defined service interface Request Response XML –WSDL Web Services Description Language –SOAP Simple Object Access Protocol –UDDI Universal Description, Discovery, and Integration Platform independent
6
6 WSDL Web Services Description Language –Ariba, IBM and Microsoft –WSDL is a 1.2 W3C working draft A WSDL document describes a network services: –Operations –Arguments and types (xsd) –Service binding
7
7 Creating WSDL Documents WSDL documents can be hand-written Generated by tools –JWSDP: Remote java interface Information about the service container –JWSDP includes ant tasks for generating WSDL documents and deploying the services Ex.: http://fahbentor.daimi.au.dk:15342/contextit-jaxrpc/xlink?WSDL http://fahbentor.daimi.au.dk:15342/contextit-jaxrpc/xlink?WSDL
8
8 SOAP Simple Object Access Protocol –W3C recommendation http://www.w3.org/TR/ soap/ http://www.w3.org/TR/ soap/ Platform independent (CORBA, RMI, DCOM,…are not)
9
9 SOAP
10
10 SOAP JWSDP –WSDL >> Java stub classes –Java classes handles SOAP marshalling/unmarshalling Remote communication with services
11
11 Web Services recapture Service are described with WSDL documents –Generated from the service interface Client applications communicate with service through SOAP messages –Classes generating and parsing objects to and from SOAP are generated from WSDL documents
12
12 The HyCon Framework
13
13 Overview HyCon –Platform –Components and services –XSLT servlet Chain –Sensors A practical guide to the HyCon framework –Step by Step building of a Web service
14
14 HyCon Requirements Context-aware hypermedia framework –Extensible data model capable of representing object or entities and their context –Hypermedia model integrated in the data model –Services for accessing the data: Object, context, and hypermedia structures –Services should be useable from many different (mobile) devices –Devices should support capturing of sensor data used to measure the context
15
15 HyCon Data model
16
16 The HyCon Architecture
17
17 The HyCon Server Architecture
18
18 The HyCon Architecture 4 Layers: Storage, Service, Terminal, Sensor The Storage layer is implemented on a relational database (MySQL) The basic functionality in the Service layer is implemented by components which is used in Services (Servlets/Web services) The Terminal layer implements components and applications that communicates with the Server layer The Sensor layer is defined as interfaces for sensor implementations
19
19 XSLT servlet chain The servlet interfacet is build around a servlet filter chain, with aXSLT-engine in one end and Service servlets in the other This requires all services to produce XML output
20
20 Components
21
21 Components (Annotation Component)
22
22 Using Components: Check List 1.Create local interface 2.Implement component 3.Implements services (that use the component(s)) 4.Create remote service interfaces 5.…and implement client applications
23
23 Data model and the servlet chain
24
24 HyCon Data model
25
25 AbstractObject
26
26 Object
27
27 Link
28
28 The XSLT servlet chain
29
29 XSLT Handler
30
30 XSLT Handler
31
31 XSLT style map
32
32 AnnotationServlet
33
33 Register a servlet in the container: WebInf.xml
34
34 Using Servlets and the XSLT Chain: Check List 1.Create servlet (a service based on components) 2.Register the servlet in WebInf.xml 3.Implement the stylesheet –Or use an exsisting one eg. ”raw” 4.Register the stylesheet 5.Map the stylesheet to a key/user-agent in the Style map 6.…and implement client applications
35
35 Sensors
36
36 Sensors Sensors in HyCon is defined by an interface Sensors must implement a –Pull based interface –Event based interface Sensors’ implementation is undefined in the framework –Local sensors (Bluetooth GPS) –Network based sensors (Bluetooth position)
37
37 Sensor interface
38
38 Sensor interface (2)
39
39 Using a sensor (GPSEmtagBluetooth)
40
40 Step-by-step guide to implementing a service
41
41 A practical guide to the HyCon framework Development environment XLink Service bottom-up –XLink data structure –XLink data model –XLink component –XLink Web service WSDL interface –XLink service in HyconExplorer –Trails as an example of an XLink structure Scripts with Ant Distribution with Webstart
42
42 Development environment HyCon is implemented in Java. Eclipse is used as the development environment (better than Emacs...). The source code is shared through a cvs-repository.
43
43 XLink Service bottom-up The framework includes a number of services which provide methods for retrieving and storing certain data structures on the server –Location –Annotation –eBag –Map –Slide –XLink As an example of a service implementation we will look at the XLink service.
44
44 XLink Service bottom-up: Data structure Data structure: XLink –Et Link contains references to resources (objects) in the data model. –Et Link may contain Arc-objects, that specify associations among resources in the Link.
45
45 XLink Service bottom-up: Data model (runtime)
46
46 XLink Service bottom-up: Component (interface) The component which encapsulates the functionality of the Xlink service is first described by an interface: –create new Link in the Storage layer –Retrieve Link from the Storage layer –Delete Link from the Storage layer –...
47
47 XLink Service bottom-up: Component Implementation of the Xlink components interface
48
48 XLink Service bottom-up: Web service (server) To provide the functionality of the Xlink component over the internet we use the Tomcat container and the Web service (WSDL). We could also have use a Servlet interface (CGI). –The Servlet interface (CGI) is simple and well-known from Web programming - parameters is sent as pairs of strings. –The Web service interface (WSDL) is built on top of CGI, and support more abstractions - parameters and results are sent as via SOAP (Simple Object Access Protocol).Simple Object Access Protocol A WSDL (Web Service Definition Language) file, contains a description of a Web service – that is, data types of parameters and results of calling its methods.Web Service Definition Language By creating a Remote Java interface in a service for the component (~10 lines, which is quite similar to the original component interface), JWSDP (Java Web Services Developer Pack ) can generate the WSDL-file (~250 lines).Java Web Services Developer Pack WSDL for the XLink Web service: –http://fahbentor.daimi.au.dk:15342/contextit-jaxrpc/xlink?WSDLhttp://fahbentor.daimi.au.dk:15342/contextit-jaxrpc/xlink?WSDL
49
49 XLink Service bottom-up: Web service (WSDL) WSDL for the XLink Web service:
50
50 XLink Service bottom-up: Webservice (client) To use a Web service from a (client) application, one should call the methods defined in the WSDL-file. Ie. Parameters have to be translated from Java objects to SOAP elements and send to a specific socket, and the result is returned as SOAP elements, which has to be translated to Java objects. Luckily JWSDP can generate the client stub code, which handles marshalling. –The stub code is generated from the WSDL-file!
51
51 XLink Service bottom-up: Trails in HyConExplorer
52
52 Scripts with Apache Ant To ease the process of generating eg. the WSDL-files and stub code, we use Ant. –Ant is useful for: starting a program, copy files, delete files, sign jars etc., which are all inherent to development (next generation make). –Ant-files (Ant-scripts) include tasks, and are described in XML. –Ant is integrated in Eclipse, so changes in ”the bottom” of eg. the XLink Web servicen, which requires recompilation and regeneration of multiple files can be done with a single click on the Ant-script.
53
53 Snippet from Ant-script, that generates stub code
54
54 Distribution with Java Webstart To run, eg., HyConExplorer outside Eclipse, the Java classes and packages which comprise the application or is used by the application must be available... An elegant way to distribute a Java program is by using Java Webstart. The program and packages are made available on a Web server, and a JNLP-file (Java Network Launching Protocol), how to get the program and the programs access rights (disk access, network access etc.)Java Network Launching Protocol –Webstart automatically checks for new versions of the program before start => Easy update of applications –Webstart is installed with Java. Url to JNLP-file for HyConExplorer: –http://fahbentor.daimi.au.dk:15342/contextit/ce.jnlphttp://fahbentor.daimi.au.dk:15342/contextit/ce.jnlp
55
55 JNLP-file, HyConExplorer
56
56 Recapture Questions ?
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.