Xbase++ Requires Chilkat v11.0.0+
Xbase++
Transition from Http.PostJson2 to Http.HttpStr
Provides instructions for replacing deprecated PostJson2 method calls with HttpStr.Chilkat Xbase++ Downloads
LOCAL nSuccess
LOCAL oHttp
LOCAL cUrl
LOCAL cContentType
LOCAL cJsonText
LOCAL oResponseObj
LOCAL oResponseOut
nSuccess := 0
oHttp := CreateObject("Chilkat.Http")
cUrl := "https://example.com/something"
cContentType := "application/json"
cJsonText := "{ ... }"
// ------------------------------------------------------------------------
// The PostJson2 method is deprecated:
oResponseObj := oHttp:PostJson2(cUrl, cContentType, cJsonText)
IF (oHttp:LastMethodSuccess == 0)
? oHttp:LastErrorText
oHttp:destroy()
RETURN
ENDIF
// ...
// ...
oResponseObj:destroy()
// ------------------------------------------------------------------------
// Do the equivalent using HttpStr.
// 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:HttpStr("POST", cUrl, cJsonText, "utf-8", cContentType, oResponseOut)
IF (nSuccess == 0)
? oHttp:LastErrorText
oHttp:destroy()
oResponseOut:destroy()
RETURN
ENDIF
oHttp:destroy()
oResponseOut:destroy()