Xbase++
Xbase++
Send HTTPS POST with XML Body
See more HTTP Examples
Demonstrates how to send an HTTP (or HTTPS) POST where the body of the request is XML.Chilkat Xbase++ Downloads
LOCAL nSuccess
LOCAL oHttp
LOCAL cStrXml
LOCAL oResp
nSuccess := 0
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
oHttp := CreateObject("Chilkat.Http")
cStrXml := '<TransactionSetup xmlns="https://xyz.com"><Credentials><AccountID>XXX</AccountID></Credentials></TransactionSetup>'
// Maybe you need other headers?
oHttp:SetRequestHeader("Accept", "application/xml")
oResp := CreateObject("Chilkat.HttpResponse")
nSuccess := oHttp:HttpStr("POST", "https://www.somewebsite.com/", cStrXml, "utf-8", "application/xml", oResp)
IF (nSuccess == 0)
? oHttp:LastErrorText
oHttp:destroy()
oResp:destroy()
RETURN
ENDIF
// Examine the response status code:
? "response status code = " + Str(oResp:StatusCode)
// Examine the response body:
? "response body: " + oResp:BodyStr
oHttp:destroy()
oResp:destroy()