+ All Categories
Home > Documents > Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

Date post: 21-Apr-2015
Category:
Upload: internet
View: 165 times
Download: 6 times
Share this document with a friend
50
Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer
Transcript
Page 1: Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

Utilize qualquer Web Service a partir do Progress 4GL

Luis B. CamposSystem Engineer

Page 2: Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

2 Chame Qualquer Web Service a partir do Progress 4GL© 2005 Progress Software Corporation

Introdução Web Service Basics WSDL Analyzer Chamando um Web Service a partir do 4GL

Agenda

Page 3: Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

3 Chame Qualquer Web Service a partir do Progress 4GL© 2005 Progress Software Corporation

Web Service Client

Disponível no OpenEdge® 10.0A AppServer não é necessário Client de uma aplicação diferente

Page 4: Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

4 Chame Qualquer Web Service a partir do Progress 4GL© 2005 Progress Software Corporation

Web Services – Por que?

Conectividade heterogênea Na arquitetura SOA eles tornam os

serviços distribuídos possíveis Denominador comun menor que o EDI ou

CORBA

Page 5: Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

5 Chame Qualquer Web Service a partir do Progress 4GL© 2005 Progress Software Corporation

Web Services – Por que?

Provedores de Web service disponíveis– Produtos: OpenEdge, Oracle, IBM DB/2,

SalesForce.com, etc.

– Serviços: Google, e-Bay, Commonwealth of Massachusetts, etc.

Plataformas de Desenvolvimento: OpenEdge, .NET™, J2EE, Apache, WebSphere.

Page 6: Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

6 Chame Qualquer Web Service a partir do Progress 4GL© 2005 Progress Software Corporation

Web Services – Por que não?

Pode não ser eficiente Pode não estar disponível

Page 7: Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

7 Chame Qualquer Web Service a partir do Progress 4GL© 2005 Progress Software Corporation

Web Service Basics - Onde?

Usuários Usuários

Camada de Apresentação

Camadas de Serviços de Negócio

Camadas de Acesso a Dados

Fontes de Dados Gerenciadas

Fontes de Dados Gerenciadas

Fontes de DadosNão Gerenciadas

Fontes de DadosNão Gerenciadas

Serviços Empresariais

Serviços Empresariais

Camada de Integração

OpenEdge Reference Architecture

Page 8: Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

8 Chame Qualquer Web Service a partir do Progress 4GL© 2005 Progress Software Corporation

Introdução Web Service Basics WSDL Analyzer Chamando um Web Service a partir do 4GL

Agenda

Page 9: Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

9 Chame Qualquer Web Service a partir do Progress 4GL© 2005 Progress Software Corporation

Web Service Basics – SOAP Message

Envelope

Body

HeaderHeader Entry

…Body Entry

Body Entry

Header Entry

Entradas podem ser

SOAP Faults (erros)

Header opcional

Simple

Object

Access

Protocol

Page 10: Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

10 Chame Qualquer Web Service a partir do Progress 4GL© 2005 Progress Software Corporation

Web Service Basics - WSDL

Define Interface Codificação dos dados Transporte Endereço do serviço

Contrato entre o client e o server

Web

Service

Description

Language

Page 11: Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

11 Chame Qualquer Web Service a partir do Progress 4GL© 2005 Progress Software Corporation

Anatomia de uma Sessão Web Service

OpenEdge 4GL Client

Um provedor de Web Service

SOAP Request

SOAP Response

SOAP Request

SOAP Response

WSDL Request

WSDL Response

Page 12: Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

12 Chame Qualquer Web Service a partir do Progress 4GL© 2005 Progress Software Corporation

Introdução Web Service Basics WSDL Analyzer

– Introdução

– Demonstração do Analyzer Chamando um Web Service a partir do 4GL

Agenda

Page 13: Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

13 Chame Qualquer Web Service a partir do Progress 4GL© 2005 Progress Software Corporation

Dicionário 4GL/WSDL

4GL WSDLAppServer™..…......….............Web service

Persistent procedure..............Port type (interface)

Internal procedure..................Operation

Page 14: Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

14 Chame Qualquer Web Service a partir do Progress 4GL© 2005 Progress Software Corporation

Linha de Comando do WSDL Analyzer

Gera a documentação 4GL para um web service

C:\temp> bprowsdldochttp://api.google.com/GoogleSearch.wsdlgoogle

Documentation written tofile:///c:\temp\google\index.html

C:\temp>

Page 15: Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

15 Chame Qualquer Web Service a partir do Progress 4GL© 2005 Progress Software Corporation

Anatomia do Projeto do Client

WSDL Analyzer

Provedor do Web Service

WSDL Request

WSDL Response

Documentos Gerados

OpenEdge 4GL Client

Page 16: Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

16 Chame Qualquer Web Service a partir do Progress 4GL© 2005 Progress Software Corporation

Documentos Gerados

Data types

dados complexos

Operation Index

Port type

conexão & chamada

Service

index

Page 17: Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

17 Chame Qualquer Web Service a partir do Progress 4GL© 2005 Progress Software Corporation

Snapshots do Analyzer:Documentação do Serviço

Page 18: Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

18 Chame Qualquer Web Service a partir do Progress 4GL© 2005 Progress Software Corporation

Snapshots do Analyzer:Documento do Serviço

Page 19: Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

19 Chame Qualquer Web Service a partir do Progress 4GL© 2005 Progress Software Corporation

Snapshots do Analyzer :Port Type – Sumário da Conexão

Page 20: Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

20 Chame Qualquer Web Service a partir do Progress 4GL© 2005 Progress Software Corporation

Snapshots do Analyzer :Port Type – Sumário da Operation

Page 21: Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

21 Chame Qualquer Web Service a partir do Progress 4GL© 2005 Progress Software Corporation

Snapshots do Analyzer :Port Type – Exemplo da Operation

Page 22: Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

22 Chame Qualquer Web Service a partir do Progress 4GL© 2005 Progress Software Corporation

Snapshots do Analyzer :Port Type – Parâmetros da Operation

Page 23: Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

23 Chame Qualquer Web Service a partir do Progress 4GL© 2005 Progress Software Corporation

Snapshots do Analyzer :Port Type – Exemplo de Parâmetros Complexos

Page 24: Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

24 Chame Qualquer Web Service a partir do Progress 4GL© 2005 Progress Software Corporation

Dados Complexos como TEMP-TABLE

addCustomers

Procedure prototypePROCEDURE addCustomers: DEFINE INPUT PARAMETER TABLE FOR customerList. DEFINE OUTPUT PARAMETER TABLE FOR conflictList.END PROCEDURE.

Page 25: Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

25 Chame Qualquer Web Service a partir do Progress 4GL© 2005 Progress Software Corporation

Dados Complexos como TEMP-TABLE

ExemploDEFINE TEMP-TABLE customerList NAMESPACE-URI http://mycompany.com/schemas/customerList NAMESPACE-PREFIX "cust“ FIELD CustNum AS INTEGER FIELD Name AS CHARACTER XML-NODE-TYPE "Attribute“ FIELD Country AS CHARACTER FIELD Comments AS CHARACTER INDEX CustNum IS PRIMARY UNIQUE CustNum INDEX Name Name INDEX Comments IS WORD-INDEX Comments.

Page 26: Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

26 Chame Qualquer Web Service a partir do Progress 4GL© 2005 Progress Software Corporation

Dados Complexos como TEMP-TABLE

ParâmetroscustomerList

This value is defined as a TEMP-TABLE.

This value can also be expressed as a CustomerTable element inThe http://mycompany.com/schemas/customerListnamespace. As such, this parameter can be passed as aCHARACTER or LONGCHAR value containing an XMLdocument. View example of XML.

Page 27: Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

27 Chame Qualquer Web Service a partir do Progress 4GL© 2005 Progress Software Corporation

Introdução Web Service Basics WSDL Analyzer Chamando um Web Service a partir do 4GL

– Mapeamento de tipos de dados

– Conexão e chamada

– Manipulação do Header

– Manipulação de Erros

Agenda

Page 28: Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

28 Chame Qualquer Web Service a partir do Progress 4GL© 2005 Progress Software Corporation

Simples Mapeamento de Tipo de Dados

XML Schema Data Type Progress 4GL Data Typestring CHARACTER

boolean LOGICAL

decimal DECIMAL

integer INTEGER

float, double, duration CHARACTER

CHARACTER e LONGCHAR podem sempre ser usados

Para mapeamentos completos,veja a documentação

Page 29: Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

29 Chame Qualquer Web Service a partir do Progress 4GL© 2005 Progress Software Corporation

Dados Complexos

Representados de duas formas:

1. LONGCHAR/CHARACTER de documentos XML serializados

2. ProDataSet ou TEMP-TABLE quando possível (10.1A)

Analyzer mostra exemplos de ambos.

Page 30: Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

30 Chame Qualquer Web Service a partir do Progress 4GL© 2005 Progress Software Corporation

CREATE SERVER app-server-handle.app-server-handle:CONNECT(“appserver-connect-parms”).RUN persistent-proc PERSISTENT SET procedure-handle ON app-server-handle.RUN internal-proc IN procedure-handle(parameters).

CREATE SERVER web-svc-handle.web-svc-handle:CONNECT(“-WSDL wsdl-url ws-connect-parms”).RUN port-type-name SET port-type-handle ON web-svc-handle.RUN operation IN port-type-handle(parameters).

Conexão e ChamadaExatamente como um AppServer

Page 31: Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

31 Chame Qualquer Web Service a partir do Progress 4GL© 2005 Progress Software Corporation

Resultados Google no Browser

Page 32: Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

32 Chame Qualquer Web Service a partir do Progress 4GL© 2005 Progress Software Corporation

Exemplo de Conexão Selecionado

Page 33: Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

33 Chame Qualquer Web Service a partir do Progress 4GL© 2005 Progress Software Corporation

Exemplos de Conexão e Chamada Colados

Page 34: Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

34 Chame Qualquer Web Service a partir do Progress 4GL© 2005 Progress Software Corporation

Definições de Variáveis

Page 35: Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

35 Chame Qualquer Web Service a partir do Progress 4GL© 2005 Progress Software Corporation

Connect e Set Port

Page 36: Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

36 Chame Qualquer Web Service a partir do Progress 4GL© 2005 Progress Software Corporation

Chamada ao Google

Page 37: Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

37 Chame Qualquer Web Service a partir do Progress 4GL© 2005 Progress Software Corporation

Resultado da Pesquisa Utilizando DOM

Page 38: Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

38 Chame Qualquer Web Service a partir do Progress 4GL© 2005 Progress Software Corporation

Carga da TEMP-TABLE com os Resultados

Page 39: Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

39 Chame Qualquer Web Service a partir do Progress 4GL© 2005 Progress Software Corporation

Resultados no 4GL Client

Page 40: Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

40 Chame Qualquer Web Service a partir do Progress 4GL© 2005 Progress Software Corporation

Objetos 4GL SOAP HeaderEnvelope

Body

HeaderHeader Entry

Body Entry

Header Entry

SOAP-HEADER

SOAP-HEADER-ENTRYREF

…SOAP-HEADER-ENTRYREF

Page 41: Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

41 Chame Qualquer Web Service a partir do Progress 4GL© 2005 Progress Software Corporation

SOAP Headers Define um callback

port-type-handle:SET-CALLBACK-PROCEDURE( “REQUEST-HEADER | RESPONSE-HEADER”,   “request-handler-name”,   web-service-handle).

Escreve um callbackPROCEDURE request-handler-name: DEFINE INPUT PARAMETER soap-header-handle AS HANDLE. DEFINE INPUT PARAMETER operation-namespace AS CHARACTER. DEFINE INPUT PARAMETER operation-local-name AS CHARACTER.END.

Page 42: Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

42 Chame Qualquer Web Service a partir do Progress 4GL© 2005 Progress Software Corporation

Anatomia de um Erro no Web Service

OpenEdge 4GL Client

Provedor do Web ServiceSOAP Request

SOAP Response

(FAULT)

WSDL Request

WSDL Response

Page 43: Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

43 Chame Qualquer Web Service a partir do Progress 4GL© 2005 Progress Software Corporation

4GL SOAP Fault

Envelope

Body

Body Entry

fault code

fault string

fault actor

<faultdetail>

Page 44: Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

44 Chame Qualquer Web Service a partir do Progress 4GL© 2005 Progress Software Corporation

Fault Objects do 4GL

ERROR-STATUS

SOAP-FAULT

SOAP-FAULT-DETAIL

XML

fault info

Page 45: Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

45 Chame Qualquer Web Service a partir do Progress 4GL© 2005 Progress Software Corporation

SOAP Fault - Faultstring

An error was detected while executing the Web Service request. (10893)

Page 46: Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

46 Chame Qualquer Web Service a partir do Progress 4GL© 2005 Progress Software Corporation

SOAP Fault - Detail

<detail> <errorMessage> msg=The server application returned the error: Invoice not found; targetException=ERROR condition: The Server application has returned an error. (7243) (7211)] </errorMessage> <requestID> 172247e5b58beb30:5bb966:fb4fdb744a:-7fff#9 </requestID></detail>

Page 47: Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

47 SOA-07: Call Any Web Service from the Progress 4GL© 2005 Progress Software Corporation

Resumo

Chamar um web service é fácil Use o WSDL Analyzer

OpenEdge 4GL Client

Web Service ou

AppServer?

Page 48: Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

48 Chame Qualquer Web Service a partir do Progress 4GL© 2005 Progress Software Corporation

Perguntas?

Page 49: Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

49 Chame Qualquer Web Service a partir do Progress 4GL© 2005 Progress Software Corporation

Obrigado!

Page 50: Utilize qualquer Web Service a partir do Progress 4GL Luis B. Campos System Engineer.

50 Chame Qualquer Web Service a partir do Progress 4GL© 2005 Progress Software Corporation


Recommended