broadening web service access through rest and odata? · a restful interface for data ......

25
Presented By: 9/23/2010 Where PI geeks meet… Steve Pilon, OSIsoft Michael van der Veeken, Atos Origin Broadening Web Service Access through REST and OData?

Upload: vunga

Post on 08-Jun-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Broadening Web Service Access through REST and OData? · A RESTful Interface for Data ... •Formerly 'ADO.NET Data Services' (codename 'Astoria') •Expose IQueryable collections

Presented By:

9/23/2010 Where PI geeks meet…

Steve Pilon, OSIsoft

Michael van der Veeken, Atos Origin

Broadening Web Service Access through

REST and OData?

Page 2: Broadening Web Service Access through REST and OData? · A RESTful Interface for Data ... •Formerly 'ADO.NET Data Services' (codename 'Astoria') •Expose IQueryable collections

What is a web service?

“a software system designed to support

interoperable machine-to-machine

interaction over a network. It has an interface

described in a machine processable format

(WSDL). Other systems interact with the Web

service in a manner prescribed by its description

using SOAP messages, typically conveyed

using HTTP with an XML serialization in

conjunction with other Web-related standards.“

http://www.w3.org/TR/ws-gloss/

interoperable machine-to-machine interaction

WSDL

SOAP

HTTP

XML

Where PI geeks meet… ©2010 OSIsoft, LLC. All Rights Reserved 2

Page 3: Broadening Web Service Access through REST and OData? · A RESTful Interface for Data ... •Formerly 'ADO.NET Data Services' (codename 'Astoria') •Expose IQueryable collections

What is a web service?

(take 2)

The API of the future = Web API

Where PI geeks meet… ©2010 OSIsoft, LLC. All Rights Reserved 3

Page 4: Broadening Web Service Access through REST and OData? · A RESTful Interface for Data ... •Formerly 'ADO.NET Data Services' (codename 'Astoria') •Expose IQueryable collections

Web Services Landscape

SOAP Web Services

REST Web Services

Where PI geeks meet… ©2010 OSIsoft, LLC. All Rights Reserved 4

Page 5: Broadening Web Service Access through REST and OData? · A RESTful Interface for Data ... •Formerly 'ADO.NET Data Services' (codename 'Astoria') •Expose IQueryable collections

• Representational State Transfer

(architectural style)

• Simple Object Access Protocol

(protocol specification)

By definition…

SOAP

REST

Where PI geeks meet… ©2010 OSIsoft, LLC. All Rights Reserved 5

Page 6: Broadening Web Service Access through REST and OData? · A RESTful Interface for Data ... •Formerly 'ADO.NET Data Services' (codename 'Astoria') •Expose IQueryable collections

• Exposes resources, collections, relationships (data-centric) • Open format (URI with verbs and nouns) • Thought of as "easy, simple, free-form"

• Exposes methods with inputs and outputs (operation-centric) • Well-defined, discoverable calling sequences • Thought of as "official, serious, for large enterprises"

In clear…

SOAP

REST

Where PI geeks meet… ©2010 OSIsoft, LLC. All Rights Reserved 6

Page 7: Broadening Web Service Access through REST and OData? · A RESTful Interface for Data ... •Formerly 'ADO.NET Data Services' (codename 'Astoria') •Expose IQueryable collections

SOAP Web Services (a.k.a. Big Web Services)

Client SOAP

Web Service

WSDL: What can you do? (contract)

SOAP: Do something. Return data. (operation)

Where PI geeks meet… ©2010 OSIsoft, LLC. All Rights Reserved 7

Page 8: Broadening Web Service Access through REST and OData? · A RESTful Interface for Data ... •Formerly 'ADO.NET Data Services' (codename 'Astoria') •Expose IQueryable collections

REST Web Services (a.k.a. RESTful)

Client REST

Web Service HTTP: Do something. Return data.

REST/HTTP Verbs: GET read PUT create POST update DELETE delete

Where PI geeks meet… ©2010 OSIsoft, LLC. All Rights Reserved 8

Page 9: Broadening Web Service Access through REST and OData? · A RESTful Interface for Data ... •Formerly 'ADO.NET Data Services' (codename 'Astoria') •Expose IQueryable collections

9

Representational State Transfer

Nouns (Unconstrained) e.g. http://server.local/timeseries(‘sinusoid’)?$filter=time gt ‘*-1h’ and lt ‘*’

Verbs (Constrained) e.g. GET

Content Types (Constrained) e.g. XML

Where PI geeks meet… ©2010 OSIsoft, LLC. All Rights Reserved

Page 10: Broadening Web Service Access through REST and OData? · A RESTful Interface for Data ... •Formerly 'ADO.NET Data Services' (codename 'Astoria') •Expose IQueryable collections

???

PI Web Services 2010

At OSIsoft…

SOAP

REST

Open Data Protocol (OData) in PI Web Services ?

Where PI geeks meet… ©2010 OSIsoft, LLC. All Rights Reserved 10

Page 11: Broadening Web Service Access through REST and OData? · A RESTful Interface for Data ... •Formerly 'ADO.NET Data Services' (codename 'Astoria') •Expose IQueryable collections

Web Feeds

RSS

• Really Simple Syndication

• Pseudo-XML syndication format

Atom

• More organized, extended RSS

• Fully-compliant XML format

AtomPub

• Atom publishing protocol

• Defines how to play with the data

* JSON is another type of web feed format

Where PI geeks meet… ©2010 OSIsoft, LLC. All Rights Reserved 11

Page 12: Broadening Web Service Access through REST and OData? · A RESTful Interface for Data ... •Formerly 'ADO.NET Data Services' (codename 'Astoria') •Expose IQueryable collections

Open Data Protocol (OData)

OData (protocol)

HTTP/HTTPS (transport)

AtomPub/JSON (format)

URI Conventions (interactions)

A RESTful Interface for Data

Where PI geeks meet… ©2010 OSIsoft, LLC. All Rights Reserved 12

Page 13: Broadening Web Service Access through REST and OData? · A RESTful Interface for Data ... •Formerly 'ADO.NET Data Services' (codename 'Astoria') •Expose IQueryable collections

URL Conventions

• Addressing entities and sets

• Presentation Options

Entity Set /AFElements

Single Entity /AFElements('Pump 123')

Member Access /AFElements('Pump 123')/EffectiveDate

Link Traversal /AFElements('Pump 123')/Attributes

Deep Access /AFElements('Pump 123')/Attributes('Flow Rate')/Value

Sorting /AFElements?$orderby=Name

Filtering /AFElements?$filter=CreationDate gt '2007-05-07'

Paging /AFElements?$top=10&$skip=30

Where PI geeks meet… ©2010 OSIsoft, LLC. All Rights Reserved 14

Page 14: Broadening Web Service Access through REST and OData? · A RESTful Interface for Data ... •Formerly 'ADO.NET Data Services' (codename 'Astoria') •Expose IQueryable collections

Why OData?

• No more silos of data…

Census data, construction projects, gas stations, hotels, metro stations

Bus stops, facility buildings, schools

Where PI geeks meet… ©2010 OSIsoft, LLC. All Rights Reserved 15

Page 15: Broadening Web Service Access through REST and OData? · A RESTful Interface for Data ... •Formerly 'ADO.NET Data Services' (codename 'Astoria') •Expose IQueryable collections

Why OData?

• Platform- and Language-Agnostic

Where PI geeks meet… ©2010 OSIsoft, LLC. All Rights Reserved 16

Page 16: Broadening Web Service Access through REST and OData? · A RESTful Interface for Data ... •Formerly 'ADO.NET Data Services' (codename 'Astoria') •Expose IQueryable collections

Another example

• http://www.osisoft.com http://odata.osisoft.com/

– Events, Products, Partners, etc.

• http://odata.osisoft.com/Events

– /events?$filter=Type eq 'Regional Seminar'

– /events?$filter=Location eq 'San Francisco'

• OData for OSIsoft vCampus Live! 2010

Where PI geeks meet… ©2010 OSIsoft, LLC. All Rights Reserved 17

Page 17: Broadening Web Service Access through REST and OData? · A RESTful Interface for Data ... •Formerly 'ADO.NET Data Services' (codename 'Astoria') •Expose IQueryable collections

In the Microsoft world…

WCF Services

• SOAP

• WSDL

• WS-*

• WS-Security

WCF Data Services

• REST

• HTTP

• AtomPub

• OData

Where PI geeks meet… ©2010 OSIsoft, LLC. All Rights Reserved 18

• Formerly 'ADO.NET Data

Services' (codename 'Astoria')

• Expose IQueryable collections

as part of an OData Service

– IUpdatable for

updates/deletes/inserts

Page 18: Broadening Web Service Access through REST and OData? · A RESTful Interface for Data ... •Formerly 'ADO.NET Data Services' (codename 'Astoria') •Expose IQueryable collections

File > New > OData Service

• Create an "OData Service"

for OSIsoft vCampus Live!

Where PI geeks meet… ©2010 OSIsoft, LLC. All Rights Reserved 19

Page 19: Broadening Web Service Access through REST and OData? · A RESTful Interface for Data ... •Formerly 'ADO.NET Data Services' (codename 'Astoria') •Expose IQueryable collections

Where PI geeks meet… ©2010 OSIsoft, LLC. All Rights Reserved 22

Page 20: Broadening Web Service Access through REST and OData? · A RESTful Interface for Data ... •Formerly 'ADO.NET Data Services' (codename 'Astoria') •Expose IQueryable collections

PI in WCF Data Services

• Remember… WCF Data Services expose

IQueryable collections as part of an OData Service

• PI AF SDK exposes IQueryable collections (e.g. AFElements,

AFAttributes)

• Difficult to achieve with PI SDK

• LinqToPI does this for PI data

Where PI geeks meet… ©2010 OSIsoft, LLC. All Rights Reserved 23

Page 21: Broadening Web Service Access through REST and OData? · A RESTful Interface for Data ... •Formerly 'ADO.NET Data Services' (codename 'Astoria') •Expose IQueryable collections

LinqToPI??

• Welcome Michael van der Veeken from Atos Origin

Where PI geeks meet… ©2010 OSIsoft, LLC. All Rights Reserved 24

Page 22: Broadening Web Service Access through REST and OData? · A RESTful Interface for Data ... •Formerly 'ADO.NET Data Services' (codename 'Astoria') •Expose IQueryable collections

LinqToPI

• Empowers .NET developers to query the PI

System using in-code, SQL-like queries

• Make PI "entities" IQueryable (and "OData ready")

var values =

from

arc

in

context.Archive.ArchiveData

where

arc.Tag == tagname &&

arc.Time.Between(startTime, endTime)

select arc;

Where PI geeks meet… ©2010 OSIsoft, LLC. All Rights Reserved 25

Page 23: Broadening Web Service Access through REST and OData? · A RESTful Interface for Data ... •Formerly 'ADO.NET Data Services' (codename 'Astoria') •Expose IQueryable collections

Where PI Data Meets OData

• Create a "PI OData Service"

– Based on LinqToPI

Where PI geeks meet… ©2010 OSIsoft, LLC. All Rights Reserved 26

Page 24: Broadening Web Service Access through REST and OData? · A RESTful Interface for Data ... •Formerly 'ADO.NET Data Services' (codename 'Astoria') •Expose IQueryable collections

No More Silos of Data

• Query various OData feeds

with a single client

Where PI geeks meet… ©2010 OSIsoft, LLC. All Rights Reserved 27

Page 25: Broadening Web Service Access through REST and OData? · A RESTful Interface for Data ... •Formerly 'ADO.NET Data Services' (codename 'Astoria') •Expose IQueryable collections

Thank You!

©2010 OSIsoft, LLC. All Rights Reserved