Integre pela Internet com os Web Services OpenEdge Luciano Oliveira Solution Consultant, Progress OpenEdge Foco da Sessão Implementando OpenEdge Web Services Entendendo Web Services Identificar quando utilizar Web Services Implementando um OpenEdge service consumer Implementando um OpenEdge service provider 2 INT-5: Integrate over the Web with OpenEdge Web Services 1
Agenda Integrando via Web com OpenEdge Web Services O Valor do Web Services OpenEdge Web Service Provider Cliente ABL como Consumidor 3 INT-5: Integrate over the Web with OpenEdge Web Services O que é Web Services? Web Services é Definido por Padrões Web Services Padrões que definem para plataformas como construir, distribuir e fazer interoperabilidade entre aplicações OpenEdge Web Services utiliza padrões W3C Simple Object Access Protocol (SOAP) Web Service Definition Language (WSDL) XML W3C = World Wide Web Consortium, http://www.w3.org/ 4 INT-5: Integrate over the Web with OpenEdge Web Services 2
Padrão: SOAP Simple Object Access Protocol SOAP é o protocolo para troca de mensagens entre aplicações e; SOAP é baseado em XML SOAP é independente de Plataforma SOAP é independente de Linguagem SOAP é simples e extendível 5 INT-5: Integrate over the Web with OpenEdge Web Services Standards: WSDL Web Services Description Language Específica Interface Enlaçamento entre as operações SOAP over HTTP Métodos de negócios podem ser chamados ( operations ) Estrutura de mensagem para cada método Data fields, types Identifica na rede o endereço Web service Contrato entre Fornecedor e Consumidor 6 INT-5: Integrate over the Web with OpenEdge Web Services 3
Consumidor e Fornecedor Fornecedor Web Service Desenvolve e Implementa o Web service Publica o WSDL Consumidor Web Service Escreve códigos para acessar os serviços deployed baseado no WSDL Web service Consumidor SOAP over HTTP Web service Fornecedor Client 7 INT-5: Integrate over the Web with OpenEdge Web Services O Valor do Web Services Por que utilizar Web Services Aplicações Heterogêneas Valores de OpenEdge são disponíveis Muitos Consumidores Por que não utilizar Web Services Aplicações Homogêneas Pode não dar conta do recado Por que utilizar Progress Web Services? A Progress faz isso Fácil. 8 INT-5: Integrate over the Web with OpenEdge Web Services 4
Web Services Heterogêneo Distribuído Interoperabilidade SOAP WSDL Consumidores Fornecedores Pense nisso!!! 9 INT-5: Integrate over the Web with OpenEdge Web Services Agenda Integrate via Web com OpenEdge Web Services O Valor do Web Services OpenEdge Web Service Provider Cliente ABL como Consumidor 10 INT-5: Integrate over the Web with OpenEdge Web Services 5
Web Services ABL Client O que você precisa saber? Como utilizar o WSDL Analyzer Um AppServer com síntaxe de Procedure Persistente 11 INT-5: Integrate over the Web with OpenEdge Web Services Web Services ABL Processos do Cliente Obter WSDL (ou sua localização) Executar o WSDL Analyzer no WSDL Gerar o código ABL novo no form HTML Utilizar WSDL Analyzer para identificar as chamadas de código para o Web service Chamar efetivamente o Web service 12 INT-5: Integrate over the Web with OpenEdge Web Services 6
OpenEdge Client chamando um Web service Consumidor Web service HTTP Client 1 Requisição WSDL Fornecedor Web service Client ABL Application Code SOAP Processor 3 WSDL Chamada Serviço Resposta Serviço 2 4 13 INT-5: Integrate over the Web with OpenEdge Web Services WSDL Analyzer (comando bprowsdldoc) Input WSDL (obtido via serviço do Fornecedor) Output HTML documentação ABL novos códigos e exemplos SOAP/XML samples Informações sobre o serviço proenv>bprowsdldoc http://localhost:8080/wsa/wsa1/wsdl?targeturi=u rn:wsprovider:emp myoutput Documentation written to File:///C:\OpenEdge\WRK\myOutput\index.html 14 INT-5: Integrate over the Web with OpenEdge Web Services 7
The WSDL Analyzer Output inclui: Informações de Conexão Como criar uma Port type (Procedure Persistente) Listar todas Operações (Procedures Internas) Como chamar cada Operação Síntaxe de Procedure e Função Formato do tipo de dado Port type é modelado como uma procedure persistente (embora não seja persistente) Operations são modelados como procedures internas 15 INT-5: Integrate over the Web with OpenEdge Web Services The WSDL Analyzer Output limitações: Não há nenhuma garantia (é um guideline) Sem informações da desconexão e do cleanup: DELETE OBJECT hporttype. hwebservice:disconnect(). DELETE OBJECT hwebservice. 16 INT-5: Integrate over the Web with OpenEdge Web Services 8
Demonstração: Chamando um Web service 17 INT-5: Integrate over the Web with OpenEdge Web Services Agenda Integrando via Web com OpenEdge Web Services O Valor do Web Services OpenEdge Web Service Provider Cliente ABL como Consumidor 18 INT-5: Integrate over the Web with OpenEdge Web Services 9
OpenEdge Web Service Fornecedor Componentes necessários Sua Aplicação Quebrado em serviços Application Server Códigos hospedados expostos como serviços Fornecer acesso ao Banco de Dados ProxyGen Gerar os arquivos intermediários usados para o deployment (incluindo o mapeamento wsdl) Progress Explorer ou wsaman Manage Web service (deployment) 19 INT-5: Integrate over the Web with OpenEdge Web Services OpenEdge Web Service Fornecedor Componentes Necessários WSA Servlet Interface entre o Web Service Consumidor e o OpenEdge AppServer Produtos de Terceiros Java Servlet Engine (JSE) Fornece o ambiente para execura o WSA servlet Web Server Fornece suporte HTTP Hosts JSE WSA = Web Services Adapter 20 INT-5: Integrate over the Web with OpenEdge Web Services 10
Deploying do OpenEdge Web Service OpenEdge AppServer 1 Aplicação OpenEdge Lógica de Negócio r-code 4 Web Server Java Servlet Engine WSA Servlet WSDL WSAD WSM 2 ProxyGen WSM Arquivo intermediário para fazer o Deploy do Web Service 21 INT-5: Integrate over the Web with OpenEdge Web Services 3 Progress Explorer ou wsaman Acessando o OpenEdge Web Service Web service 8 Consumidor 1 2 7 3 6 HTTP Listener/ Sender Web Server Java Servlet Engine WSA Servlet SOAP Processor WSAD OpenEdge AppServer 4 5 ABL Business Logic 22 INT-5: Integrate over the Web with OpenEdge Web Services 11
Demonstration: Deploying a Web service 23 INT-5: Integrate over the Web with OpenEdge Web Services Web Services Troubleshooting ABL SOAP Fault Envelope Body Body Entry fault code fault actor fault string <fault detail> 24 INT-5: Integrate over the Web with OpenEdge Web Services 12
SOAP Faults RUN operationname IN hporttype (INPUT value1, OUTPUT value2) NO-ERROR. IF ERROR-STATUS:ERROR THEN DO: DO icnt = 1 TO ERROR-STATUS:NUM-MESSAGES: MESSAGE ERROR-STATUS:GET-MESSAGE(iCnt) VIEW-AS ALERT-BOX. END. IF VALID-HANDLE(ERROR-STATUS:ERROR-OBJECT-DETAIL) THEN DO: MESSAGE "Fault Code:" ERROR-STATUS:ERROR-OBJECT-DETAIL:SOAP-FAULT-CODE SKIP "Fault Actor: " ERROR-STATUS:ERROR-OBJECT-DETAIL:SOAP-FAULT-ACTOR SKIP "Fault String:" ERROR-STATUS:ERROR-OBJECT-DETAIL:SOAP-FAULT-STRING SKIP "Fault Detail:" ERROR-STATUS:ERROR-OBJECT-DETAIL:SOAP-FAULT-DETAIL VIEW-AS ALERT-BOX. END. END. 25 INT-5: Integrate over the Web with OpenEdge Web Services SOAP Viewers (prosoapview) C:\Progress\OpenEdge\bin\prowin32.exe -proxyhost localhost -proxyport 4444 26 INT-5: Integrate over the Web with OpenEdge Web Services 13
Em Resumo Implementando OpenEdge Web Services Entender o Web Services Identificar quando utilizar o Web Services Progress faz isso de maneira fácil Web service Consumidor Cliente SOAP over HTTP Web service Fornecedor 27 INT-5: Integrate over the Web with OpenEdge Web Services Para mais informações Progress Progress Treinamentos e elearning : WSDL for OpenEdge Developers Consuming Web Services from OpenEdge Opening 4GL Applications to Web Services Clients Documentação: 10.1B Web Services (Manual) ProxyGen mudanças do Web Services na OpenEdge 10.1A 28 INT-5: Integrate over the Web with OpenEdge Web Services 14
Para mais informações sobre Web Services The World Wide Web Consortium (W3C) http://www.w3.org/ Web Services Interoperability Organization http://www.ws-i.org/default.aspx WS-I Basic Profile: http://www.ws-i.org/profiles/basicprofile-1.0-2004-04-16.html W3 Schools http://www.w3schools.com/ 29 INT-5: Integrate over the Web with OpenEdge Web Services Questões? 30 INT-5: Integrate over the Web with OpenEdge Web Services 15
Pela Atenção, Obrigado!!! 31 INT-5: Integrate over the Web with OpenEdge Web Services 32 INT-5: Integrate over the Web with OpenEdge Web Services 16