Sample code for 30+ languages & platforms
Lianja

Transition from Http.PostXml to Http.HttpStr

Provides instructions for replacing deprecated PostXml method calls with HttpStr.

Chilkat Lianja Downloads

Lianja
llSuccess = .F.

loHttp = createobject("CkHttp")

lcUrl = "https://example.com/something"
lcRequestBodyXml = "<something>...</something>"
lcCharset = "utf-8"

// ------------------------------------------------------------------------
// The PostXml method is deprecated:

loResponseObj = loHttp.PostXml(lcUrl,lcRequestBodyXml,lcCharset)
if (loHttp.LastMethodSuccess = .F.) then
    ? loHttp.LastErrorText
    release loHttp
    return
endif

// ...
// ...

release loResponseObj

// ------------------------------------------------------------------------
// Do the equivalent using HttpStr.
// Your application creates a new, empty HttpResponse object which is passed 
// in the last argument and filled upon success.

loResponseOut = createobject("CkHttpResponse")
llSuccess = loHttp.HttpStr("POST",lcUrl,lcRequestBodyXml,lcCharset,"application/xml",loResponseOut)
if (llSuccess = .F.) then
    ? loHttp.LastErrorText
    release loHttp
    release loResponseOut
    return
endif



release loHttp
release loResponseOut