Tcl
Tcl
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 Tcl Downloads
load ./chilkat.dll
set success 0
# This example requires the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.
set http [new_CkHttp]
set strXml "<TransactionSetup xmlns=\"https://xyz.com\"><Credentials><AccountID>XXX</AccountID></Credentials></TransactionSetup>"
# Maybe you need other headers?
CkHttp_SetRequestHeader $http "Accept" "application/xml"
set resp [new_CkHttpResponse]
set success [CkHttp_HttpStr $http "POST" "https://www.somewebsite.com/" $strXml "utf-8" "application/xml" $resp]
if {$success == 0} then {
puts [CkHttp_lastErrorText $http]
delete_CkHttp $http
delete_CkHttpResponse $resp
exit
}
# Examine the response status code:
puts "response status code = [CkHttpResponse_get_StatusCode $resp]"
# Examine the response body:
puts "response body: [CkHttpResponse_bodyStr $resp]"
delete_CkHttp $http
delete_CkHttpResponse $resp