Sample code for 30+ languages & platforms
Xbase++ Requires Chilkat v11.0.0+

Transition from Http.PBinaryBd to Http.HttpBd

Provides instructions for replacing deprecated PBinaryBd method calls with HttpBd.

Chilkat Xbase++ Downloads

Xbase++
LOCAL nSuccess
LOCAL oHttp
LOCAL cVerb
LOCAL cUrl
LOCAL oBdRequestBody
LOCAL cContentType
LOCAL oResponseObj
LOCAL oResponseOut

nSuccess := 0

oHttp := CreateObject("Chilkat.Http")

cVerb := "POST"
cUrl := "https://example.com/"
oBdRequestBody := CreateObject("Chilkat.BinData")
cContentType := "application/octet-stream"

//  ------------------------------------------------------------------------
//  The PBinaryBd method is deprecated:

oResponseObj := oHttp:PBinaryBd(cVerb, cUrl, oBdRequestBody, cContentType, 0, 0)
IF (oHttp:LastMethodSuccess == 0)
    ? oHttp:LastErrorText
    oHttp:destroy()
    oBdRequestBody:destroy()
    RETURN
ENDIF

//  ...
//  ...

oResponseObj:destroy()

//  ------------------------------------------------------------------------
//  Do the equivalent using HttpBd.
//  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:HttpBd(cVerb, cUrl, oBdRequestBody, cContentType, oResponseOut)
IF (nSuccess == 0)
    ? oHttp:LastErrorText
    oHttp:destroy()
    oBdRequestBody:destroy()
    oResponseOut:destroy()
    RETURN
ENDIF

oHttp:destroy()
oBdRequestBody:destroy()
oResponseOut:destroy()