Hi all,
Could you check that code.
I'm trying to access REST web service using HTTP basic authntication, but this is not working as well.
Could you help me ?
#include "fivewin.ch"
function main()
local ohttp := CreateObject( "MSXML2.XMLHTTP" )
set date french
set century on
oHttp := CreateObject( 'Microsoft.XMLHTTP' )
cHttpSend := [{ "Username": ]+hb_base64Encode("test:")+[, "Password": ]+hb_base64Encode("12345")+[}]
cUri:="https://demosite/DiamicBiothequeService.svc/patients/123456789/patientinfos"
ohttp:Open( "GET" ,cUri, .F. )
ohttp:SetRequestHeader( "Accept" , "application/json" )
ohttp:SetRequestHeader( "Content-Type" , "application/json" )
*ohttp:SetRequestHeader( "Username" , hb_base64Encode("test:"))
*ohttp:SetRequestHeader( "Password" , hb_base64Encode("12345") )
ohttp:SetRequestHeader( "Authorization" , cHttpSend )
try
ohttp:Send( cHttpSend )
catch
MsgInfo( "Connection error:" + oHttp:lastErrorMessage())
end
msgalert( alltrim(ohttp:responseText) )
return .T.
Thank you in advance.
kind regards.
Jack.