what's a service, anyway?

86
What's a Service, Anyway? Wyatt Pearsall November 2013

Upload: pahana

Post on 14-Feb-2016

202 views

Category:

Documents


0 download

DESCRIPTION

What's a Service, Anyway?. Wyatt Pearsall November 2013. ArcGIS Server Services and its REST API. ArcGIS %@#*!) `*&@%) and its *$@^ ~!$. HTTP. HyperText Transfer Protocol. HTTP. HyperText Transfer Protocol. HTTP. HyperText Transfer Protocol. Anything you want!. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: What's a Service, Anyway?

What's a Service, Anyway?

Wyatt PearsallNovember 2013

Page 2: What's a Service, Anyway?

ArcGIS Server Services

and its REST API

Page 3: What's a Service, Anyway?

ArcGIS %@#*!) `*&@%) and its *$@^ ~!$

Page 4: What's a Service, Anyway?

HyperText Transfer Protocol

HTTP

Page 5: What's a Service, Anyway?

HyperText Transfer Protocol

HTTP

Page 6: What's a Service, Anyway?

HyperText Transfer Protocol

HTTP

Page 7: What's a Service, Anyway?

HTTP is location driven

Anything you want!

Page 8: What's a Service, Anyway?

HTTP is location driven

Anything you want!

Page 9: What's a Service, Anyway?

Google.com 64.233.160.17

URL structure allows access to every resource on every computer

Intricate Dance

Page 10: What's a Service, Anyway?

EVERY RESOURCE

Page 11: What's a Service, Anyway?

EVERY COMPUTER

Page 12: What's a Service, Anyway?

That’s awesome!

Page 13: What's a Service, Anyway?

And powerful

That’s awesome!

Page 14: What's a Service, Anyway?

And powerful Accessing any resource just by knowing the

URL is what makes the web, the web.

That’s awesome!

Page 15: What's a Service, Anyway?

Physical wires Networks Sending bits over wires Interpreting bits as information

TCP/IP connects computers

Page 16: What's a Service, Anyway?

TCP/IP connects computers

Page 17: What's a Service, Anyway?

TCP/IP connects computers

Page 18: What's a Service, Anyway?

Focus on HTTP Everything else might as well be Chinese

TCP/IP connects computers

Page 19: What's a Service, Anyway?

Request/Response

Page 20: What's a Service, Anyway?

User types URL Browser makes request to server Server parses request and responds Browser shows webpage

Request/Response

Page 21: What's a Service, Anyway?

Request/Response

Page 22: What's a Service, Anyway?

Contain metadata about the request and response

Headers organize the cycle

Page 23: What's a Service, Anyway?

Headers organize the cycle

Page 24: What's a Service, Anyway?

Host: from whom we are requesting the page

Method: What to do with the resource Accept: the type of files we’ll accept Cookie: user information User Agent: What the client is (browser,

web crawler, command line program, screen reader)

Request Headers

Page 25: What's a Service, Anyway?

Content type: type of file coming back Content length: file size Status: what has happened to the request• Most important

Response Headers

Page 26: What's a Service, Anyway?

Oddly, google can’t find wyattisgreat.html

404

Page 27: What's a Service, Anyway?

404

Page 28: What's a Service, Anyway?

Other codes

Page 29: What's a Service, Anyway?

A little rarer, but you can find them in the wild

Other codes

Page 30: What's a Service, Anyway?

Other codes

water.ca.gov issues 302 Found on wyattisgreat.html… no surprises there.

Page 31: What's a Service, Anyway?

Standard responses allow for a client to know nothing about a server

Can understand any server that uses codes

Codes are Really Important

Page 32: What's a Service, Anyway?

Standard responses allow for a client to know nothing about a server

Can understand any server that uses codes Servers need to know nothing about clients Can serve any client that understands

codes

Codes are Really Important

Page 33: What's a Service, Anyway?

Like status codes, allow clients and servers to know little about each other

Request Methods

Page 34: What's a Service, Anyway?

Only 9, only 5 are common.

Request Methods

Page 35: What's a Service, Anyway?

Often called verbs Time for a tangent about why using just a

few verbs lets us do a lot with little complexity

Request Methods

Page 36: What's a Service, Anyway?

Internet is organized to provide access to infinite resources

Linguistic Tangent

Page 37: What's a Service, Anyway?

Internet is organized to provide access to infinite resources

Resources, as discrete things, are nouns.

Linguistic Tangent

Page 38: What's a Service, Anyway?

Internet is organized to provide access to infinite resources

Resources, as discrete things, are nouns. Request methods, as verbs, act upon these

nouns

Linguistic Tangent

Page 39: What's a Service, Anyway?

Most ordinary nouns have many associated verbs

Drive a car, wash a car, crash a car, gas up a car, etc.

Linguistic Tangent

Page 40: What's a Service, Anyway?

Some verbs apply to many nouns, like “buy” You can buy most things:

◦ Buy a car◦ Buy a can of soda◦ Buy a book

Universal Verbs

Page 41: What's a Service, Anyway?

Some verbs apply to many nouns, like “buy” You can buy most things:

◦ Buy a car◦ Buy a can of soda◦ Buy a book

Universal Verbs

Page 42: What's a Service, Anyway?

There are many more verbs that aren’t universal◦ Can’t drink a book◦ Can’t drive a soda◦ Can’t read a car

Specific Verbs

Page 43: What's a Service, Anyway?

There are many more verbs that aren’t universal◦ Can’t drink a book◦ Can’t drive a soda◦ Can’t read a car

Specific Verbs

Page 44: What's a Service, Anyway?

If limited to just a few verbs, pick the universal ones

Universal verbs

Page 45: What's a Service, Anyway?

This is what HTTP does Limits itself to common verbs like GET,

POST, PUT, and DELETE

Back to HTTP

Page 46: What's a Service, Anyway?

With just a few verbs, clients don’t need to know about the capabilities of implementations of a server

Development of browsers and servers can advance without each of them having to know about an entire internet full of proprietary commands

Less is More

Page 47: What's a Service, Anyway?

Services?

Page 48: What's a Service, Anyway?

Services!

Page 49: What's a Service, Anyway?

These ideas of HTTP apply to REST◦ (REpresentational State Transfer)

So we’re on the right track

Get to the REST

Page 50: What's a Service, Anyway?

Big enterprise players started championing SOAP (Simple Object Access Protocol) as a way for systems to communicate.

Remote Procedure Call where XML encodes a series of commands that can be run on a computer and a communication layer is built to allow messages to be passed back and forth in XML to run these specific commands.

But first

Page 51: What's a Service, Anyway?

If it sounds complicated, that’s because it is There are many complex extensions and

specifications

SOAP

Page 52: What's a Service, Anyway?

Roy Fielding

Page 53: What's a Service, Anyway?

If the web is so successful, systems should interact in the same way.

Client/Server separation Uniform Interface (few verbs) Caching

◦ Network requests are the slowest thing a computer can do besides load bathymetry points in ArcMap

REST: HTTP is a good idea

Page 54: What's a Service, Anyway?

REST: HTTP for systems

Page 55: What's a Service, Anyway?

APIs are a structured way for programs to communicate

A key to using someone else's complex program in a simple, defined way.

APIs

Page 56: What's a Service, Anyway?

Facebook has petabytes of data on their servers and very complicated ways of ordering, storing, and searching this data.

Facebook

Page 57: What's a Service, Anyway?

https://graph.facebook.com/137595352936906/picture?type=large

Facebook

Page 58: What's a Service, Anyway?

https://graph.facebook.com/95205192448/picture?type=large

Facebook

Page 59: What's a Service, Anyway?

Plugging in the PageID of these pages into a URL structure defined by the facebook API results in the requested images

Facebook

Page 60: What's a Service, Anyway?

With a normal user interface, you might click a link or button, start typing in a form, or press the back button if you are browsing the web.

User Interface for Developers

Page 61: What's a Service, Anyway?

Common tasks which have expected responses

If a link doesn't take you where you expect, a field doesn't work like you think it should or if a website hijacks your back button.. it is a problem.

User Interface

Page 62: What's a Service, Anyway?

Users hate it

Page 63: What's a Service, Anyway?

You have to adhere to a contract that your software will do what a user expects it to do.

When you fulfill this contract, your application seems intuitive.

When you break it, your users will leave

UI is a contract

Page 64: What's a Service, Anyway?

Unless they can’t

Page 65: What's a Service, Anyway?

APIs seek to allow straightforward communication with a service

Whether it is a Twitter Client tweeting on a user's behalf, or a map showing USGS earthquake data, APIs exist to allow easy access to complex applications and vast amounts of data.

APIs: Contracts for Developers

Page 66: What's a Service, Anyway?

A service is a self-contained program used through an API to provide its functionality to a client or user.

REST is often used to keep the concerns of the service separate from the client so that it can be maintainable and scalable.

What’s a Service Anyway

Page 67: What's a Service, Anyway?

So how does this apply to all of you?

Where’s the GIS

Page 68: What's a Service, Anyway?

Publish a map to ArcGIS Server◦ Click through some dialogs in ArcMap

These services become immediately available for use by any client that can navigate the API

You Can Create Services

Page 69: What's a Service, Anyway?

ArcGIS Server REST API

Page 70: What's a Service, Anyway?

URL of the resource Operations you can perform How it relates to other resources.

ArcGIS Server REST API

Page 71: What's a Service, Anyway?

Identify

Page 72: What's a Service, Anyway?

Operate denoted by URL By supplying proper parameters, can

identify just like in ArcMap

Identify

Page 73: What's a Service, Anyway?

RESTful Service Endpoint

Page 74: What's a Service, Anyway?

REST

Page 75: What's a Service, Anyway?

SOAP

Page 76: What's a Service, Anyway?

SOAP

Page 77: What's a Service, Anyway?

SOAP

Page 78: What's a Service, Anyway?

SOAP

Page 79: What's a Service, Anyway?

SOAP

Page 80: What's a Service, Anyway?

Inspect a service

Page 81: What's a Service, Anyway?

Consume a service

Page 82: What's a Service, Anyway?

Don’t need to use Server API directly Use the JavaScript (or Silverlight or Flex)

APIs to quickly build a useful application.

JavaScript API

Page 83: What's a Service, Anyway?

These APIs encapsulate the Server API, allowing access to data from powerful programming environments.

APIs all the way down

JavaScript API

Page 84: What's a Service, Anyway?

ArcGIS Server Services and its REST

API?

Page 85: What's a Service, Anyway?

Self contained programs, with a defined, simple interaction

mechanism, based on familiar, performant technology.

Page 86: What's a Service, Anyway?

Questions?