PC SOFT
ONLINE REPOSITORY
FOR WINDEVWEBDEV AND WINDEV MOBILE

Home |  | Sign in | English US
Classe OOP para trabalhar com soap xml Api Rest Send Json, Httpsend, Send, HttpForm, ainda em desenvolvimento 90% pronto
Published by Boller
in the category Tools
New features



Description
Classe OOP para trabalhar com soap xml Api Rest Send Json, Httpsend, Send, HttpForm, ainda em desenvolvimento 90% pronto
Illustrations, screen shots
none
none
User reviews
(To evaluate this resource, click 'Write a review')
Boller
//CODIGO FONTE DA NOSSA CLASSE OOP PARA API REST OU SOAP
##############################################################################
ST_params_envio is Structure
nome_parametro is string
valor_parametro is string
desc_parametro is string
END

ST_authorization_envio is Structure //Postman
APIKEY_Key is string
APIKEY_Value is string
APIKEY_Desc is string
Bearer_Token is string
Username is string
Pawword is string
Realm is string
Nonce is string
Algorithm is string
Qop is string
NonceCount is string
ClientNonce is string
Opaque is string
SignatureMethod is string
ConsumerKey is string
ConsumerSecret is string
AccessToken is string
TokenSecret is string
CallbackURL is string
Verifier is string
Timestamp is string
Version is string
IncludeBodyHash is boolean
AddEmpetySignature is boolean
Request_Headers_Body_url is string
HeaderPrefix is string
Tokenname is string
GrantType is string
AuthorizeUsingBrowser is boolean
AuthURL is string
AccessTokenURL is string
ClientID is string
ClientSecret is string
Scope is string
State is string
ClientAuthentication is string
HawkAuthID is string
HawkAuthKey is string
ext is string
app is string
ApplicationID is string
dlg is string
IncludePlayloadHash is boolean
AWS_AccessKey is string
AWS_SecretKey is string
AWS_Region is string
AWS_ServiceName is string
AWS_SessionToken is string
Domain is string
Workstation is string
ClientToken is string
BaseURL is string
HeadersToSign is string
END

ST_header_envio is Structure
nome_parametro is string
valor_parametro is string
desc_parametro is string
END

ST_body_envio is Structure //postman form
nome_parametro is string
valor_parametro is string
desc_parametro is string
END

ST_header_retorno is Structure
header_valor is string
END



ClasseApiRest is a Class
retorno is Variant
END

##############################################################################

// Summary: <specify the procedure action>
// Syntax:
//[ <Result> = ] SendApiRest ()
//
// Parameters:
// None
// Example:
// <Specify a usage example>
//
// URL:
// codificar_Url: <specify the role of codificar_Url>
// tipo_Url_Encode: <specify the role of tipoEncode>
// Metodo: <specify the role of Metodo>
// array_header_envio: <specify the role of arr_header_parametros>
// usuario: <specify the role of usuario>
// senha: <specify the role of senha>
// HTTPSend_or_RESTSend: <specify the role of HTTPSend_or_RESTSend>
// timeout_envio: <specify the role of timeout_envio>
// Connection_Timeout: <specify the role of Connection_Timeout>
// AuthToken: <specify the role of AuthToken>
// Destination: <specify the role of Destination>
// PacoteJson: <specify the role of PacoteJson>
// type_Mime: <specify the role of typeMime>
// Header_Nome01: <specify the role of Header_Nome>
// Header_Valor01: <specify the role of Header_Valor>
// Header_Nome02: <specify the role of Header_Nome02>
// Header_Valor02: <specify the role of Header_Valor02>
// Header_Nome03: <specify the role of Header_Nome03>
// Header_Valor03: <specify the role of Header_Valor03>
// Bearer_Token: <specify the role of Bearer_Token>
// Content_Type: <specify the role of Content_Type>
// Header_User: <specify the role of Header_User>
// Header_Password: <specify the role of Header_Password>
// Version_HTTP: <specify the role of Version_HTTP>
// Version_SSL: <specify the role of Version_SSL>
// Certificado_Digital_p12: <specify the role of Certificado_Digital_p12>
// Certificado_Password: <specify the role of Certificado_Password>
// Cookie_Acao: <specify the role of Cookie_Acao>
// Cookie_Dominio: <specify the role of Cookie_Dominio>
// Cookie_Ativacao: <specify the role of Cookie_Ativacao>
// Cookie_Name: <specify the role of Cookie_Name>
// Cookie_Valor: <specify the role of valorCookie>
// Upload_Progress: <specify the role of Upload_Progress>
// Upload_Progress_Frequency: <specify the role of Upload_Progress_Frequency>
// Upload_Progress_Procedure: <specify the role of Upload_Progress_Procedure>
// Upload_Progress_ProgressBar: <specify the role of Upload_Progress_ProgressBar>
// Upload_Progress_MaxUploadRate: <specify the role of Upload_Progress_MaxUploadRate>
// Download_Progress: <specify the role of Download_Progress>
// Download_Progress_Frequency: <specify the role of Download_Progress_Frequency>
// Download_Progress_Procedure: <specify the role of Download_Progress_Procedure>
// Download_Progress_ProgressBar: <specify the role of Download_Progress_ProgressBar>
// Download_Progress_MaxDownloadRate: <specify the role of Download_Progress_MaxDownloadRate>
// Procedure_Trace: <specify the role of Procedure_Trace>
PROCEDURE PUBLIC GLOBAL SendApiRest()

//Parametros
param is ST_Parametros_Api

param <= parametros

//---------------------------------------------------REQUEST---------------------------------------------------

//Http Rest
WHEN EXCEPTION IN

//Http
http_envio is httpRequest
http_retorno is httpResponse
arr_header_envio is array of ST_header_envio

//Res
rest_envio is restRequest
rest_retorno is restResponse
arr_header_retorno is array of ST_header_retorno




//URLENCODE
param.URL = Lower(NoSpace(param.URL))
IF param.Codificar_Url = True OR param.Codificar_Url = 1
param.tipo_Url_Encode = Upper(param.tipo_Url_Encode)
IF param.tipo_Url_Encode = "ANSI"
param.URL = URLEncode(param.URL,encodeURLFromAnsi)
ELSE IF param.tipo_Url_Encode = "UNICODE"
param.URL = URLEncode(param.URL,encodeURLFromUnicode)
ELSE IF param.tipo_Url_Encode = "UTF8"
param.URL = URLEncode(param.URL,encodeURLFromUTF8)
ELSE IF param.tipo_Url_Encode = "PARAMETER"
param.URL = URLEncode(param.URL,encodeURLParameter)
ELSE
param.URL = URLEncode(param.URL)
END
END
param.URL = Replace(param.URL," ","%20",IgnoreCase)
IF param.URL = ""
RETURN False
END
http_envio..URL = param.URL




//HEADER MONTAGEM DOS DADOS
ID_Header is int
IF Length(param.Bearer_Token) > 0 THEN
ID_Header++
arr_header_envio[ID_Header].nome_parametro = "Authorization"
arr_header_envio[ID_Header].valor_parametro = "Bearer "+param.Bearer_Token //"Token"
END

IF Length(param.Content_Type_Envio) > 0
ID_Header++
arr_header_envio[ID_Header].nome_parametro = "Content-Type"
arr_header_envio[ID_Header].valor_parametro = param.Content_Type_Envio //"application/json"
END

IF Length(param.Header_User) > 0
ID_Header++
arr_header_envio[ID_Header].nome_parametro = "User"
arr_header_envio[ID_Header].valor_parametro = param.Header_User
END

IF Length(param.Header_Password) > 0
ID_Header++
arr_header_envio[ID_Header].nome_parametro = "Password"
arr_header_envio[ID_Header].valor_parametro = param.Header_Password
END

IF Length(param.Header_Nome01) > 0 AND Length(param.Header_Valor01) > 0
ID_Header++
arr_header_envio[ID_Header].nome_parametro = param.Header_Nome01
arr_header_envio[ID_Header].valor_parametro = param.Header_Valor01
END

IF Length(param.Header_Nome02) > 0 AND Length(param.Header_Valor02) > 0
ID_Header++
arr_header_envio[ID_Header].nome_parametro = param.Header_Nome02
arr_header_envio[ID_Header].valor_parametro = param.Header_Valor02
END

IF Length(param.Header_Nome03) > 0 AND Length(param.Header_Valor03) > 0
ID_Header++
arr_header_envio[ID_Header].nome_parametro = param.Header_Nome03
arr_header_envio[ID_Header].valor_parametro = param.Header_Valor03
END

IF ArrayCount(arr_header_envio) > 0 THEN
FOR EACH st_envio OF arr_header_envio
http_envio.Header[NoSpace(st_envio.nome_parametro)] = NoSpace(st_envio.valor_parametro)
END
END



//METODOS DE ENVIO
SWITCH param.Metodo
CASE "httpDelete"
http_envio..Method = httpDelete
CASE "httpGet"
http_envio..Method = httpGet
CASE "httpPost"
http_envio..Method = httpPost
CASE "httpPut"
http_envio..Method = httpPut
CASE "httpCopy"
http_envio..Method = httpCopy
CASE "httpHead"
http_envio..Method = httpHead
CASE "httpLock"
http_envio..Method = httpLock
CASE "httpMkCol"
http_envio..Method = httpMkCol
CASE "httpMove"
http_envio..Method = httpMove
CASE "httpPatch"
http_envio..Method = httpPatch
CASE "httpPropFind"
http_envio..Method = httpPropFind
CASE "httpPropPatch"
http_envio..Method = httpPropPatch
CASE "httpUnlock"
http_envio..Method = httpUnlock
OTHER CASE
http_envio..Method = httpPost
END




//DADOS COMUNS PASSADOS
IF Length(param.usuario) > 0
http_envio..User = param.usuario
END


IF Length(param.senha) > 0 THEN
http_envio..Password = param.senha
END

IF Length(param.timeout_envio) > 0
http_envio..Timeout = param.timeout_envio
END

IF Length(param.Connection_Timeout) > 0
http_envio..ConnectionTimeout = param.Connection_Timeout
END

IF Length(param.AuthToken) > 0
http_envio..AuthToken = AuthToken
END

IF Length(param.Destination)> 0
http_envio..Destination = param.Destination
END

IF Length(param.PacoteJson) > 0
http_envio..Content = param.PacoteJson
END

http_envio..UserAgent = "ClasseApiRestWx"


SWITCH param.Cookie_Acao
CASE "GetCookie"
http_envio.GetCookie(param.Cookie_Dominio)
CASE "ManageCookie"
http_envio.ManageCookie(param.Cookie_Dominio,param.Cookie_Ativacao)
CASE "ReadCookie"
http_envio.ReadCookie(param.Cookie_Dominio,param.Cookie_Name)
CASE "WriteCookie"
http_envio.WriteCookie(param.Cookie_Dominio,param.Cookie_Name,param.Cookie_Valor)
END




//typeMime USADO
SWITCH param.type_Mime
CASE "typeMimeBinary"
http_envio..ContentType = typeMimeBinary
CASE "typeMimeGIF"
http_envio..ContentType = typeMimeGIF
CASE "typeMimeHTML"
http_envio..ContentType = typeMimeHTML
CASE "typeMimeJSON"
http_envio..ContentType = typeMimeJSON
CASE "typeMimeJPEG"
http_envio..ContentType = typeMimeJPEG
CASE "typeMimeMultiPartForm"
http_envio..ContentType = typeMimeMultiPartForm
CASE "typeMimePNG"
http_envio..ContentType = typeMimePNG
CASE "typeMimeSimpleForm"
http_envio..ContentType = typeMimeSimpleForm
CASE "typeMimeSOAP"
http_envio..ContentType = typeMimeSOAP
CASE "typeMimeText"
http_envio..ContentType = typeMimeText
CASE "typeMimeXMLApplication"
http_envio..ContentType = typeMimeXMLApplication
CASE "typeMimeXMLText"
http_envio..ContentType = typeMimeXMLText
OTHER CASE
http_envio..ContentType = typeMimeJSON
END



//VERSAO DO HTTP USADO
SWITCH param.Version_HTTP
CASE "httpVersion1_0"
http_envio..VersionHTTP = httpVersion1_0
CASE "httpVersion1_1"
http_envio..VersionHTTP = httpVersion1_1
CASE "httpVersion2"
http_envio..VersionHTTP = httpVersion2
CASE "httpVersion2Only"
http_envio..VersionHTTP = httpVersion2Only
OTHER CASE
http_envio..VersionHTTP = httpVersionDefault
END




//SEGURANÇA PROTOCOLO SEGURO
SWITCH param.Version_SSL
CASE "ProtocolTLS1"
http_envio..VersionSSL = ProtocolTLS1
CASE "ProtocolTLS1_1"
http_envio..VersionSSL = ProtocolTLS1_1
CASE "ProtocolTLS1_2"
http_envio..VersionSSL = ProtocolTLS1_2
CASE "ProtocolTLS1_3"
http_envio..VersionSSL = ProtocolTLS1_3
OTHER CASE
http_envio..VersionSSL = ProtocolDefault
END




//IGNORAR ERROS
http_envio..IgnoreError = httpIgnoreExpiredCertificate
http_envio..IgnoreError += httpIgnoreInvalidCertificate
http_envio..IgnoreError += httpIgnoreInvalidCertificateName
http_envio..IgnoreError += httpIgnoreRedirection
http_envio..IgnoreError += httpIgnoreRedirection
http_envio..IgnoreError += httpIgnoreRedirectToHTTP
http_envio..IgnoreError += httpIgnoreRedirectToHTTPS
http_envio..IgnoreError += httpIgnoreRevocation




//CERTIFICADO DIGITAL = USE fLoadBuffer DO ARQUIVO DO CERTIFICADO
IF Length(param.Certificado_Digital_p12) > 0 AND Length(param.Certificado_Password) > 0
http_envio..ClientCertificate = param.Certificado_Digital_p12 //fLoadBuffer(FCurrentDir()+FSep()+"Certificado_Digital.p12")
http_envio..ClientCertificatePassword = param.Certificado_Password
END




//DOWNLOAD
IF param.Download_Progress = True THEN
IF Length(param.Download_Progress_Frequency) > 0
http_envio..DownloadProgress..Frequency = param.Download_Progress_Frequency
END
IF Length(param.Download_Progress_Procedure) > 0
http_envio..DownloadProgress..Procedure = param.Download_Progress_Procedure
END
IF Length(param.Download_Progress_ProgressBar) > 0
http_envio..DownloadProgress..ProgressBar = param.Download_Progress_ProgressBar
END
IF Length(param.Download_Progress_MaxDownloadRate) > 0
http_envio..MaxDownloadRate = param.Download_Progress_MaxDownloadRate
END
END



//UPLOAD
IF param.Upload_Progress = True THEN
IF Length(param.Upload_Progress_Frequency) > 0
http_envio..UploadProgress.Frequency = param.Upload_Progress_Frequency
END
IF Length(param.Upload_Progress_Procedure) > 0
http_envio..UploadProgress.Procedure = param.Upload_Progress_Procedure
END
IF Length(param.Upload_Progress_ProgressBar) > 0
http_envio..UploadProgress.ProgressBar = param.Upload_Progress_ProgressBar
END
IF Length(param.Upload_Progress_MaxUploadRate) > 0
http_envio..MaxUploadRate = param.Upload_Progress_MaxUploadRate
END
END



IF Length(param.Procedure_Trace) > 0
http_envio.ProcedureTrace = param.Procedure_Trace
END





//---------------------------------------------------SEND---------------------------------------------------



IF param.HTTPSend_or_RESTSend = "HTTPSend"
http_retorno = HTTPSend(http_envio)
ELSE IF param.HTTPSend_or_RESTSend = "RESTSend"
rest_envio <= http_envio
rest_retorno = RESTSend(rest_envio)
http_retorno <= rest_retorno
ELSE
http_retorno = HTTPSend(http_envio)
END
//httpform


//---------------------------------------------------RETORNO------------------------------------------------

param.retorno_content = http_retorno.Content
param.retorno_Type = http_retorno.ContentType
param.retorno_StatusCode = http_retorno.StatusCode
param.retorno_StatusDescription = http_retorno.DescriptionStatusCode

//feito
//----------------------------------------------------DESERIALIZE------------------------------------------

varRetornoContent is Variant = 1
// if Deserializar = true
// Deserialize(varRetornoContent,param.retorno_content,psdJSON)
// END

//-----------------------------------------------------HEADER RESULT----------------------------------------


Header_Item is int = 0
IF ArrayCount(http_retorno.Header) > 0 THEN
FOR EACH st_retorno OF http_retorno.Header
Header_Item++
arr_header_retorno.Add(http_retorno.Header)
END
END


//-----------------------------------------------------RETORNO BUFFERIZADO----------------------------------------------------


SWITCH param.Content_type_Retorno
CASE "BufferToHexa"
param.Content_Buffer_Retorno = http_retorno.Content.BufferToHexa()
CASE "BufferToInteger"
param.Content_Buffer_Retorno = http_retorno.Content.BufferToInteger()
CASE "BufferToReal"
param.Content_Buffer_Retorno = http_retorno.Content.BufferToReal()
CASE "Encode"
param.Content_Buffer_Retorno = http_retorno.Content.Encode()
CASE "EncryptAsymmetric_cryptPaddingOAEP"
param.Content_Buffer_Retorno = http_retorno.Content.EncryptAsymmetric(param.PublicKeyFile,param.KeyPassword,cryptPaddingOAEP)
CASE "EncryptAsymmetric_cryptPaddingPKCS1"
param.Content_Buffer_Retorno = http_retorno.Content.EncryptAsymmetric(param.PublicKeyFile,param.KeyPassword,cryptPaddingPKCS1)
CASE "EncryptAsymmetricEnvelopped"
param.Content_Buffer_Retorno = http_retorno.Content.EncryptAsymmetricEnvelopped(param.PublicKeyFile,param.KeyPassword)
CASE "DecryptAsymmetric_cryptPaddingOAEP"
param.Content_Buffer_Retorno = http_retorno.Content.DecryptAsymmetric(param.PrivateKeyFile,param.KeyPassword,cryptPaddingOAEP)
CASE "DecryptAsymmetric_cryptPaddingPKCS1"
param.Content_Buffer_Retorno = http_retorno.Content.DecryptAsymmetric(param.PrivateKeyFile,param.KeyPassword,cryptPaddingPKCS1)
CASE "DecryptAsymmetricEnvelopped"
param.Content_Buffer_Retorno = http_retorno.Content.DecryptAsymmetricEnvelopped(param.PrivateKeyFile,param.KeyPassword)
END

//-----------------------------------------------------


http_retorno.Content.HTMLToRTF()
http_retorno.Content.HTMLToRTF(charsetArabic)
http_retorno.Content.HTMLToRTF(charsetCurrent)
http_retorno.Content.HTMLToRTF(charsetDefault)
http_retorno.Content.HTMLToRTF(charsetOccidental)
http_retorno.Content.HTMLToRTF(charsetUTF8)
http_retorno.Content.HTMLToRTF(charsetBaltic)
http_retorno.Content.HTMLToRTF(charsetChinese)
http_retorno.Content.HTMLToRTF(charsetEastEurope)
http_retorno.Content.HTMLToRTF(charsetGreek)
http_retorno.Content.HTMLToRTF(charsetHebrew)
http_retorno.Content.HTMLToRTF(charsetJapanese)
http_retorno.Content.HTMLToRTF(charsetKorean)
http_retorno.Content.HTMLToRTF(charsetRussian)
http_retorno.Content.HTMLToRTF(charsetThai)
http_retorno.Content.HTMLToRTF(charsetTraditionalChinese)
http_retorno.Content.HTMLToRTF(charsetTurkish)
http_retorno.Content.HTMLToRTF(charsetVietnamese)




http_retorno.Content.HTMLToText(charsetAnsi)
http_retorno.Content.HTMLToText(charsetArabic)
http_retorno.Content.HTMLToText(charsetCurrent)
http_retorno.Content.HTMLToText(charsetDefault)
http_retorno.Content.HTMLToText(charsetUTF8)
http_retorno.Content.HTMLToText(charsetBaltic)
http_retorno.Content.HTMLToText(charsetChinese)
http_retorno.Content.HTMLToText(charsetEastEurope)
http_retorno.Content.HTMLToText(charsetGreek)
http_retorno.Content.HTMLToText(charsetHebrew)
http_retorno.Content.HTMLToText(charsetJapanese)
http_retorno.Content.HTMLToText(charsetKorean)
http_retorno.Content.HTMLToText(charsetMac)
http_retorno.Content.HTMLToText(charsetOccidental)
http_retorno.Content.HTMLToText(charsetRussian)
http_retorno.Content.HTMLToText(charsetThai)
http_retorno.Content.HTMLToText(charsetVietnamese)



http_retorno.Content.AnsiToUnicode()
http_retorno.Content.UTF8ToAnsi()
http_retorno.Content.UTF8ToString()
http_retorno.Content.UTF8ToUnicode()
http_retorno.Content.UnicodeToAnsi()


http_retorno.Content.Compress(compressGZIP)
http_retorno.Content.Compress(compressLZW)
http_retorno.Content.Compress(compressNone)
http_retorno.Content.Compress(compressShortString)

http_retorno.Content.Uncompress()

http_retorno.Content.Encode(encodeBASE64)
http_retorno.Content.Encode(encodeBASE64NoCR)
http_retorno.Content.Encode(encodeBASE64URL)
http_retorno.Content.Encode(encodeBASE85)
http_retorno.Content.Encode(encodePCS)
http_retorno.Content.Encode(encodeURLFromAnsi)
http_retorno.Content.Encode(encodeURLFromUnicode)
http_retorno.Content.Encode(encodeURLFromUTF8)
http_retorno.Content.Encode(encodeURLParameter)
http_retorno.Content.Encode(encodeUUEncode)

http_retorno.Content.Decode(encodeBASE64)
http_retorno.Content.Decode(encodeBASE64NoCR)
http_retorno.Content.Decode(encodeBASE64URL)
http_retorno.Content.Decode(encodeBASE85)
http_retorno.Content.Decode(encodePCS)
http_retorno.Content.Decode(encodeURLToAnsi)
http_retorno.Content.Decode(encodeURLToUnicode)
http_retorno.Content.Decode(encodeURLToUTF8)
http_retorno.Content.Decode(encodeUUEncode)



http_retorno.GetCookie()



DO

HourGlass(False)

Error(ErrorInfo(errFullDetails))

RESULT False

END

##############################################################################

EXEMPLO DE USO:

##############################################################################

// Summary: <specify the procedure action>
// Syntax:
// Exemplo ()
//
// Parameters:
// None
// Return value:
// None
//
// Example:
// <Specify a usage example>
//
PROCEDURE PUBLIC GLOBAL Exemplo()

//AuthToken
//Bearer_Token
//Certificado_Digital_p12
//Certificado_Password
//Codificar_Url
//Connection_Timeout
//Content_Buffer_Retorno
//Content_Type_Envio
//Content_type_Retorno
//Cookie_Acao
//Cookie_Ativacao
//Cookie_Dominio
//Cookie_Name
//Cookie_Valor
//Destination
//Download_Progress
//Download_Progress_Frequency
//Download_Progress_MaxDownloadRate
//Download_Progress_Procedure
//Download_Progress_ProgressBar
//Header_Nome01
//Header_Nome02
//Header_Nome03
//Header_Password
//Header_User
//Header_Valor01
//Header_Valor02
//Header_Valor03
//HTTPSend_or_RESTSend
//KeyPassword
//Metodo
//PacoteJson
//PrivateKeyFile
//Procedure_Trace
//PublicKeyFile
//retorno_content
//retorno_StatusCode
//retorno_StatusDescription
//retorno_Type
//senha
//timeout_envio
//tipo_Url_Encode
//type_Mime
//Upload_Progress
//Upload_Progress_Frequency
//Upload_Progress_MaxUploadRate
//Upload_Progress_Procedure
//Upload_Progress_ProgressBar
//ClasseApiRest.SendApiRest = "pcsoft.fr"
//usuario
//Version_HTTP
//Version_SSL


parametros.URL = "pcsoft.fr"
parametros.usuario = "adriano"
parametros.senha = "123"
retorno is Variant = SendApiRest()

##############################################################################
Boller
EXEMPLO DE USO DE API DIGEST

ENVIADO POR PAULO MAIA
##############################################################################

PROCEDURE digest()

HTTP.IgnoreError = httpIgnoreInvalidCertificate+httpIgnoreExpiredCertificate+httpIgnoreInvalidCertificateName
HTTPRequest("http://192.168.0.77:80/ISAPI/Intelligent/FDLib/Count?format=json")

sNonce is string = ExtractString(HTTPGetResult(httpHeader),4,",")
sOpaque is string = ExtractString(HTTPGetResult(httpHeader),5,",")

sRealm is string = "DS-4BF9600C"
sQop is string = "auth"

sNonce = ExtractString(sNonce,2,"""")

sOpaque = ExtractString(sOpaque,2,"""")

sCabecalho is string
sCnonce is string = "Access_Controller"

sNoncecount is string = "00000001"

s_resposta is string

HA1 is string = BufferToHexa(HashString(HA_MD5_128, "admin:DS-4BF9600C:nutt1363#"))
HA1 = Lower(StringDelete(HA1," "))
HA2 is string = BufferToHexa(HashString(HA_MD5_128,"GET:/ISAPI/Intelligent/FDLib/Count?format=json"))
HA2 = Lower(StringDelete(HA2," "))
s_resposta = BufferToHexa(HashString(HA_MD5_128,HA1+ ":" + sNonce + ":" + sNoncecount + ":" + sCnonce + ":" + sQop + ":" + HA2))
s_resposta = Lower(StringDelete(s_resposta," "))

sCabecalho = " Digest username= ""admin"" , realm=""%1"", nonce=""%2"", uri=""/ISAPI/Intelligent/FDLib/Count?format=json"", qop=auth, nc=00000001, cnonce=""Access_Controller"", response=""%3"", opaque=""%4"" "
sCabecalho = StringBuild(sCabecalho,sRealm,sNonce,s_resposta,sOpaque)

cRequisicao is httpRequest
cRequisicao.URL = "http://192.168.0.77:80/ISAPI/Intelligent/FDLib/Count?format=json"
cRequisicao..Header["Cache-Control"] = "no-cache"
cRequisicao..Header["host"] = "192.168.0.77"
cRequisicao..Header["Accept-Encoding"] = "gzip, deflate"
cRequisicao..Header["Connection"] = "keep-alive"
cRequisicao..Header["Authorization"] = sCabecalho
cRequisicao.IgnoreError = httpIgnoreInvalidCertificate+httpIgnoreExpiredCertificate+httpIgnoreInvalidCertificateName
cResposta is httpResponse = HTTPSend(cRequisicao)

bufRésultat is Buffer = cResposta.Content

Info(cResposta.Content)
##############################################################################