Pessoal, bom dia.
Segue um código para ler webservice REST.
Código:/* Variaveis da consulta ao webservice */ DEFINE VARIABLE http AS COM-HANDLE. DEFINE VARIABLE strURL AS CHARACTER. DEFINE VARIABLE strRET AS CHARACTER. DEFINE VARIABLE iNumEntries AS INTEGER NO-UNDO. DEFINE VARIABLE iLoop AS INTEGER NO-UNDO. assign strURL = 'http://www4.bcb.gov.br/pec/taxas/batch/cotacaomoedas.asp?id=txtodas'. /* Le a informação do Retorno */ CREATE "MSXML2.XMLHTTP.3.0" http NO-ERROR. http:OPEN("GET", strURL, FALSE). http:setRequestHeader("Translate", "f"). /*http:setRequestHeader("Content-Type", "text/xml"). */ http:setRequestHeader("Depth", "0"). http:SEND() NO-ERROR. /* Armazena o retorno */ strRET = http:responseText. MESSAGE strRET VIEW-AS ALERT-BOX INFO BUTTONS OK. /* Se tiver erro, retorna o erro */ if strRET begins "Houve erro" then do: /* Trata */ end. else do: /* Trata o retorno */ end.
-
Anuncie Aqui ! Entre em contato fdantas@4each.com.br -
-