Xbase++ Requires Chilkat v11.0.0+
Xbase++
Transition from Http.PTextSb to Http.HttpSb
Provides instructions for replacing deprecated PTextSb method calls with HttpSb.Chilkat Xbase++ Downloads
LOCAL nSuccess
LOCAL oHttp
LOCAL cVerb
LOCAL cUrl
LOCAL oSbRequestBody
LOCAL cCharset
LOCAL cContentType
LOCAL oResponseObj
LOCAL oResponseOut
nSuccess := 0
oHttp := CreateObject("Chilkat.Http")
cVerb := "PUT"
cUrl := "https://example.com/"
oSbRequestBody := CreateObject("Chilkat.StringBuilder")
oSbRequestBody:Append("This is the HTTP request body")
cCharset := "utf-8"
cContentType := "text/plain"
// ------------------------------------------------------------------------
// The PTextSb method is deprecated:
oResponseObj := oHttp:PTextSb(cVerb, cUrl, oSbRequestBody, cCharset, cContentType, 0, 0)
IF (oHttp:LastMethodSuccess == 0)
? oHttp:LastErrorText
oHttp:destroy()
oSbRequestBody:destroy()
RETURN
ENDIF
// ...
// ...
oResponseObj:destroy()
// ------------------------------------------------------------------------
// Do the equivalent using HttpSb.
// 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:HttpSb(cVerb, cUrl, oSbRequestBody, cCharset, cContentType, oResponseOut)
IF (nSuccess == 0)
? oHttp:LastErrorText
oHttp:destroy()
oSbRequestBody:destroy()
oResponseOut:destroy()
RETURN
ENDIF
oHttp:destroy()
oSbRequestBody:destroy()
oResponseOut:destroy()