Sunteți pe pagina 1din 31

INFS 3204/7204

Service-Oriented Architecture
Mid-term exam revision
Dr Kevin (Kai) Zheng
1

About this revision

The materials shown in this revision are (very) possibly


tested in the final exam

The questions in the exam may not be exactly the same as the
ones in this lecture note
Its important for you to understand them, not just memorize
You will be asked to write simple lines of code in C# on the
paper, which may include defining class, variables in primitive
types, writing simple statement like assigning values, if-else,
for, foreach

Outline

SOA (lecture note 1)


Web Service (lecture note 1 & 4)
.NET and C# (lecture note 2 & 3)

Definition of SOA

SOA is a architectural style which is composed of a


collection of loosely-coupled, discoverable, reusable, and
inter-operable services

Traditional Application Architecture


(Single-tier architecture)

Combines everything into a single program


Still widely used
Easy for single programmer to write
Problem:

Functions not very reusable


Difficult to debug and maintain
Difficult and expensive to integrate
Cannot scale because it is difficult to spread any part of the
application across several physical machines

Component-Based Application Architecture


(3-tier architecture)

First addressed the problem of integrated code by defining


layers of functionality
More robust, scalable and maintainable
Problem:

Cross-language problem (C++ components


used by VB?)
Cross platform problem
Difficult to integrate

Common problem: integration

They are both tightly coupled solution


Applications are aware of each others implementation
details
Requires custom code or human effort
Can be fragile

How SOA address integration problem

Service abstraction

Standard

Presentation layer is replaced with service layer


Hide more implementation details
Describing service in machine-understandable way
Standard communication protocol
Standard description language
Software implemented by different languages and on different
platforms can talk to each other

What does loose-coupling means


Coupling is dependency between interacting systems

Real dependency is the set of features or services that a system


consumes from other systems. It always exists and cannot be reduced.
Artificial dependency is the set of factors that a system has to comply
with in order to consume the features or services provided by other
systems. It always exists, but can be reduced.

language, platform and API dependency, etc.

Loose coupling describes the configuration in which artificial


dependency has been reduced to the minimum

Characteristics of SOA

10

Reusability
Legacy leverage
Agility
Loose coupling
Interoperation

A basic SOA architecture


(different roles in SOA architecture)

Service

Service provider
Service consumer

Software and/or hardware


Support or automate a business function

Can be a service provider in the meantime

Service repository/directory (optional)

11

Directory for publishing and listing available services for


consumers

Service: component of SOA

Has a clearly defined interface, which is exposed through


some standard contract
Is usually discoverable
Can correspond to real-life business activities
Interacts with other services using loosely-coupled,
message-based architecture
Uses standards for communication for interoperability
Is up and ready-to-use all the time, unlike components
that must be instantiated before use

Characteristics of a service
12

Types of services

Atomic service

Well-defined, self-contained function


It is impractical to decompose an atomic service because of its
fine-grained structure (offer limited functionality)
Does not depend on the context or state of other services

Composite service

13

Assembly of atomic or other composite services


Only depends on its child services
E.g., an application, a software product, a database

SOA does not specify

What is the service about?


How the services communicate with each other? (http,
xml)
What software/hardware should be used?
SOA is an architecture, not an implementation

VS

Build architect
14

Builder

Benefit of SOA

For business and government:

Becoming more agile


Driving cost reductions
Boosting ROI (return on investment)

For IT:

15

Simpler systems
Lowering maintenance costs
Enhancing architectural flexibility
Lowering integration costs

Outline

SOA (lecture note 1)


Web Service (lecture note 1 & 4)
.NET and C# (lecture note 2 & 3)

16

Web Service

A web service is a

17

programmable application component


accessible via standard web protocols (http)
communicate via XML-based interface

Web Service Lifetime

18

Relationship of SOA and web service

Web service is one of the possible


implementations of SOA
Currently the best practice due to its global
standard
Web service standardize the connection inbetween the services in SOA
Web service can be used for other purposes

19

Key aspect of web service

Standard protocol

Service description

Transport: HTTP, SMTP, FTP, etc


Messaging: SOAP over HTTP (most popular one)
describe their interfaces in detail so that a client knows how to
consume the functionality
WSDL document (Web Services Description Language)

Finding services (Discovery)

20

need to know what web services exist and where to find them
Yellow pages
UDDI repositories (Universal Discovery, Description, and
Integration)

What is SOAP

A simple XML-based protocol to let applications


exchange information over HTTP

Simple Object Access Protocol


A communication protocol
A format for sending messages
Based on XML
Platform, language independent

SOAP message structure

A SOAP message is an ordinary XML document


containing the following elements:

An Envelope element that identifies the XML document as a


SOAP message
A Header element that contains header information
A Body element that contains call and response information
A Fault element containing errors and status information

What is WSDL

Web Service Description Language


XML-based language for describing Web services and how to
access them

23

how the service can be called


what parameters it expects
what data structures it returns

Outline

SOA (lecture note 1)


Web Service (lecture note 1 & 4)
.NET and C# (lecture note 2 & 3)

24

What is .NET

A software framework developed by Microsoft that runs


primarily on Microsoft Windows
Microsofts strategy for developing large distributed software
systems since 2000
Microsoft considers it equivalent to transition from DOS to
Windows
All the future software development on Windows platform
will be primarily based on .NET framework

25

.NET architecture

26

Common Language Runtime

The foundation of .NET Framework, providing a


managed environment for code execution

Support cross-language interoperability in tightlyintegrated fashion

27

Garbage collection, exception handling, security

C#, F#, VB.net, C++.net (managed extension), etc


Define a class in one language, then use another language,
and call a method of it

CLR Execution Model


(how .NET achieves cross-language interoperability)
Source
code

MSIL

VB

C#

C++

Compiler

Compiler

Compiler

Assembly

Assembly

Assembly

Common Language Runtime JIT Compiler

Native
code

Managed
Code

Managed
CLR
Code

Managed
Code

CLR Services

Operating System Services

28

Two-phase compilation

Unmanaged
Code

C# -- basics

You should be able to define and use:

Control logic

While, ifelse, foreach, etc

Handle exception

Primitive types int, float, string, etc


Arrays int[]
Class, field, property, method, constructor
Simple expression and statement int a = 3;
Attributes - [WebMethod], [ServiceContract], etc

Trycatchfinally, throw

You should know

29

Boxing and unboxing


Value type and reference type
Public, private, protected

C# -- OO programming

OO principles

Class inheritance
Polymorphism
Encapsulation

You should be able to

30

Derive a subclass
Use virtual method to achieve dynamic binding

Virtual+override vs. new

New

Lecture note 3

Nothing to do with polymorphism


Re-define the function in subclass
Depends on the declared type in compilation time

Virtual+override

31

Polymorphism
Depends on the real type in run time

S-ar putea să vă placă și