Ambientes de Desenvolvimento Avançados

http://www.dei.isep.ipp.pt/~jtavares/ADAV/ADAV.htm

Aula 16 Engenharia Informática

2006/2007

José António Tavares [email protected]

1

SOA Service Oriented Architecture

2006/2007 ADAV Ambientes de Desenvolvimento Avançados

1 Evolução para os Componentes na Industria

B L M Component-based dept. C++, Eiffel, OOA/D B L M CORBA3.0, (Booch, OMT, EJB, DNA, Distributed objects/systems Pascal, Ada, Objectory) XML, e-commerce, COBOL, RPG, B L M CORBA2.0, Business component Structured Object-orientation OpenDoc, approach methodologies ActiveX, DCOM, B L M UML Structured programming

1970 1980 1990 2000 2010 • B, Bleeding edge is a phase in which a few visionary organizations start to work out certain concepts and apply them, having to create new technologies from scratch or use existing technologies in a very unusual. • L, Leading edge is a phase in which there is industry support for a new technology, but the right way to use this technology is still known to only a few organization. • M, Mature is the phase in which the knowledge of a new approach is largely available and the supporting technologies are stable. 2006/2007 ADAV 3 Ambientes de Desenvolvimento Avançados

History of Distributed Computing

Phase III • MOM Messaging

Phase II • CORBA • DCOM Components • EJB

Phase I • Client/Server Downsize • DCE

2006/2007 ADAV 4 Ambientes de Desenvolvimento Avançados

2 Issues with Existing Models

z Proprietary protocols z Interoperability z Platform lock-in z Flexibility

2006/2007 ADAV Ambientes de Desenvolvimento Avançados

What is SOA?

z IT architecture for request - reply applications z Application functions are modularized and presented as services z Services are loosely coupled z Service interface is independent of the implementation

2006/2007 ADAV Ambientes de Desenvolvimento Avançados

3 Terminology z Message z Data exchanged between services z Not Objects. Code doesn't travel z Context z Defines scope of action, conversation z Clothes-line for state and infrastructure z Destinations z Target service or service class. z Not "http://somewhere/"

2006/2007 ADAV 7 Ambientes de Desenvolvimento Avançados

Service Orientated Architecture

z An architectural approach to creating systems built from autonomous services z Integration as a fore-thought rather than an after-thought z A service is a program you interact with via message exchanges z Services are built to last z Availability and stability are critical z A system is a set of deployed services cooperating in a given task z Systems are built to change z Adapt to new services after deployment

2006/2007 ADAV 8 Ambientes de Desenvolvimento Avançados

4 Four Tenets of Service Orientation 1. Boundaries Are Explicit 2. Services Are Autonomous 3. Services Share Schema And Contract, Not Class 4. Service Compatibility Is Determined By Policy

ten·etten·et[ténn[ténnəət]t] (plural(pluralten·etsten·ets) ) nounnoun somethingsomething accepted accepted as as an an important important truth: truth: any any of of a a set set of of established established and and fundamentalfundamental beliefs, beliefs, especially especially one one relating relating to to religion religion or or politics politics ( formal(formal) ) aa tenet tenet of of Christianity Christianity

[Late[Late 16th 16th century. century. From From Latin Latin , ,literally literally “he “he or or she she holds,” holds,” the the 3rd 3rd person person present present singularsingular form form of of tenere tenere“to“to hold.”] hold.”] Microsoft®Microsoft® Encarta® Encarta® Reference Reference Library Library 2005. 2005. © © 1993-2004 1993-2004 Microsoft Microsoft Corporation. Corporation. All All rights rights reserved. reserved.

2006/2007 ADAV 9 Ambientes de Desenvolvimento Avançados

Examples of Services

z Storage service z Data transfer z Troubleshooting service z Common theme is monitoring service, storage services and query services.

2006/2007 ADAV 10 Ambientes de Desenvolvimento Avançados

5 Technology Agnostic Interaction

z SOAP / XML is the only hope z COM, CORBA, RMI assume platform z Anything binary assumes platform z Any transport assumes platform z XML InfoSet is the focal point

2006/2007 ADAV 11 Ambientes de Desenvolvimento Avançados

Characteristics of SOA

z Services have platform independent, self describing interfaces (XML) Composable z Messages are formally defined Interoperable Re-Usable z Services can be discovered SOASOA z Services have quality of service characteristics Loosely defined in policies Coupled z Services can be provided on any platform

2006/2007 ADAV 12 Ambientes de Desenvolvimento Avançados

6 Why SOA? – The Cruel Reality

Application Screen Scrape

Download Application Message File Application Queue Screen Application Scrape

Sockets Screen Transaction Transaction Scrape File File Application Sockets Download CICS Gateway RPC File ORB APPC Application Message ORB Application Application Message Transaction Queue Application File Message Queue CICS Gateway Transaction Screen File Scrape Source: Gartner APPC Application Message Download RPC File

2006/2007 ADAV Ambientes de Desenvolvimento Avançados

Why SOA?

z Respond to business changes z Address new needs with existing applications z Unlock existing application investments z Support new channels & complex interactions z Support organic business

Oracle Custom Order New Web Financials Application Application Standard Interface Standard Interface Standard Interface

New Supply Chain Management Application (Business Process or Composite Application)

Standard Interface Standard Interface Standard Interface Siebel Mainframe HR .NET Inventory CRM Application Application

2006/2007 ADAV 14 Ambientes de Desenvolvimento Avançados

7 Anatomy of a Service

New Service Service Consumer

Wrapped Legacy

Interface Proxy

Composite Service Service Service Interface Implementation

2006/2007 ADAV 15 Ambientes de Desenvolvimento Avançados

Service Communication

z Communicate with messages z No knowledge about partner z Likely heterogeneous

Service Service Consumers Producers

2006/2007 ADAV Ambientes de Desenvolvimento Avançados

8 Service Platform

Service Consumers

Service Delivery Bus

Service Service Rules Reporting & Config & Mgmt Change & Config Control Change Control

Service Interfaces and Service Implementations

2006/2007 ADAV 17 Ambientes de Desenvolvimento Avançados

SOA – Based on Standards

Web Service Distributed Management Choreography TPM, Mainframe, Web Service Orchestration Legacy Sys Web Service Coordination Web Service Transactions Web Service Security Applications Web Service Policy Web Service Reliable Messaging SOA Tools J2EE 1.4 App Dev Framework Databases

WS-I Basic Profile SOAP, WSDL, UDDI

J2EE Application Server (OracleAS 10g) B2B Partners 2006/2007 ADAV 18 Ambientes de Desenvolvimento Avançados

9 Benefits of SOA

z Better reuse z Build new client functionality on top of existing Business Services z Well defined interfaces z Make changes without affecting clients z Easier to maintain z Changes/Versions are not all-or-nothing z Better flexibility

2006/2007 ADAV 19 Ambientes de Desenvolvimento Avançados

Web Services

2006/2007 ADAV 20 Ambientes de Desenvolvimento Avançados

10 Conteúdo

z Introdução z história da computação distribuída z Arquitecturas z SOAP z WSDL z UDDI

2006/2007 ADAV 21 Ambientes de Desenvolvimento Avançados

Web Services

z A Web Service is a method that is callable remotely across a network z The Service Web will be the backbone of functionality for the coming generation of distributed applications

2006/2007 ADAV 22 Ambientes de Desenvolvimento Avançados

11 Web Services z Web services são serviços oferecidos via Web. z Web services são aplicações modulares que são autodescritas e podem ser publicadas, localizadas e invocadas de qualquer local na Web (ou numa LAN).

let stock_value = apli2.get_stock("IBM")

2006/2007 ADAV 23 Ambientes de Desenvolvimento Avançados

Web Services

2006/2007 ADAV 24 Ambientes de Desenvolvimento Avançados

12 Web Services

z Companies, suppliers, partners, and customers must be able to work together z Faster than ever before z Over the z Or risk “death by isolation” z Leverage Internet cost structure

2006/2007 ADAV 25 Ambientes de Desenvolvimento Avançados

Web Services

z Possible Solutions z Distributed computing z Web sites (portals) z Web Services

2006/2007 ADAV 26 Ambientes de Desenvolvimento Avançados

13 Computação Distribuída

z CORBA/IIOP (OMG) www.corba.org/ z Common Object Request Broker Architecture z Internet Inter-ORB Protocol z especialização TCP/IP de GIOP (General ...) z Statefull Programming Model z Modelo orientado à ligação (overheads de sessão) z COM e DCOM (MS) www.microsoft.com/com/ z Complexo z Orientado à ligação (overheads de sessão) z RMI (SUN) java.sun.com/products/jdk/rmi/ z Bom desempenho z Apenas para a linguagem JAVA

2006/2007 ADAV 27 Ambientes de Desenvolvimento Avançados

Comunicação síncrona/assíncrona

z DCOM e RMI são orientados ao pedido/resposta z Síncronos; não permitem envio de mensagens só num sentido z JMS (Java) java.sun.com/products/jms/ z Java Message Service z Suporta filas de mensagens e o modelo editor/subscritor z MSMQ (MS) www.microsoft.com/msmq/default.htm z Microsoft Message Queueing z Suporta trocas segura e fiável de mensagens, suporte para transacções, etc.

2006/2007 ADAV 28 Ambientes de Desenvolvimento Avançados

14 Web Services

2006/2007 ADAV 29 Ambientes de Desenvolvimento Avançados

Web Services

Portal Limitations z No standard way to expose functionality z Integration is expensive and error-prone z Hard to outsource z Not designed to be used outside original scope z The problem?

z HTML is designed for presentation to people

z Can’t repurpose it in a general, reliable way

z Don’t even think about screen scraping

2006/2007 ADAV 30 Ambientes de Desenvolvimento Avançados

15 Web Services

2006/2007 ADAV 31 Ambientes de Desenvolvimento Avançados

What Is a Web Service?

z The solution? Web Services! z A Web Service exposes functionality to a consumer z Over the Internet or intranet z A programmable URL z Functions you can call over the Internet

2006/2007 ADAV 32 Ambientes de Desenvolvimento Avançados

16 What Is a Web Service?

z Based on Web standards z HTTP, XML, SOAP, WSDL, UDDI, with more to come z Can be implemented in any language on any platform z Black boxes

z Component-like, reusable

2006/2007 ADAV 33 Ambientes de Desenvolvimento Avançados

Web Services Standards

z XML is the “lingua franca” z SOAP (Message format and protocol) z WSDL (Web Services Description Language) z UDDI (Directory)

2006/2007 ADAV 34 Ambientes de Desenvolvimento Avançados

17 What Is a Web Service?

z A Web Service combines the best features of distributed computing and portals and eliminates the worst z Provides a mechanism for invoking methods remotely z Uses Web standards (e.g. HTTP, XML) to do so

2006/2007 ADAV 35 Ambientes de Desenvolvimento Avançados

What is a Web Service?

z Web Services allow you to interconnect: z Different companies z Many/any devices z Applications z Different clients z Not just browsers z Distribution and integration of application logic z Enable the programmable Web z Not just the purely interactive Web z Web Services are loosely coupled

2006/2007 ADAV 36 Ambientes de Desenvolvimento Avançados

18 What is a Web Service?

z New paradigm for Internet development z Deliver applications as services z Richer, customer-driven experience z Continuous delivery of value/bits z Third-generation Internet

2006/2007 ADAV 37 Ambientes de Desenvolvimento Avançados

What is a Web Service?

z Web Services fornecem uma abstracção entre o código da aplicação cliente e o código da aplicação servidor

2006/2007 ADAV 38 Ambientes de Desenvolvimento Avançados

19 What Is a Web Service?

z "Web services are modular, self-describing applications that can be published, located and invoked from just about anywhere on the Web or a local Network. The provider and the consumer of the XML Web Service do not have to worry about the Operating System, language environment or component model used to create or access the XML Web Service, as they are based on ubiquitous and Open Internet standards, such as XML, HTTP and SMTP."

2006/2007 ADAV 39 Ambientes de Desenvolvimento Avançados

Evolution of the Web

HTML, XML HTML HTML

HTML, XML

Generation 1 Generation 2 Generation 3 Static HTML Web Applications Web Services

2006/2007 ADAV 40 Ambientes de Desenvolvimento Avançados

20 What is a Web Service? Web Service as an API

Application Web Services API

API OS

BIOS Hardware 2006/2007 ADAV 41 Ambientes de Desenvolvimento Avançados

Benefits

z Everyone z Leverage existing infrastructure z “Build or buy” development decisions z Minimize development time/costs z Enterprises z Integration imperative z Dynamic, easy B2B relationships z New Web-based businesses z Greater personalization z New services/new revenue streams z Be “everywhere” vs. single destination

2006/2007 ADAV 42 Ambientes de Desenvolvimento Avançados

21 Web Services Overview Application Model

Partner Web Service

Other Web Services

Partner Web Service Internet + XML

End Users YourCompany.com

Application Business Logic Tier

Data Access and Storage Tier

Other Applications 2006/2007 ADAV 43 Ambientes de Desenvolvimento Avançados

The Components of Web Services

z Web services are comprised of six fundamental components: 1. Delivery medium: Internet 2. Delivery protocol: HTTP 3. Message format/encoding: SOAP 4. Service descriptions: WSDL 5. Web Service Publication: UDDI 6. Web Service Discovery: WS-Discovery

2006/2007 ADAV 44 Ambientes de Desenvolvimento Avançados

22 Web Services – Delivery Medium

z Web services use the Internet as the medium for service delivery.

z Therefore, only computers connected to the Internet can provide or consume a Web service. (Of course, what computers aren’t connected to the Internet nowadays?)

2006/2007 ADAV 45 Ambientes de Desenvolvimento Avançados

Web Services – Delivery Protocol

z Web services use HTTP – HyperText Transfer Protocol – as the delivery protocol. z HTTP is a well-known, simple, open standard that is supported by Web servers, programming libraries, and common client applications, like Web browsers.

2006/2007 ADAV 46 Ambientes de Desenvolvimento Avançados

23 Web Services – Message Format

z Communications to and from a Web service are packaged in messages formatted in SOAP, which stands for Simple Object Access Protocol. z SOAP defines a protocol for formatting a message. z SOAP messages are XML-formatted.

We’ll be examining SOAP extensively in future lectures!

2006/2007 ADAV 47 Ambientes de Desenvolvimento Avançados

Web Services – Service Description

z Web services need to be self-describing. That is, a Web service needs to be able to spell out precisely what services it offers, how the services can be invoked, and the service interface. z This description is accomplished with WSDL, or Web Service Description Language. z WSDL is an XML-formatted file that provides this information vital to those who wish to consume the Web service.

2006/2007 ADAV 48 Ambientes de Desenvolvimento Avançados

24 Web Services – Publication

z In order for others to be able to find out about the Web services a company offers, there is a public directory of Web services. z UDDI, or Universal Description, Discovery, and Integration, is an online directory of Web services. z This directory is jointly managed by IBM, SAP, SUN, Microsoft, and other major players.

2006/2007 ADAV 49 Ambientes de Desenvolvimento Avançados

Web Services - Discovery

z WS-Discovery specifies a protocol for developers to discover the Web services a particular Web site/company offers. z WS-Discovery is useful for learning about the Web services a particular company or department provides.

We’ll talk about WS-Discovery in more detail in future lectures!

2006/2007 ADAV 50 Ambientes de Desenvolvimento Avançados

25 Two Views of Web Services

z Keep in mind that when working with Web services you will be taking one of two approaches: z You will be a producer. This means you will be creating a Web service for others to utilize. z You will be a consumer. This means you know of some Web service that you wish to utilize via a desktop application or Web page.

As we will see throughout this class, both producing and consuming Web services with .NET is a breeze!

2006/2007 ADAV 51 Ambientes de Desenvolvimento Avançados

Questionário

Indique quais os problemas da herança por implementação na COP (Component Oriented Programming). Em que medida a composição tenta resolver esses problemas?

z Resposta por email até 06/12/2005 para [email protected] no corpo da mensagem.

z Não são admitidos ficheiros em anexo.

2006/2007 ADAV 52 Ambientes de Desenvolvimento Avançados

26 Questões ?

2006/2007 ADAV 53 Ambientes de Desenvolvimento Avançados

27