Webservice connecting to https

Webservice connecting to https

Postby cdmmaui » Tue Dec 06, 2022 5:44 am

Hello Everyone,

Does someone have an example connecting to HTTPS based web service and reading JSON data from FWH?

Thank you,
*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
User avatar
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong

Re: Webservice connecting to https

Postby Marc Venken » Tue Dec 06, 2022 9:01 am

Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1434
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Webservice connecting to https

Postby cdmmaui » Tue Dec 06, 2022 1:43 pm

Thank you Marc.

Is there a sample for HTTPS connection to retrieve the JSON data or can I use code below?

TRY
oHttp := CreateObject( 'MSXML2.XMLHTTP' )
CATCH
oHttp := CreateObject( 'Microsoft.XMLHTTP' )
END

TRY
oHttp:Open( "GET", cUrl, .F.)
oHttp:SetRequestHeader( "KeyId", "xxx" )
oHttp:SetRequestHeader( "Accept", "*/*" )
oHttp:SetRequestHeader( "Content-Type", "application/json" )

oHttp:Send()
oHttp:waitForResponse()
IF oHttp:Status == 200
Sysrefresh()
cWinResp := oHttp:ResponseBody
MsgAlert( cWinResp, Ptitle )
ENDIF
CATCH oError
MsgAlert( oError:Description, Ptitle )
RETURN (.F.)
END
*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
User avatar
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 78 guests