What's a Service, Anyway?
description
Transcript of What's a Service, Anyway?
![Page 1: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/1.jpg)
What's a Service, Anyway?
Wyatt PearsallNovember 2013
![Page 2: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/2.jpg)
ArcGIS Server Services
and its REST API
![Page 3: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/3.jpg)
ArcGIS %@#*!) `*&@%) and its *$@^ ~!$
![Page 4: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/4.jpg)
HyperText Transfer Protocol
HTTP
![Page 5: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/5.jpg)
HyperText Transfer Protocol
HTTP
![Page 6: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/6.jpg)
HyperText Transfer Protocol
HTTP
![Page 7: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/7.jpg)
HTTP is location driven
Anything you want!
![Page 8: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/8.jpg)
HTTP is location driven
Anything you want!
![Page 9: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/9.jpg)
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?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/10.jpg)
EVERY RESOURCE
![Page 11: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/11.jpg)
EVERY COMPUTER
![Page 12: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/12.jpg)
That’s awesome!
![Page 13: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/13.jpg)
And powerful
That’s awesome!
![Page 14: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/14.jpg)
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?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/15.jpg)
Physical wires Networks Sending bits over wires Interpreting bits as information
TCP/IP connects computers
![Page 16: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/16.jpg)
TCP/IP connects computers
![Page 17: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/17.jpg)
TCP/IP connects computers
![Page 18: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/18.jpg)
Focus on HTTP Everything else might as well be Chinese
TCP/IP connects computers
![Page 19: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/19.jpg)
Request/Response
![Page 20: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/20.jpg)
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?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/21.jpg)
Request/Response
![Page 22: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/22.jpg)
Contain metadata about the request and response
Headers organize the cycle
![Page 23: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/23.jpg)
Headers organize the cycle
![Page 24: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/24.jpg)
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?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/25.jpg)
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?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/26.jpg)
Oddly, google can’t find wyattisgreat.html
404
![Page 27: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/27.jpg)
404
![Page 28: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/28.jpg)
Other codes
![Page 29: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/29.jpg)
A little rarer, but you can find them in the wild
Other codes
![Page 30: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/30.jpg)
Other codes
water.ca.gov issues 302 Found on wyattisgreat.html… no surprises there.
![Page 31: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/31.jpg)
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?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/32.jpg)
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?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/33.jpg)
Like status codes, allow clients and servers to know little about each other
Request Methods
![Page 34: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/34.jpg)
Only 9, only 5 are common.
Request Methods
![Page 35: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/35.jpg)
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?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/36.jpg)
Internet is organized to provide access to infinite resources
Linguistic Tangent
![Page 37: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/37.jpg)
Internet is organized to provide access to infinite resources
Resources, as discrete things, are nouns.
Linguistic Tangent
![Page 38: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/38.jpg)
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?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/39.jpg)
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?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/40.jpg)
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?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/41.jpg)
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?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/42.jpg)
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?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/43.jpg)
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?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/44.jpg)
If limited to just a few verbs, pick the universal ones
Universal verbs
![Page 45: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/45.jpg)
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?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/46.jpg)
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?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/47.jpg)
Services?
![Page 48: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/48.jpg)
Services!
![Page 49: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/49.jpg)
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?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/50.jpg)
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?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/51.jpg)
If it sounds complicated, that’s because it is There are many complex extensions and
specifications
SOAP
![Page 52: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/52.jpg)
Roy Fielding
![Page 53: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/53.jpg)
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?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/54.jpg)
REST: HTTP for systems
![Page 55: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/55.jpg)
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?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/56.jpg)
Facebook has petabytes of data on their servers and very complicated ways of ordering, storing, and searching this data.
![Page 57: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/57.jpg)
https://graph.facebook.com/137595352936906/picture?type=large
![Page 58: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/58.jpg)
https://graph.facebook.com/95205192448/picture?type=large
![Page 59: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/59.jpg)
Plugging in the PageID of these pages into a URL structure defined by the facebook API results in the requested images
![Page 60: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/60.jpg)
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?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/61.jpg)
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?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/62.jpg)
Users hate it
![Page 63: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/63.jpg)
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?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/64.jpg)
Unless they can’t
![Page 65: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/65.jpg)
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?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/66.jpg)
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?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/67.jpg)
So how does this apply to all of you?
Where’s the GIS
![Page 68: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/68.jpg)
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?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/69.jpg)
ArcGIS Server REST API
![Page 70: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/70.jpg)
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?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/71.jpg)
Identify
![Page 72: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/72.jpg)
Operate denoted by URL By supplying proper parameters, can
identify just like in ArcMap
Identify
![Page 73: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/73.jpg)
RESTful Service Endpoint
![Page 74: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/74.jpg)
REST
![Page 75: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/75.jpg)
SOAP
![Page 76: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/76.jpg)
SOAP
![Page 77: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/77.jpg)
SOAP
![Page 78: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/78.jpg)
SOAP
![Page 79: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/79.jpg)
SOAP
![Page 80: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/80.jpg)
Inspect a service
![Page 81: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/81.jpg)
Consume a service
![Page 82: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/82.jpg)
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?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/83.jpg)
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?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/84.jpg)
ArcGIS Server Services and its REST
API?
![Page 85: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/85.jpg)
Self contained programs, with a defined, simple interaction
mechanism, based on familiar, performant technology.
![Page 86: What's a Service, Anyway?](https://reader035.fdocuments.us/reader035/viewer/2022081511/56815e4f550346895dccc6fb/html5/thumbnails/86.jpg)
Questions?