A apresentação está carregando. Por favor, espere

A apresentação está carregando. Por favor, espere

Caio Nakashima caio.nakashima@mds.gov.br caionakashima@gmail.com EJB WebService Caio Nakashima caio.nakashima@mds.gov.br caionakashima@gmail.com.

Apresentações semelhantes


Apresentação em tema: "Caio Nakashima caio.nakashima@mds.gov.br caionakashima@gmail.com EJB WebService Caio Nakashima caio.nakashima@mds.gov.br caionakashima@gmail.com."— Transcrição da apresentação:

1 Caio Nakashima caio.nakashima@mds.gov.br caionakashima@gmail.com
EJB WebService Caio Nakashima

2 Evolução da Computação em Rede

3 Waves of Network Computing
Things Embedded Computers Thermostats Cars Switches TVs Computers 108 Packages Phones Clothes Games Desktops Clients Transfers Transactions Content Telemetry Control Functions IP v4 IP Layer IP v6 Protocols Organization

4 Waves of Network Computing
Things Embedded Computers Thermostats Cars Switches TVs Computers 108 Packages Phones Clothes Games Desktops Clients Transfers Transactions Content Telemetry Control Functions IP v4 IP Layer IP v6 Protocols FTP SMTP X RMI/IIOP Telnet RPC/XDR Identity Organization LDAP HTTP SOAP Jini Client/Server UDDI JXTA N-tier Web Applications Web Services Polyarchical Fractal

5 O novo software Software Software como serviço Payment Developer X1
Locater X106 New Service User’s Device X106 Calendar Authentication Software Software como serviço

6 Evolução da Computação Distribuída

7 Evolução da Plataforma
The Network Is the Computer The Computer Is the Network Network of Embedded Things Catch Phrase Legacy to the Web Network of Things Objects Scale 100s 1,000s 1,000,000s 10,000,000s 100,000,000s 100,000,000s When/Peak 1984/1987 1990/1993 1996/1999 2001/2003 1998/2004 2004/2009 Leaf Protocol(s) +HTTP (+JVM) +XML Portal X X +RM Unknown Directory(s) NS, NS+ +CDS +LDAP(*) +UDDI +Jini +? +CORBA, RM +SOAP, XML Session RPC, XDR +CORBA +RM/Jini +? This table shows the evolution of distributed computing considering several factors such as the number participating computing devices or software entities in the network, interaction behavioral or pattern among the participants, and underlying technologies used to enable those interactions. The commonality among these distributed computing technologies is that they are all used to deliver services in one form or another in a networking environment. In the beginning, we had a simple client and server model, which has then evolved into 3-tier and object-based remote computing model, which we will talk about later again in a bit more detail. Then they evolved into the current state of distributed computing technologies, which are illustrated in the middle tiers of the table bounded by a yellow box and they are web-based computing of today and web services computing of tomorrow. And they are the focus of J2EE architecture and Sun technologies and products right now. In the future where we expect massive number of computing devices and software entities are forming massive number of networks in a very dynamic fashion, we expect other service delivery technologies such as Jini and Jxta could be quite useful. Let's take a look at the communicating patterns of the different phases. Schematic

8 Padrões de comunicação
Client- Server Web Application Web Services Hybrid P2P 3-Tier Fractal This slide shows the communicating pattern in terms of number of tiers and interaction among internal entities and external entities. As you can tell, until Web services model, things are pretty much confined to intranet communication.

9 Communication Patterns: Java 2
Business Systems DB Server App Server J2EE Web Server J2SE/ J2ME Browser Client Now since the web application and web services models are two dominant communication patterns, let's look into them in a bit more detail. Here this slide shows web application communication model in which J2EE architecture is made of web server, application server, and database server tiers while J2SE and J2ME handles client tier. Web Application

10 Padrão de comunicação: Sun ONE
Bus. Sys. XML (UDDI, SOAP) DB App J2EE Web J2SE/ J2ME Browser Context and Identity (LDAP, Policy, Liberty) This picture shows communicating pattern of web services in which business organizations are beginning to talk to each other leveraging loosely-coupled nature of web services. Web Service

11 Conceito A ideia atrás de Serviços Web é expor uma aplicação como um serviço para clientes na Web, independentemente da aplicação do cliente e seu ambiente de execução. A interoperabilidade é o mais importante característica de um Serviço Web e todos os provedores de tecnologias disponíveis, incluindo Microsoft, estão aderentes aos padrões. Por exemplo, um cliente C# sendo executado em .NET pode chamar um serviço implementado em Java EJB em um contêiner J2EE. A interoperabilidade significa que estes serviços são fracamente acoplados que EJB.

12 Padronização Existem duas organizações que trabalham na padronização de Serviços Web. World Wide Web Consortium (W3C) Organization for the Advancement of Structured Information Standards (OASIS) Eles trabalham na padronização: SOAP e WSDL – W3C UDDI - OASIS

13 Web Services / W3C Um WebService é uma aplicação de software
Identificado por uma URI, cuja interface e atribuição são definidas, descritas e descobertas através de artefatos XML e suporta interação direta com outras aplicações de software utilizando mensagens XML via protocolos internet

14 Evolução da Computação Distribuída
Servers Servers Clients Internet Cell Phone Cliente Servidor PDA Clients Web-based computing Server Workstation Kiosk Laptop Web Services/Peer-to-Peer

15 Cliente/Serivdor x. Web Services
Cliente / Servidor Web Service Dentro da Empresa Dependente de um conjunto de linguagem Procedural Geralmente limitado por um protocolo de transporte Fortemente Acoplado Processamento Eficiente (tempo / espaço) Entre Empresas Independente de Linguagem de Programação Baseado em Mensagem Facilmente adaptado em diferentes protocolos de transporte Fracamente Acoplado Processamento não eficiente Now let's compare traditional RPC which is the typical communication model used in the first generation distributed computing technology we just saw against Web services. First, traditional RPC is typically used within an enterprise while the real value of web services is to enable enterprise to enterprise communication in an ad-hoc manner over the internet. RPC is typically programming language dependent while Web services is programming language independent because as we will talk about again, the communication under Web services model is done by exchanging XML messages, which has no dependence on a particular programming language. RPC is typically tied up with a particular transport protocol while under Web services model, multiple transports can be easily supported because any transport protocol that can transport XML message can be used. You will hear a lot about "loosely-coupled" nature of Web services. Because, the only contract that have to be agreed upon between communicating parties under Web services is the syntax and semantics of XML messages, in other words, there is no need to agree on anything else. For example, there is no need to agree on object model, there is no need to agree on programming language, there is no need to agree on programming APIs. This is why we call Web services "loosely-coupled".

16 Ajuda Fracamente acoplados Fortemente acoplados
permitem que máquinas e usuários de um sistema distribuído sejam fundamentalmente independentes e ainda interagir de forma limitada quando isto for necessário, compartilhando discos, impressoras e outros recursos. Fortemente acoplados provê um nível de integração e compartilhamento de recursos mais intenso e transparente ao usuário caracterizando sistemas operacionais distribuídos. Fonte:

17 Aplicação Web x Web Services
Interação Usuário - Programa Componentes de Integração Estática Serviço Monolítico InteraçãoPrograma- Programa Possibilidade de integração de componentes (no futuro) Possibilidade de agregação de serviço (no futuro) Just to give you a sense on the differences between Web application which is the second generation distributed computing we saw and web service model. Web application in its current form is typically focused on between an end user and program while under web services model, program to program communication would be much more common form of communication. Also under web application model, things are pretty much in static mode. That is, in order to integrate various applications, you have to statically configure them to talk each other. Under web services model, things could be a lot more dynamic, that is, service users will find service provider and use the services of those providers more dynamically. Also under Web services model, services can be aggregated again in a ad-hoc and dynamic fashion.

18 Web Services Service Grid Registro Registro do Serviço
Chamada do Serviço Descoberta do Serviço Entrega de Serviço This is the high level web services architecture. The cloud at the top right hand side, the service grid, is a set of web services on the internet. These services are accessible to the various client devices shown at the bottom of the picture. When a web service is created, it registers itself to a service registry. By registering in the the service registry, the Web service exposes its interface to any client that is interested in accessing it. When a client requires a certain service, it first looks in the service registry, this is the service discovery phase. Once an appropriate web service has been located, the client then invokes the web service, which delivers the service to the client.

19 Montagem do Serviço Macro Serviço Micro Serviço Business Process
Management Anatomy of an assembled macro service. Micro Serviço Micro Serviço

20 Agregação do Serviço Nasdaq Portal de Serviço de Ações Usuário
Entrada: Codigo Saída: Preço Portal de Serviço de Ações Entrada: Codigo Saída: Preço, Notícia, Comércio Agência Notícias 1 Entrada: Codigo Saída: Notícias Usuário Agência Notícias n Entrada: Codigo Saída: Notícias Anatomy of an assembled macro service. Corretor 1 Entrada: Codigo, Preço, Qtde Corretor n Entrada: Codigo, Preço, Qtde

21 Web Services? Plataforma Neutra É acessível de forma padrão
Acessível de forma interoperacional Uso simplificado e ubíquo “Barato” – não caro Integração simplificada

22 Web Services? Interoperável – conecta em redes heterogêneas utilizando padrão baseado na web ubíquo. Econômico – recicla componentes, não requer instalação e forte integração de software. Automático – Não requer interação humana para transação complexa. Acessível – Sistemas legados e aplicações internas podem ser expostas e acessíveis via Web. Disponibilidade – Serviço em qualquer dispositivo, em qualquer lugar e quando desejar. Escalável – Sem limite para o escopo e heterogeniedade das aplicações. (read the slide)

23 Web Services Exemplo de uso
Distribuidor XML XML Fábrica Fornecedor Internet XML XML Now let's talk about motivation of Web services a bit from real-life example point of view. That is, what is the value proposition of Web services? I would like to explain this by giving you an e-commerce example. One great opportunity and at the same time great challenge in e-commerce is to allow business entities to perform business transactions over the internet without having to invest a lot of resource in their IT infrastructure and without a lot of pre-arrangement with their communicating partners. For example, suppose I am in the retail business in the United States, and as a retailer, I would like to work with any potential supplier or distributor in the world. And I would like to change my supplier as often as needed and whenever there is a business requirement for the change. And that means my information system needs to be able to talk to the system of my potential supplier without that much of pre-arrangement and pre-agreement on programming language or middleware or platform. What it means is that there is a growing need for standard lightweight infrastructure for business data exchange. Now everybody seems to agree that XML and messaging based business transaction will address these needs. XML messaging based business communication is lightweight because the only agreement between communicating parties is commonly agreed-upon XML business messages. Of couse, you will need a lot more than that. But commonly agreed-upon XML-based business messages will these previously isolated business organizations to be able to communicate. And that is basically what web services is all bout. It provides lightweight infrastructure for business to communicate through exchange of XML messages. Logistica “Crescimento baseado em uma infraestrutura leve e padronizada para troca de informações em aplicações de negócio”

24 Impacto do Web Services nas aplicações
“Des integração da aplicação” Web Services Programa Monolítico Serviço Apl Serviço Apl Serviço Apl Applicação Programa Serviço Sistema Serviço Sistema Serviço Sistema I told you already a web service is some business functionality exposed over the internet. What it entails is that today's monolithic applications will be disintegrated into several forms of web services which exposed as services over the internet. We believe web services can be categorized into application and system service web services. Examples of Application Services are a commerce shopping cart or a calendar appointment service. System services are expected to provide common services that would be used by application servers and the examples of System Services are identity, policy/authorization, directory service, notification, logging, file storage service, and so on. Computador Internet/Intranet/Extranet

25 Macro web services – Sistemas Virtuais
Um web service é acessível através de aplicações ou outros serviços. Web Services Balanço Finanças Contas Fluxo de Caixa Web services are accessed programmatically, not by a human user directly. In the case of an online broker, the user can surf the HTML pages regarding the purchase of a stock, such as finding stock symbol, finding price, entering number of shares requested, confirming the purchase request, getting a confirmation number, etc. But it would be very difficult to write a program to access these pages. HTML is hard to parse and the website might change the contents and organization of its pages on a daily basis. If the broker offered a stock-buying web service, the program to access it is simple—send an XML message over the SOAP RPC and get and XML message back. You could write a simple Perl script or Visual Basic program to accomplish this. Web services are well-defined, modular services that perform a specific task, but can be interlinked together to provide a larger set of services. This example shows how a Portfolio application can be developed out of web services assembled from all over the Internet. As noted, Portfolio could be a desktop or server application, a channel in the Portal Server desktop, or it could be a web service itself, ready for assembly into an even larger service or application. Side note: Today you can develop components following the J2EE model, such as with EJBs. Thus, this concept can be achieved today with Sun ONE. More importantly it should be noted Java and web services are complementary. You need to write the code to implement each micro service in some language. The industry has accepted the standard of writing enterprise applications using the J2EE model. Portfolio Informação Estoque CNN “Portfolio” pode ser uma aplicação, um portal ou um webservice Notícias UOL

26 Micro web services – Sistemas Virtuais
Um web service é acessível através de aplicações ou outros serviços. Web Services Ortografia Bank balance Gramática Dicionário Sinônimos Editor de Texto W Mídia c:\... “Editor de Texto” pode ser aplicação, uma funcionalidade ou um web service Publicação

27 Três leis da computação
Lei de Moore O poder da computação dobra cada 18 meses. Lei de Gilder A largura de banda dobra a cada 12 meses. Lei de Metcalfe (Efeito da Rede) O valor da rede cresce exponencialmente a medida que cresce o número de usuários S

28 Impacto da Integração Gatilho do efeito da rede
customizada Web Services Another impact of web services is that they will trigger the Network Effect for integration technology. Metcalfe’s Law describes the an effect that is often illustrated with an example of FAX machines. The first FAX machine had zero value because it could communicate with no one. When a second came on line, the value increased. And as the network reached a critical mass, it compelled more and more users to get FAX machines. This is also called the Network Effect. Lei de Metcalfe: O valor da rede é proporcional ao quadrado do número de participantes.

29 Mitos: Web Services novo Conceito
Web services é uma computação distribuída

30 Mitos: Web Services novo Conceito
Webservice requer somente: SOAP, WSDL, UDDI Necessita de uma semântica de alto nível Webservice é baseado no paradigma RPC Modelo de comunicação baseado em documentos será mais popular. Webservices deve ser baseado em HTTP: Outros protocolos de transporte podem ser utilizados.

31 Web Services O que falta além dos serviços: Deficiências:
SOAP, WSDL, UDDI Deficiências: Qualidade de serviço Gerenciamento Segurança Transação Contexto de usuário Gerenciamento de Identidade Workflow

32 Web Services - Receita 3a fase (pelo menos 3 a 4 anos) 1a fase
Implantar uma aplicação internamente da organização procurando interoperabilidade. SOAP sobre HTTP/S 2a fase (1 a 2 anos) Implantação com um parceiro confiável. Registro privado. 3a fase (pelo menos 3 a 4 anos) Implantar para todos. Registro público.

33 Web Services Fases 1a Fase –Web Services Simples
Focado no cliente, stateless, SOAP over HTTP/S 2a Fase –Web Services EAI (enterprise application integration) Implantado dentro da organização para permitir a integração interna. 3a Fase – Business Web Services Implantado em extranet para transações comerciais com parceiros de negócio, fornecedores e clientes, ebXML & UBL First, let me tell you this up front, J2EE community incuding Sun microsystems strongly believe in the vision and promise of web services. Now we believe web services will be adopted in phases. First phase is where simple web services are used in consumer oriented settings typically for the purpose of simple consumer-oriented transaction. In the second phase, we believe that web services could be used for enterprise application integration, EAI in short, within an intranet. And in fact many organizations have started looking at Web services as one way of doing EAI. And we believe this phase has already begun. The 3rd phase could be dubbed as business web services where business organizations are performing business transactions with their trading partners, suppliers, or even customers through the exchange of XML-based business messsages over the internet.

34 Business Web Services J2EE ebXML e UBL Liberty Project
Plataforma padrão para implementação do serviço ebXML e UBL Electronic Business using eXtensible Markup Language (ebXML) Universal Business Language (UBL) Padrões business web services Mais de 16 fornecedores e muito projetos Open Source Liberty Project Padronização para sistema de identificação Even though we believe simple web services and EAI are important forms of web services, we also believe the real value of web services lies with business web services. That is the reason why we are investing quite a bit of our engineering resources to key technologies that will enable business web services. First, we believe J2EE provides a standard-based implementation and deployment platform where not only simple web services and EAI web services but also business web services can be developed and deployed while maintaining all the benefits that come with the architecture, that is, scalability, reliability, availability, performance, security, flexibility, maintenability, portability, and extensibility. Second, we firmly believe ebXML and UBL (Universal Business Language) provide viable and only open-standards based business web services framework. And II want to say it loud and clear. ebXML is real and in fact there are more than 16 commercial vendors and open source-based products that support ebXML right now including Sun Microsystems's Secure Trading Agent. In fact, real life customers are using ebXML right now for solving real-life problems. For example, austrailian energy industry is using ebXML mesasging service for secure and reliable XML message delivery. And we believe ebXML adoption will accerlate during the next year or so. Third, Liberty project as Identity management standard which we strongly believe is critical to business web services and e-commerce of the future.

35 Business Web Services (B2B) x (ebXML)
Colaboração B2B Entrega de mensagem segura e confiável Perfil do Parceiro Repositório dos dados de objetos de negócio. i

36 Colaboração B2B Web Services Simples Colaboração B2B Interação Simples
Orientado para cliente Processos curtos Sem necessidade de colaboração de negócio Sem perfil do parceiro Não confiável, não seguro Sem repositório Não suporta atribuição legal Interação Complexa Orientado a negócio Processos longos Suporta colaboração de negócio Suporta perfil do parceiro Seguro e confiável Registro e repositório Suporta atribuição legal S

37 Grande número de processos de negócio e participantes
Colaboração B2B EAI Colaboração B2B Entre empresas Controle Distribuído Contrato Explícito Grande número de processos de negócio e participantes Dentro de uma organização Controle centralizado Contrato implícito Pequeno número de processos de negócio e participantes 1.Centralization vs. Collaboration. A "Centralized model" allows the implementation of integration for EAI because in an Enterprise (even very big and sparse) the different departments are part of the same challenge and, normally, IT is a "shared service" among all the departments. The quality of integration (Integration Server vs MOM) models the ability to describe the "challenge" in a top-down or in a bottom-up way. A "Collaboration model" allows the implementation of integration for different entities, where there is no "central IT" shared by the different entities and where each entity needs to play a peer role. In this model, the "global challenge" of the integrated solution needs to be implemented in a way where each peer contributes to the overall goal (unless the partners agree on the fact that one of them is more important of the other... or agree to elect an ASP as a "shared" resource) 2.Explicit vs. Implicit contract. It is often the case that, within an enterprise, the integrated solution is mandated by the Board of Management (or equivalent) in order to optimize the use of internal resources and to decrease costs. In these situations, the participating departments are "mandated" to participate to the integrated solution; the "contract" linking each of them to the others is, in some way, defined "upfront". This translates into the fact that the EAI solution does not, normally, need to implement any kind of "agreement" because such agreement is, in some way, enforced by the shared IT department. In the B2B case, the agreement is part of life and is a very important ingredient. What makes me liking ebXML is the fact that it provides answers to all the aspects of a "human-like" transaction: it allows the formal definition of a contract (CPP/A) which takes in account the way in which the business is conducted (BPSS) and the means in which it is conducted (the QoS parts of the CPP/A). In B2B, each participating entity should enforce the "contract" that is signed among the participants since there is no central IT that grants this.

38 Tendências Orientadas à Serviço
Evolução da EAI para padrão do WebService XML RPC => Mensagem XML Assíncrono Através da Centralização Serviço componentizados Serviços componentizável e composto Dados encapsulados com o componente Proprietário dos dados com os componentes Corretor de WebServices Relações Flexíveis – Componentes Adaptativos

39 Arquitetura do WS - Componentes
Serviço de Descrição Serviço de Registro (Publicação) e Descoberta Serviço de Invocação What are the core building blocks of web services architecture? At the minimum, you need a standard way of describing a web service that are universally understood by all potential service users and service providers. This is important because without commonly agreed upon description of service, a service provider might have to produce individually tailored way of describing its service to all its potential service users. There has to be registry by which a service can be published and discovered. Then there has to be standard way of invoking a service. Finally, for business transactions in which secure and reliable message delivery is important, there has to be a standard electronic business framework.

40 Arquitetura Web Service (simplificada)
Registro 2. Client Request Service Location PROCURAR 1. Service Registers PUBLICAR The Universal Description, Discovery, and Integration standard provides a mechanism for businesses to "describe" themselves and the types of services they provide and then register and publish themselves in a UDDI Registry. Such published businesses can be searched for, queried, or "discovered" by other businesses using SOAP messages. 3. Client calls Service LIGAR Web Service Serviço Cliente

41 SOAP Simple Object Access Protocol Protocolo similar
IIOP for CORBA Internet Inter-Orb Protocol para Common Object Request Broker Architecture JRMP for RMI Java Remote Method Protocol para Remote Method Invocation XML é utilizado para codificar dados Protocolo baseado em texto x protocolo binário Suporta XML-based RPC (Remote procedure call) What is SOAP? First of all, as its name implies, it is a wire-protocol. It is a wire-protocol in the same sense that IIOP is a wire protocol for CORBA and JRMP is a wire protocol for RMI. As a wire protocol, it defines data encoding. In other words, it specifies rules of how data types get serialized over the wire. For example, it specifies how integer value 23 or string value xyz are to be represented on the wire. Defining standard encoding rules is important for interoperability, if you think about it, because without the agreed-upon encoding rules, communicating partners would not be able to understand the data that gets delivered on the wire. (For example, the communiting partners have to agree on whether integer value 23 is going to be represented in 2 bytes or a single byte and in what form.) The difference between SOAP encoding and others is that under SOAP, the encoded data are in XML representation, which is text based encoding while others are in binary encoding. SOAP also supports remote procedure call mechanism which is used to invoke a procedure call on a remote machine again the using XML notation.

42 SOAP não é Não é um modelo de componente
Não substitui objetos e componentes – EJB, JavaBeans Não é uma linguagem de programação Não substitui Java Não é solução para tudo Não substitui outras soluções de computação distrubuída como RMI. Now, I would like to make sure you understand what SOAP is not as well because there seems to be some confusion about this. First, SOAP is not a component model. So it will not replace existing component models such as Javabeans or EJB. In fact, component models and SOAP are very complementary in that SOAP can be used as communication protocol for invoking business logics that are captured in those components. Second, SOAP is not a programming language. That is, it will not replace programming language like Java. In fact, SOAP and Java are very complementary as well. That is, Java is for portable code and SOAP is in a sense a portable communication protocol. Now, if you think about it, SOAP messages have to be produced and processed and manipulated by a programming language. What is the programming language of choice for SOAP message production, manipulation, and processing? It is Java. In fact, most of the SOAP packages out there are written in Java. Third, SOAP is not an answer for all problems in distributed computing. In many cases, tightly-coupled and non-XML based technology such as RMI is in fact a better solution, for example when you need to build high-performance and secure intranet applications.

43 SOAP Simple Object Access Protocol (SOAP)
Esta definição foi abandonada pela W3C na versão 1.2, pois SOAP não acessa objetos em particular. SOAP é um protocolo para trocar mensagens XML entre computadores, geralmente utilizando o protocolo HTTP ou HTTPS. Um cliente Web Service envia uma requisição XML na Internet utilizando os protocolos disponibilizados pelo provedor de serviços.

44 O que SOAP define? Envelope – Mensagem Regras de codificação
Convenção RPC Informação sobre o protocolo de comunicação What are the things that SOAP define as communication protocol? The SOAP specification covers four aspects: Message envelope, Encoding rules, and remote procedure call convention, and finally how to bind SOAP message with underlying transport protocol such as HTTP. Now let's take a look at each of these in detail.

45 Formato da Mensagem SOAP
SOAP Mensagem SOAP Envelope Parte Principal MIME (text/xml) SOAP Cabeçalho Cabeçalho 1 Cabeçalho n Anexos SOAP Corpo This picture shows the format of SOAP message, actually SOAP message with attachments. SOAP message is made of SOAP Envelope and zero or more attachments. The SOAP Envelope in turn is then made of header and body. What is SOAP attachment for? It allows the SOAP message to contain not only the XML data but also non-XML data such as binary graphics file. And it uses the MIME multipart as container for these non-XML data. Multipurpose Internet Mail Extensions Anexos Corpo Corpo Anexos t

46 SOAP Mensagem Envelope
Informação de Codificação Cabeçalho Pode conter informações gerenciais Segurança Transação Corpo RPC Métodos e parâmetros Dados de Aplicações We will see an example of SOAP message soon but the header is optional and it can contain so called context knowledge such as security or transaction related information while the body contains application data or remote procedure call method and it parameter information. Please note that the SOAP specification does not specify any of these contexts. But SOAP header structure can be extensible, and that is how ebXML messaging service provides security and reliability by defining elements that can be embedded in the header structure. And we will see an example later on. The message envelope also carries information on encoding.

47 SOAP Encoding Rules of expressing application- defined data types in XML Based on W3C XML Schema Simple values Built-in types from XML Schema, Part 2 (simple types, enumerations, arrays of bytes) Compound values Structs, arrays, complex types Now what is encoding? As I mentioned before, it is a set of rules of how to express application-defined data types on the wire in XML form. SOAP encoding is based on W3C XML schema. What that means is that the SOAP messages are constructed using the data types defined in W3C XML schema. SOAP encoding supports both simple values and compound values. Simple values are the values of of built-in types from XML schema part 2 or enumeration or byte array. Compound values is constructed as a composite of several parts, each with a type and can be of struct or arrays or complex type.

48 SOAP Request <?xml version="1.0" encoding="UTF-8"?> <S:Envelope xmlns:S= " <S:Header/> <S:Body> <ns2:qtde xmlns:ns2=" <arg0>AM</arg0> </ns2:qtde> </S:Body> </S:Envelope>

49 SOAP Response <?xml version="1.0" encoding="UTF-8"?>
<S:Envelope xmlns:S= " <S:Body> <ns2:qtdeResponse xmlns:ns2=" <return> Estado: Amazonas IBGE: 13 Area: Quantidade de Municipios:62 </return> </ns2:qtdeResponse> </S:Body> </S:Envelope>

50 SOAP

51 WSDL Linguagem XML para descrever serviços web.
É descrito como um conjunto de pontos de comunicação (portas) Pontos são formados por duas partes Definição abstrata das operações e mensagens Ligação do protocolo com o formato do endereço What is WSDL? WSDL is industry-agreed-upon XML language that can be used to describe web services. Under WSDL, a Web service is described as a set of communication endpoints that are capable of exchanging messages. These communication endpoints are called ports. An endpoint is made of two parts: The first part is abstract definitions of operations and messages. As you will see later on, operations and messages are related in that messages are exchanged for the purpose of performing the operations. The 2nd part is concrete binding of those abstract definitions of operations to concrete network protocol and message format. And one concrete example of network protocol is SOAP over HTTP. The whole idea of this separation of abstract definitions from concrete binding is to allow the reuse of abstraction definitions regardless of present or future network protocols.

52 Por que WSDL? Possibilita a automação dos detalhes de comunicação entre os parceiros Máquinas podem ler WSDL Máquinas podem chamar um serviço definido em WSDL Pode ser descoberto através de registros Árbitragem Um terceiro pode verificar se a comunicação esta em conformidade com WSDL The key value proposition of WSDL as a standard description of web service is it enables automation of communication details in application to application communication. That is, machines can figure out from WSDL document what services are available and how to invoke them without manual pre-arrangement or pre-configuration between the two.

53 Now, I am going to explain WSDL by using a simple WSDL document example. This example describes a very simple service which provides stock price quote, the same example we used in SOAP part of the presentation. That is, this service supports a single operation called GetLastTradePrice. And this service is deployed using SOAP 1.1 over HTTP. So from this WSDL document, a soap message we saw in our SOAP presentation can be automatically generated. The request takes a ticker symbol of type string and the response returns price whose type is float. As you will see, WSDL XML vocabularies define 7 XML elements.

54 Arquitetura do Serviço
UDDI Registro 2. Requisição do Cliente para Encontrar o Serviço ENCONTRAR 1. Serviço de Publicação PUBLICAÇÃO Web Service Cliente do Serviço The Universal Description, Discovery, and Integration standard provides a mechanism for businesses to "describe" themselves and the types of services they provide and then register and publish themselves in a UDDI Registry. Such published businesses can be searched for, queried, or "discovered" by other businesses using SOAP messages. 3. Requisição do Serviço LIGAÇÃO UDDI - Define o caminho para publicar e encontrar informação sobre o Web Service Universal Description, Discovery, and Integration

55 UDDI (Universal Description, Discovery and Integration)
Páginas Brancas Endereço, contato e identificadores Páginas Amarelas Informações Categorizadas Indústria Produtos / Serviços Localização Páginas Verdes Informações Técnicas dos Serviços Now what kind of information will be contained in the business registration data? They can be categorized into white pages, yellow pages, and green pages. The concept of white pages and yellow pages are not that much different from the ones we know in that white page contains information on a particular business entity, for example, name, contact information, address, or unique identification number while yellow page contains categorization information according to industry, product and service, or geographic location. Finally, green pages contains so-called technical information about the service which is basically meta information on services and this meta information has references to service definitions represented by WSDL document.

56 Plataforma J2EE & Web Services
B2B Applications Existing Applications B2C Applications Web Services Application Server Enterprise Information Systems Wireless Applications

57 Por que J2EE para Web Services?
Webservice é um dos muitos serviços disponibilizados por J2EE Não necessita de mudança de arquitetura Componentes existentes pode facilmente expor com Webservice Muitos benefícios do J2EE são preservados para WS Portabilidade, Escalabilidade, Confiabilidade Liberdade de escolha do fornecedor Now, let's talk about the motivation for using J2EE as development and deployment platform for web services. As most of you already know, J2EE is an open standard platform for building enterprise applications in which business logic are captured and deployed as components. J2EE is also an end-to-end architecture where there are multiple programming models to implement and deploy these business logics. That is, there is servlet, there is JSP, there are EJB beans, and there is JMS. All these programming models provide somewhat different ways of implementing and deploying business logics over J2EE and you as developers choose one ore more of these programming models according to the needs and requirements of your applications. Now if you think about it, web services model is just another way of exposing the business logic of these components. There is no architectural or code change required to expose the existing J2EE components as web services . For example, as a service provider, in addition to exposing business functions captured in EJB beans by EJB remote interface over RMI/IIOP, you can also expose them via WSDL and handle the service by receiving SOAP message and send the result back in SOAP messages. What it means is that the existing J2EE components can be exposed as web services without any change in their code which also means the key benefits of J2EE such as open and standard platform, portability of code, availability of highly scalable and highly reliable platform products, are still preserved. And most of all, you can still choose the best of breed J2EE platform or J2EE applications including web services components without compromising the code portability.

58 Projeto J2EE Web Services Framework
Portabilidade dos componentes de serviços web Diferentes fornecedores de plataformas Diferentes ambientes operacionais Influência do modelo de programação J2EE existente para implementação do serviço. Facilidade de programação e implantação API Java de alto nível Utiliza o modelo de implantação existente J2EE 1.4 and Java EE 5 Guarda chuva para WebServices JSR 109, JAX-RPC, JAXR, EJB 2.1, Servlet 2.4, So what are the design goals of J2EE web services framework? I already explained the container and component model of J2EE. And one of the benefits of building application as components is its portability. And the same benefit applies to web services as well. Another important goal is that the existing J2EE programming models such as EJBs and servlets or message driven beans should be leveraged for service implementation. Next, runtime support of multiple transport bindings. One of the distinctive characteristics of Web services is that web services can be accessed over different message delivery protocols such as SOAP over HTTP or SMTP or JMS and web services framework should be able to support various message delivery protocols and these these different message delivery protocols can be selected during runtime through what is called binding. ( If you think about it, this is one of the differences of Web services from other communication protocols in that because information is being transported as XML text data, that is, the data is not really tied up with underlying transport protocol, there can be multiple ways to transport that data instead of just one way for many object-based communication protocols. So that is what I meant here as "multiple bindings") Next, we want to make sure that building and deploying web services is easy. What that means is that programmers will be able to use high-level Java APIs for building web services instead of dealing with low-level plumbings.

59 J2EE Web Services Framework
JAX-RPC (JAX-WS) Define o modelo de programação do cliente Define Serviços Web baseados em Servlet para modelo de portas. EJB 2.1 Define o modelo de portas Stateless Session Bean- based Web services Servlet 2.4 Alinhado com JAX-RPC JSR 109 Define padrão de serviços web para modelo de empacotamento e implementação

60 O que é um Web Service? Um conjunto de portas operando com mensagem
Portas são operados com um contêiner Contêiner provê um ambiente de execução Contrato para o ambiente de execução que é especificado em JAX-RPC, EJB 2.1, JSR 109 Serviços são descritos em um documento WSDL e publicados para um registro WSDL especifica um contrato entre o provedor do serviço com o cliente. So what is a Web service? Under J2EE context, Web services are defined as a set of endpoints operating on messages meaning the endpoints receive request messages and then send back response messages. These endpoints are operating within a container, which provides Web services runtime environment in the same way EJB container provides runtime environment for EJB beans. And the contract between the Web services endpoints and the container are specified in JAX-RPC, EJB 2.1, and JSR 109. Another aspect to note is that a Web service is described in WSDL document and this service description can be published to a registry. What this means is that the WSDL document is the only thing that is needed between web service user and service provider in order to communicate.

61 Web Service Componente e Contêiner
Modelo Contêiner x Componente Componentes WebServices são executados dentro de um contêiner. Componentes são portáveis Componentes WebServices Web-tier (portas baseadas em Servlet) EJB-tier (portas baseadas em stateless session bean) Now I would like to talk about component and container model of J2EE and how it relates to web services. One of the key architectural characteristics of J2ee is that business logic are implemented as components, which are in turn executed in a host execution environment called containers. And this container and component model will be used for implementing and deploying web services as well. That is, you will build web services as components which will be then executed in a web service container. In other words, web services components are going to be a 1st-class citizen of J2EE along with servlet, JSP and EJB. (add more speaker notes)

62 Web Service Componentes
Componentes WebServices This picture shows what I just explained in the previous slide. Web services components can reside either at web-tier or EJB-tier. When web services component is built as a servlet-based endpoint, it is running within the web container while when it is built as a session bean based endpoint, it will be running within the EJb container. So you can see we are leveraging existing container architecture for Web services components. Source: Web Services for J2EE (JSR 109), V1.0


Carregar ppt "Caio Nakashima caio.nakashima@mds.gov.br caionakashima@gmail.com EJB WebService Caio Nakashima caio.nakashima@mds.gov.br caionakashima@gmail.com."

Apresentações semelhantes


Anúncios Google