A RESTful Web Service Interface to the ATLAS COOL Database Shaun Roe 1A RESTful Web Service... (Shaun Roe, Atlas)CHEP'09 Prague.

Slides:



Advertisements
Similar presentations
Other Web Application Development Technologies. PHP.
Advertisements

12 October 2011 Andrew Brown IMu Technology EMu Global Users Group 12 October 2011 IMu Technology.
1 CGICGI Common Gateway Interface Server-side Programming Lecture.
Copyright 2004 Monash University IMS5401 Web-based Systems Development Topic 2: Elements of the Web (g) Interactivity.
Session 6 Server-side programming - ASP. An ASP page is an HTML page interspersed with server-side code. The.ASP extension instead of.HTM denotes server-side.
15 Chapter 15 Web Database Development Database Systems: Design, Implementation, and Management, Fifth Edition, Rob and Coronel.
B.Sc. Multimedia ComputingMedia Technologies Database Technologies.
The Application Layer Chapter 7. Electronic Mail Architecture and Services The User Agent Message Formats Message Transfer Final Delivery.
INTRODUCTION The Group WEB BROWSER FOR RELATION Goals.
Multiple Tiers in Action
1 The World Wide Web Architectural Overview Static Web Documents Dynamic Web Documents HTTP – The HyperText Transfer Protocol Performance Enhancements.
Peoplesoft: Building and Consuming Web Services
LHCbPR V2 Sasha Mazurov, Amine Ben Hammou, Ben Couturier 5th LHCb Computing Workshop
Lecture 3 – Data Storage with XML+AJAX and MySQL+socket.io
Ajax, XSLT and SVG Displaying ATLAS conditions data with new web technologies Shaun Roe 1Ajax, XSLT & SVG (Shaun Roe, Atlas)CHEP'09 Prague.
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
Introduction to PHP and Server Side Technology. Slide 2 PHP History Created in 1995 PHP 5.0 is the current version It’s been around since 2004.
Simple Web Services. Internet Basics The Internet is based on a communication protocol named TCP (Transmission Control Protocol) TCP allows programs running.
Chapter 1: Introduction to Web
Server-side Scripting Powering the webs favourite services.
Basics of Web Databases With the advent of Web database technology, Web pages are no longer static, but dynamic with connection to a back-end database.
Introduction to InfoSec – Recitation 7 Nir Krakowski (nirkrako at post.tau.ac.il) Itamar Gilad (itamargi at post.tau.ac.il)
Chapter 16 The World Wide Web. 2 The Web An infrastructure of information combined and the network software used to access it Web page A document that.
Designing and Implementing Web Data Services in Perl
1 PHP and MySQL. 2 Topics  Querying Data with PHP  User-Driven Querying  Writing Data with PHP and MySQL PHP and MySQL.
Is Apache CouchDB for you?
WEB API: WHY THEY MATTER ECOL 453/ Nirav Merchant
Copyright © Orbeon, Inc. All rights reserved. Erik Bruchez Applications of XML Pipelines XML Prague, June 16 th, 2007.
Python and REST Kevin Hibma. What is REST? Why REST? REST stands for Representational State Transfer. (It is sometimes spelled "ReST".) It relies on a.
The Document Object Model. The Web B.D, A.D. They aren’t web pages, they’re document objects A web browser interprets structured information. A server.
HTML. Principle of Programming  Interface with PC 2 English Japanese Chinese Machine Code Compiler / Interpreter C++ Perl Assembler Machine Code.
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
PHP and MySQL CS How Web Site Architectures Work  User’s browser sends HTTP request.  The request may be a form where the action is to call PHP.
Presentation Topic: XML and ASP Presented by Yanzhi Zhang.
Putting it all together Dynamic Data Base Access Norman White Stern School of Business.
Top Five Web Application Vulnerabilities Vebjørn Moen Selmersenteret/NoWires.org Norsk Kryptoseminar Trondheim
Kingdom of Saudi Arabia Ministry of Higher Education Al-Imam Muhammad Ibn Saud Islamic University College of Computer and Information Sciences Chapter.
_______________________________________________________________________________________________________________ E-Commerce: Fundamentals and Applications1.
Chapter 6 Server-side Programming: Java Servlets
RESTful Web Service 2014 년 12 월 한연희
Http protocol Response-request Clients not limited to web browsers. Anything that can access code implementing the protocol works: –Standalone programs.
1 Seminar on Service Oriented Architecture Principles of REST.
Rails & Ajax Module 5. Introduction to Rails Overview of Rails Rails is Ruby based “A development framework for Web-based applications” Rails uses the.
Server-side Programming The combination of –HTML –JavaScript –DOM is sometimes referred to as Dynamic HTML (DHTML) Web pages that include scripting are.
API Crash Course CWU Startup Club. OUTLINE What is an API? Why are API’s useful? What is HTTP? JSON? XML? What is a RESTful API? How do we consume an.
IS-907 Java EE World Wide Web - Overview. World Wide Web - History Tim Berners-Lee, CERN, 1990 Enable researchers to share information: Remote Access.
Mr. Justin “JET” Turner CSCI 3000 – Fall 2015 CRN Section A – TR 9:30-10:45 CRN – Section B – TR 5:30-6:45.
Representational State Transfer (REST). What is REST? Network Architectural style Overview: –Resources are defined and addressed –Transmits domain-specific.
Web Design and Development. World Wide Web  World Wide Web (WWW or W3), collection of globally distributed text and multimedia documents and files 
ICM – API Server & Forms Gary Ratcliffe.
RESTful Web Services What is RESTful?
New COOL Tag Browser Release 10 Giorgi BATIASHVILI Georgian Engineering Center 23/10/2012
Web Technologies Lecture 10 Web services. From W3C – A software system designed to support interoperable machine-to-machine interaction over a network.
AJAX and REST. Slide 2 What is AJAX? It’s an acronym for Asynchronous JavaScript and XML Although requests need not be asynchronous It’s not really a.
1 The World Wide Web Architectural Overview Static Web Documents Dynamic Web Documents HTTP – The HyperText Transfer Protocol Performance Enhancements.
Simple Web Services. Internet Basics The Internet is based on a communication protocol named TCP (Transmission Control Protocol) TCP allows programs running.
© 2010 IBM Corporation RESTFul Service Modelling in Rational Software Architect April, 2011.
Web Services Essentials. What is a web service? web service: software functionality that can be invoked through the internet using common protocols like.
National College of Science & Information Technology.
The Client-Server Model
REST: Web Services Abel Sanchez.
Node.js Express Web Services
AJAX and REST.
Server Concepts Dr. Charles W. Kann.
Ajax Design Patterns – Programming Practices in Web Services
PHP / MySQL Introduction
WEB API.
Web Browser server client 3-Tier Architecture Apache web server PHP
Client-Server Model: Requesting a Web Page
Chengyu Sun California State University, Los Angeles
Presentation transcript:

A RESTful Web Service Interface to the ATLAS COOL Database Shaun Roe 1A RESTful Web Service... (Shaun Roe, Atlas)CHEP'09 Prague

COOL (see talk by A. Valassi, this conference) 2A RESTful Web Service... (Shaun Roe, Atlas) ml/ CHEP'09 Prague COOL: A database schema and API designed to be technology neutral (Oracle/MySQL/SQLite) Data structure is hierarchical: folderchannel IOVtag Data entry is to a particular folder, channel and with a specific Interval Of Validity (IOV) and tag. resource =>These form a unique set of coordinates for the datum or resource. Originally in C++, its methods are exposed in Python, in the ‘PyCool’ module. High Voltage values from the Detector Control System of Atlas SemiConductor Tracker

URL A resource is defined by a unique URL http method What you ‘do’ to that resource is defined by the http method: POST: Create resource GET:Retrieve resource PUT:Update DELETE:Delete resource The reply is given via http codes. The format of the answer that you want can be further defined by http headers REST CHEP'09 PragueA RESTful Web Service... (Shaun Roe, Atlas)3 REpresentational State Transfer REpresentational State Transfer noun verb e.g. sending a form e.g. A browser normally GETs a web page ‘404 Not Found…’ ‘Accept: text/html’ Roy Fielding’s dissertation: RESTful

Motivation CHEP'09 PragueA RESTful Web Service... (Shaun Roe, Atlas)4 Rewind to 2006… People want data from Cool on the web! Solutions: Use their own SQL from PHP/Python… Use a shell script to set up environment, then run the Cool api behind some custom code Use a cron job to generate local html files..and people want to insert data from the web, too.

Aim: Universal Web Service CHEP'09 PragueA RESTful Web Service... (Shaun Roe, Atlas)5 Identify resources with url e.g. Use xml as the data transport format. ‘GET’ retrieves the values ‘POST’ creates the channel in a folder ‘PUT’ updates the channel ‘DELETE’ deletes the channel from the folder Multi-channel uploads/downloads should be possible. DB Modification should be protected. Additional resources to be matched to a url: Database nodelist, folder description, folder payload definition, list of channels in a folder, list of tags; it should be possible to create and delete databases, folders. ‘Accept: text/xml’

Data format: XML CHEP'09 PragueA RESTful Web Service... (Shaun Roe, Atlas)6 What about JSON ? (see later) Definition of an XSD schema allows validation of data format on upload, or type-ahead and documentation tooltips in an editor: Namespaces? (oXygen editor) XML Schema Description JavaScript Object Notation

Implementation: CherryPy CHEP'09 PragueA RESTful Web Service... (Shaun Roe, Atlas)7 CherryPy is a Python application server. It is very easy to install and use. The ‘Routes’ module (from Ruby) allows automatic or manual mapping of Python classes and methods to URLs: d.connect('folder_payload','/:server/:schema/:dbname/*folderPath/payload',controller=restCont roller,action='folderPayload’) def folderPayload(self, server, schema, dbname, folderPath): maps this to this The http headers and the methods are also available and can be used to route the URL to the appropriate Python method; other modules for security, caching etc are available.

Examples, curl CHEP'09 PragueA RESTful Web Service... (Shaun Roe, Atlas)8 Command line examples Create a folder: curl ' -u user:pwd -F -X POST Create channels: curl ' /channels' -u user:pwd -F -X POST Insert values: curl ' /timespan/ /channels’ -u user:pwd -F -X PUT accessing Cool via CherryPy typically does not require any extra setup or libraries. cURL (and libcurl, to use from C, C++, Perl) are standard installations. Other languages have similar libraries: PHP – curl, Java – java.net.url, Python – urllib2 … all are standard installations, so accessing Cool via CherryPy typically does not require any extra setup or libraries.

‘In the wild’ examples CHEP'09 PragueA RESTful Web Service... (Shaun Roe, Atlas)9 /** formica */ public class CherryPyClient { private String name = "user.name"; private String psswd = "mypass"; private String readnodeUrl = " private String writenodeUrl = public String coolGetCherryPy() { try { URL url = new URL(this.readnodeUrl); java.net.URLConnection conn = url.openConnection(); InputStream is = (InputStream) conn.getInputStream(); BufferedReader in = new BufferedReader(new InputStreamReader(is)); String inputLine = in.readLine(); is.close(); return inputLine; } catch (Exception e) { e.printStackTrace(); } return "none"; } $header=array('Accept: text/xml'); // $ch = curl_init(); curl_setopt($ch, CURLOPT_HTTPHEADER,$header); curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); $format=requested_format(); $http_result = curl_exec($ch); if ($format != 'text/xml'){ $dom=domxml_open_mem($http_result); } curl_close($ch); $header=array('Accept: text/xml'); // $ch = curl_init(); curl_setopt($ch, CURLOPT_HTTPHEADER,$header); curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); $format=requested_format(); $http_result = curl_exec($ch); if ($format != 'text/xml'){ $dom=domxml_open_mem($http_result); } curl_close($ch); Java PHP httpHeaders={'Accept':'text/xml'} textData=None request=urllib2.Request(url,textData, httpHeaders) u=urllib2.urlopen(request) xmlDocString = u.read() return xmlDocString httpHeaders={'Accept':'text/xml'} textData=None request=urllib2.Request(url,textData, httpHeaders) u=urllib2.urlopen(request) xmlDocString = u.read() return xmlDocString Python

eXtensible Stylesheet Language for Transformations Example: Run List CHEP'09 PragueA RESTful Web Service... (Shaun Roe, Atlas)10 Search for runs matching criteria, display results; Uses an ‘Ajax’ request to get the CherryPy XML. Client-side Local server side XML is inserted directly in the XHTML page, and associated with an XSLT stylesheet to format it as a table

Plans, conclusion CHEP'09 PragueA RESTful Web Service... (Shaun Roe, Atlas)11 Use of CherryPy allowed rapid development of a web service interface to Cool which greatly simplified conditions access and adheres to ‘RESTful’ principles. It was used during 2008 as the engine for the ‘run list’ query page, for various dcs retrieval services, and for insertion of detector status and calibration data; its adoption is growing as a part of web information collations in the detector subsystems. Future extensions include extra methods for tag viewing, and more flexible output format (e.g. JSON, zipped format…)