Xbase++ Requires Chilkat v11.0.0+
Xbase++
Transition from Http.PostJson3 to Http.HttpJson
Provides instructions for replacing deprecated PostJson3 method calls with HttpJson.Chilkat Xbase++ Downloads
LOCAL nSuccess
LOCAL oHttp
LOCAL cUrl
LOCAL cContentType
LOCAL oJson
LOCAL oResponseObj
LOCAL oResponseOut
nSuccess := 0
oHttp := CreateObject("Chilkat.Http")
cUrl := "https://example.com/something"
cContentType := "application/json"
oJson := CreateObject("Chilkat.JsonObject")
oJson:LoadFile("C:/temp/requestBody.json")
// ------------------------------------------------------------------------
// The PostJson3 method is deprecated:
oResponseObj := oHttp:PostJson3(cUrl, cContentType, oJson)
IF (oHttp:LastMethodSuccess == 0)
? oHttp:LastErrorText
oHttp:destroy()
oJson:destroy()
RETURN
ENDIF
// ...
// ...
oResponseObj:destroy()
// ------------------------------------------------------------------------
// Do the equivalent using HttpJson.
// Your application creates a new, empty HttpResponse object which is passed
// in the last argument and filled upon success.
oResponseOut := CreateObject("Chilkat.HttpResponse")
nSuccess := oHttp:HttpJson("POST", cUrl, oJson, cContentType, oResponseOut)
IF (nSuccess == 0)
? oHttp:LastErrorText
oHttp:destroy()
oJson:destroy()
oResponseOut:destroy()
RETURN
ENDIF
oHttp:destroy()
oJson:destroy()
oResponseOut:destroy()