FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Webservice connecting to https
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
Webservice connecting to https
Posted: Tue Dec 06, 2022 05: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
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM
Re: Webservice connecting to https
Posted: Tue Dec 06, 2022 09:01 AM
Marc Venken

Using: FWH 23.08 with Harbour
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
Re: Webservice connecting to https
Posted: Tue Dec 06, 2022 01: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

Continue the discussion