Bài giảng Web technologies and e-Services - Bài 9, Phần 2: Service-oriented architecture - Nguyễn Bình Minh
5/13/21
IT4409: Web Technologies and e-Services
2020-2
Service-Oriented Architecture (SOA)
Instructor: Dr. Thanh-Chung Dao
Slides by Dr. Binh Minh Nguyen
Department of Information Systems
School of Information and Communication Technology
Hanoi University of Science and Technology
1
TOPICS
Introduction to SOA
§ Service
§ Service Oriented Architecture
Web services
Web services programming
§ SOAP Web services
§ REST Web services
2
1
5/13/21
History of creating application
Programming with
§ 0 and 1
§ Assembly
§ Procedural programming language
§ OOP programming
§Service-Oriented Architecture
3
What is a service?
Restaurant provides food: a service
After the order is taken, food is produced, served,
…: service may consist of other services
The menu indicates the service provided: a
service description
The order is written down, or yelled at, the cook:
services communicate through messages
4
2
5/13/21
What is a service in IT?
An entity that provides some capability to its clients by exchanging
messages (request - response)
Request
Response
5
Service characteristics
n Services are autonomous
n Services hide their logic
n Services are reusable
§ Services can (must) be
discovered
§ Services can be composed to
form larger services
§ Services adhere to a service
n Services use open standards
description/contract
§ Services are loosely coupled
§ Services are stateless
6
3
5/13/21
Loosely coupled, stateless, autonomous & hide logic
§ Loosely coupled: system is one in which each of its components has, or makes
use of, little or no knowledge of the definitions of other separate components
§ Stateless: Rental agencies come and go, the agencies cannot retain information:
it doesn’t know if and when it will be invoked again, and by whom
§ Autonomous: Its logic does not depend on the tenants
§ Hide logic: Rental agency has its own rules on how to structure its process
9
What is SOA?
SOA is a software architecture model in which business functionality are logically
grouped and encapsulated into self contained, distinct and reusable units called
services
represent a high level business concept
can be distributed over a network
can be reused to create new business applications
contain contract with specification of the purpose, functionality, interfaces, usage
10
4
5/13/21
SOA from different views
A set of business services
composed to capture the business
design that an enterprise wants to
expose to its customers and clients
Business
An architectural style that requires
a service provider, requester and a
service description
Architecture
A programming model complete
with standards, tools, methods and
technologies such as Web services
Programming
11
Application centric
Business scope
Narrow Consumers
Limited Business Processes
Finance
Application
Application
Integration
Supply
Architecture
Redundancy
Distribution
Manufacturing
Overlapped resources
Overlapped providers
Business functionality is
duplicated in each application that
requires it.
12
5
5/13/21
Service centric
Business scope
Multiple Service Consumers
Multiple Business Processes
Finance
Service
Service
Service
Supply
Service Architecture
Shared
Services
Service
Distribution
Manufacturing
Multiple Discrete Resources
Multiple Service Providers
Service virtualizes how that capability is performed,
and where and by whom the resources are provided,
enabling multiple providers and consumers to
participate together in shared business activities.
SOA structures the business and its systems as a set of
capabilities that are offered
as Services, organized into a Service Architecture
13
Application centric vs Service centric
14
6
5/13/21
Why SOA?
Enabling alternative
implementations
Enabling a virtual federation of
participants to collaborate in an
end-to-end business process
Enabling reuse of
Services
Service
Identification
Ticket Collection
Service
Service
Ordering
Ticket Sales
Service
Service
Service
Inventory
Service
Service
Service
Logistics
Service
Availability
Manufacturing
Enabling aggregation from multiple
providers
Enabling virtualization of business resources
15
SOA is an evolutionary step
16
7
5/13/21
SOA layered architecture
Example Layers
Reasons for Layering
Presentation
& workflow
1.
Flexible composition.
Reuse.
2.
Composed Services
3.
4.
5.
Functional standardization in lower levels
Customization in higher layers
Separation of Concerns.
Basic Services
6.
Policies may vary by Layer
Underlying
API
19
TOPICS
Introduction to SOA
§ Service
§ Service Oriented Architecture
Web services
Web services programming
§ SOAP Web services
§ REST Web services
21
8
5/13/21
Web services & SOA
Web services is chosen for SOA because:
§ Loose coupling
Service requesters depend only the interface described in WSDL and not
on the implementation of the service provide
§ Interoperability
Service interactions are based on the exchange of XML-based SOAP
messages over standards based transport protocols
§ Wide industry support
Wide industry support for adoption of Web services standards promotes
interoperability of various vendor platforms that support Web services
22
What is web service?
Implementation means to realize services
Based on open standards:
§ XML
§ SOAP: Simple Object Access Protocol
§ WSDL: Web Services Description Language
§ UDDI: Universal Description, Discovery and Integration
§ BPEL4WS: Business Process Execution Language for Web Services
Main standardization bodies: OASIS, W3C
23
9
5/13/21
One for all …
Browser
GUI
Browser
Client
Web
Server
WSDL
HTTP GET/POST
SOAP
WSDL
Web
Server
Web
Server
SOAP
JDBC
JDBC
DB
DB
24
OSI and Web service
Application
Application
Presentation
Session
Application
Web Services
Others
TCP
UDP
Transport
Network
TCP
Ipv4, IPv6
Ipv4, IPv6
Device Driver
&
Hardware
Datalink
Device Driver
&
Hardware
Physical
OSI Model
Internet Protocol
Suite
Web Services
Model
25
10
5/13/21
Example
Web Services Based Travel Web Site
Web Services
Client
Application
Airlines -- Delta
RDMS
Web Browser
Web Browser
Hotels -- Marriot
Automobiles -- Hertz
Web Browser
Travel
Customers
Travel Services -- Sabre
26
Open standard technologies for web service
XML – tagging data such that it can be exchanged between applications and
platforms
SOAP – messaging protocol for transporting information and instructions between
applications (uses XML)
WSDL – a standard method of describing web services and their specific capabilities
(XML)
UDDI – defines XML-based rules for building directories in which companies
advertise themselves and their web services
27
11
5/13/21
XML
Developed from Standard Generalized Markup Method (SGML)
XML widely supported by W3C
Essential characteristic is the separation of content from presentation
XML describes only data
Any application that understands XML can exchange data
28
XML
XML parser checks syntax
If syntax is good the document is well-formed
XML document can optionally reference a Document Type Definition (DTD), also
called a Schema
If an XML document adheres to the structure of the schema it is valid
29
12
5/13/21
SOAP
SOAP enables between distributed systems
SOAP message has three parts
§ envelope – wraps entire message and contains header and body
§ header – optional element with additional info such as security or routing
§ body – application-specific data being commuicated
30
TOPICS
Introduction to SOA
§ Service
§ Service Oriented Architecture
Web services
Web services programming
§ SOAP Web services
§ REST Web services
34
13
5/13/21
Three Most Common Styles of Use
RPC (Remote Procedure Calls)
§ A distributed function call interface
SOAP (Simple Object Access Protocol)
§ The basic unit of communication is a message, rather than an operation
REST (Representational State Transfer)
§ Standard operations in HTTP: GET, POST, PUT, DELETE
§ Interacting with stateful resources, rather than messages or operations
35
RPC Web Services
Basic unit: WSDL operation
Widely deployed and supported, but not loosely coupled
Other approaches: CORBA, DCE/RPC, Java RMI
36
14
5/13/21
SOAP Web Services
Basic unit: message
Envelope
Header
Supported by most major vendors, loose
coupling
Body
Message
Payload
37
Representational State Transfer (REST)
Interacting with stateful resources, rather than messages or operations
Using HTTP standard operations such as GET, POST, PUT, DELETE
WSDL 2.0 offers support for binding to all HTTP request methods
§ WSDL 1.1 only GET and POST
38
15
5/13/21
SOAP web service
§ HTTP-XML-based protocol
§ Enables application to communicate over Internet
§ Uses XML documents called messages
§ SOAP message contains an envelope
§ Describes message’s content and intended recipient
§ Ability to make a Remote Procedure Call (RPC)
§ Request to another machine to run a task
39
SOAP
Using Web Services and SOAP, the request would look something like
this:
<?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:body pb="http://www.acme.com/phonebook">
<pb:GetUserDetails>
<pb:UserID>12345</pb:UserID>
</pb:GetUserDetails>
</soap:Body>
</soap:Envelope>
40
16
5/13/21
Pros & cons
n Disadvantages
Advantages
§ Human readable XML
n S-L-O………………..-W
§ Easy to debug
§ SOAP runs over HTTP
§ Firewalls not affected
§ Services can be written in any
language, platform or operating
system
n XML produces a lot of overhead for
small messages
n Web Services speed relies on Internet
traffic conditions
n Not strictly-typed XML
41
SOAP web service by Java
Java Client
Environment
Java Enterprise
Environment
Internet
WSDL
Java
RDBMS
WS Endpoint
Interface
WS Attribute
Classes
wsimport
Application
Web Service Server
Web Service
Client
Application
Framework
•Java
•.Net
WS Endpoint
Publisher
RDBS
JSE 6 .jar
• Java Web Services Development Environment
• Fully Integrated Framework and Utilities
• End to End Enterprise/Client Communications
javax.jws
javax.xml.ws
javax.xml.rpc
javax.xml.soap
javax.xml.bind
42
17
5/13/21
Android Web Services Development Environment
Web Service
Missing Tool
Components
Java
RDBMS
Application
WS Endpoint
Interface
Proc beans
xml Abst
WSDL
kSOAP2
wsimport
Framework
•Java
•.Net
WS Endpoint
Publisher
Android
Java WS
Client
RDBS
Java .jars
javax.jws
javax.xml
othes...
Missing Library
Components
43
SOAP vs REST
SOAP
REST
Meaning
Simple Object Access Protocol
Representational State Transfer
Design
Standardized protocol with pre-defined rules Architectural style with loose guidelines and
to follow. recommendations.
Approach
Function-driven (data available as services, e.g.: Data-driven (data available as resources, e.g.
“getUser”) “user”).
Statefulness
Stateless by default, but it’s possible to make Stateless (no server-side sessions).
a SOAP API stateful.
Caching
API calls cannot be cached.
API calls can be cached.
Security
WS-Security with SSL support. Built-in ACID Supports HTTPS and SSL.
compliance.
Performance
Requires more bandwidth and computing power. Requires fewer resources.
Message format
Transfer protocol(s)
Recommended for
Only XML.
Plain text, HTML, XML, JSON, YAML, and
others.
HTTP, SMTP, UDP, and others.
Enterprise apps, high-security apps,
distributed environment, financial services,
payment gateways, telecommunication
Only HTTP
Public APIs for web services, mobile services,
social networks.
services.
Advantages
High security, standardized, extensibility.
Scalability, better performance, browser-
friendliness, flexibility.
Disadvantages
Poorer performance, more complexity, less
flexibility.
Less security, not suitable for distributed
environments.
44
18
5/13/21
email: chungdt@soict.hust.edu.vn
Q&A
45
19
Bạn đang xem tài liệu "Bài giảng Web technologies and e-Services - Bài 9, Phần 2: Service-oriented architecture - Nguyễn Bình Minh", để tải tài liệu gốc về máy hãy click vào nút Download ở trên
File đính kèm:
- bai_giang_web_technologies_and_e_services_bai_9_phan_2_servi.pdf