web services - densetsu.orgdensetsu.org/cloud2012/(4) web services.pdf · 07.01.2012 column stores...
TRANSCRIPT
Web Services Robert Neumann
119 Cloud Computing
Lecture Lab
08.10.2012 Overview ---
15.10.2012 Cloud Computing & Pricing Introduction
22.10.2012 Cloud Frontend Technologies Hello Cloud
29.10.2012 Web Services Partial SSL
05.11.2012 Cloud Data Management SOAP
12.11.2012 Cloud Storage Technologies Non-relational Storage
19.11.2012 Cloud Scaling & Performance Blob Storage
26.11.2012 Invited Speaker “Kai Jäger” (Microsoft): HTML5 Distributed Cache
03.12.2012 Invited Speaker “Markus Winkler” (IBM): Java EE […]
10.12.2012 Virtualization Hypervisors
17.12.2012 Cloud Scheduling
Auto-Scaling
07.01.2012 Column Stores HBase
14.01.2012 MapReduce Hadoop
21.01.2012 Wrap-up ---
120 Cloud Computing
Service Calling Made Easy
credits
121 Cloud Computing
Web Service Overview
Protocol!
Architecture!
Complements or Competitors?
122 Cloud Computing
SOAP Services – “Big Web Services”
Core Technologies
1. SOAP (Simple Object Access Protocol), 1998
1. Dave Winer
2. Don Box (Microsoft)
3. Bob Atkinson (Microsoft)
4. Mohsen Al-Ghosein (Microsoft)
2. WSDL (Web Service Description Language), 2000
1. Microsoft
2. IBM
3. Ariba
(NASSL (IBM) + SDL (Microsoft) WSDL)
Describes
structure of
Web Service
and its methods
Describes message
exchange between
service provider and
consumer
123 Cloud Computing
Big Web Services
src: wikipedia.org
124 Cloud Computing
SOAP Building Blocks
<?xml version="1.0"?> <soap:Envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"> <soap:Header> ... </soap:Header> <soap:Body> ... <soap:Fault> ... </soap:Fault> </soap:Body> </soap:Envelope>
Application-specific information (e.g., Payment, Authorization)
Call and response information
Fault information
125 Cloud Computing
SOAP Sample
126 Cloud Computing
WSDL Building Blocks
- Service
- Functionality exposed via web protocol
- Port/Endpoint
- Address to the service (e.g., HTTP)
- Binding
- Specifies interface (RPC/Document)
- PortType/Interface
- Operations that can be performed and their messages
- Operation
- Web methods that can be called
- Message
- Types
- XML description of data types
127 Cloud Computing
WSDL Sample
Types for in/out
parameters
WS Method
with in/out
parameters
128 Cloud Computing
SOAP Services - Summary (Chappell, 2009)
- SOAP typically uses XML for information representation
- Pro
- There is one common format
- Cons
- XML isn‘t especially efficient
- XML isn‘t a good fit for some languages
- There is some competition between both
- Yet both have value
- Challenge is to determine when to use what
129 Cloud Computing
SOAP Services - Issues (Chappell, 2009)
- Cross-vendor interop for SOAP and WS technologies isn‘t perfect
- Contract-first design can help
130 Cloud Computing
Representational State Transfer (REST)
Application can be:
1. At rest
2. In transition between application states
REST design goal:
- Maximize use of pre-existing interfaces and capabilities
- Leverage existing infrastructure (e.g. HTTP Caching)
REST vocabulary:
- GET, POST, PUT, DELETE
SOAP Services, in contrast, define their own vocabulary overlaying POST* *(usually)
131 Cloud Computing
REST Constraints
1. Client-server
Clients and servers are separated via uniform interface
2. Stateless
Server does not maintain client context
3. Cacheable
Resources must define themselves as cacheable or not
4. Layered system
System layers are invisible to client
5. Code on demand
Clients can request executable code (Java Script, Applet)
6. Uniform interface
Simplifies and decouples architecture
132 Cloud Computing
RESTful Web Service
3 Components:
1. URL (e.g., „http://serviceparrot.com/resources“)
2. Internet media type (JSON, XML/SOAP, YAML, JPG, AVI, etc.)
3. Operation set {GET, POST, PUT, DELETE}
REST examples:
- The World-wide Web
- Amazon S3
- Windows Azure
133 Cloud Computing
REST + WSDL (optional)
Src:http://en.wikipedia.org/wiki/Web_Services_Description_Language
134 Cloud Computing
Service/Client communication
Service Client Communication
Protocol
XML/SOAP
JSON
YAML
(homebrew)
?
135 Cloud Computing
Java Script Object Notation (JSON)
-Light-weight method exchange standard
-MIME Type: application/json
-Basic data types
- Number
- String
- Boolean
- Array
- object
136 Cloud Computing
JSON Sample (Menu)
And in XML…
cv
cv
Overhead!
137 Cloud Computing
Yet Another Markup Language (YAML)
-Designed to easily map to high-level data types
- (e.g., list, hash, scalar) very Perl‘ish!
- List
- [milk, pumpkin pie, eggs, juice]
- Hash
- {name: John Smith, age: 33}
- Scalar
- date: 2007-08-06
138 Cloud Computing
JSON, XML, YAML - Comparison
JSON XML YAML
Network bandwidth + - +
Processing performance - + (DOM) -
Human readability - + -
Schema validation - + (XSD) -
Partial processing - + -
139 Cloud Computing
REST Services - Summary (Chappell, 2009)
- REST defines no standard data representation
- RESTful service can use XML, JSON, and others
- Pros
- Data formats can better match clients
- (e.g., using JSON with JS clients)
- Different formats can be chosen to match different performance requirements
- Cons
- Options increase complexity
- RESTful services do not (necessarily) describe their interface
- Means more dependence on written documentation
140 Cloud Computing
REST Services - Summary (Chappell, 2009)
- Most developers don’t like writing raw HTTP calls
- Providing client library requires
- Choosing what language and environment to support
- Dealing with versioning
141 Cloud Computing
REST Services - Summary (Chappell, 2009)
- The semantics of PUT, GET, DELETE are well defined
- The semantics of POST are less clear
- From the HTTP 1.1 spec
142 Cloud Computing
SOAP vs. REST - Summary (Chappell, 2009)
- Calling SOAP-based services “Web Services” makes no sense
- SOAP has little to do with Web technologies
- REST-based services truly deserve the name Web Services
- They are entirely based on HTTP and URIs
- Choosing operations (SOAP) over resources (REST)
- SOAP and REST emphasize different things
- Capabilities
- SOAP/REST provide different functions
143 Cloud Computing
SOAP vs. REST - Summary (Chappell, 2009)
- REST
- Focused on named resources
- Each of which typically represents some data
- Every application exposes its resources through the same interface
- SOAP
- Focused on accessing named operations
- Each of which typically implements some logic
- Different applications expose different interfaces
144 Cloud Computing
A practical example (Chappell, 2009)
- A service for banking functions might include operations such as
- GetBalance(Account)
- UpdateBalance(Account, Amount)
- These work well with either REST or SOAP…
- Suppose interface also includes
- Transfer(FromAccount, ToAccount, Amount)
- This maps naturally to a SOAP operation
- It does not map well to the REST resource-oriented model
145 Cloud Computing
SOAP vs. REST - Caching (Chappell, 2009)
- For most services the majority of requests are reads
- In RESTful services all reads rely on HTTP GET
- Results of GET are commonly cached
- Can allow better performance and more scalability for RESTful services exposed over the Internet
146 Cloud Computing
SOAP vs. REST - Security (Chappell, 2009)
- RESTful services commonly use SSL
- Standards for carrying security tokens
- HTTP for username/password
- SSL for X.509 certificates
- This is sufficient for many scenarios
- (e.g., point-to-point Internet communications)
147 Cloud Computing
SOAP vs. REST - Security (Chappell, 2009)
- SOAP-based services can use SSL
- SOAP-based services can also use WS-Security, which provides
- Support for identity through SOAP intermediaries
- Not just point-to-point
- Broader standards for carrying security tokens
- A standard way to provide data integrity and data privacy
148 Cloud Computing
SOAP vs. REST - Transactions (Chappell, 2009)
- ACID transactions that span multiple applications are important in enterprise computing
- ACID transactions don‘t usually make sense across the Internet
- WS-AtomicTransactions addresses this problem
- It relies on WS-Coordination
149 Cloud Computing
SOAP vs. REST - Transactions (Chappell, 2009)
150 Cloud Computing
SOAP vs. REST - Reliability (Chappell, 2009)
- REST
- Assumes application deals with failures via retries
- SOAP with WS-ReliableMessaging
- Builds acknowledge/retry logic into the communications stack
- Can provide end-to-end reliability to one or more SOAP intermediaries
151 Cloud Computing
SOAP vs. REST Capability Summary (Chappell, 2009)
152 Cloud Computing
SOAP vs. REST – Make your Choice (Chappell, 2009)
- Neither is right for every situation
- Each has its place
- Some questions to ask
1. Does the service expose data or logic?
- REST can be a good choice for exposing data
- SOAP might be better for exposing logic
2. Does the service need the capability of W*, or is a simpler RESTful service sufficient?
3. What is best for the developers who will build clients for the service?
- The best decisions come from reasons, not emotion!
160 Cloud Computing
Lecture Announcement
Next semester: “Service Engineering”
Prof. Andreas Schmietendorf
(Master students only)
166 Cloud Computing
Literature
• SOAP vs REST – Complements or Competitors? (Chappell, 2009)
• RESTful Web Services vs. Big Web Services: Making the right Architectural Decision (Pautasso, 2008)
• BPM and SOA (Rosen, 2008)
• Object-oriented Web Services (Neumann & Baumann, 2010)
167 Cloud Computing
And now lean back after another tough lecture…
Java vs. Microsoft .Net