PowerShell
PowerShell
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 PowerShell Downloads
Add-Type -Path "C:\chilkat\ChilkatDotNet47-x64\ChilkatDotNet47.dll"
$success = $false
# This example requires the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.
$http = New-Object Chilkat.Http
$strXml = "<TransactionSetup xmlns=`"https://xyz.com`"><Credentials><AccountID>XXX</AccountID></Credentials></TransactionSetup>"
# Maybe you need other headers?
$http.SetRequestHeader("Accept","application/xml")
$resp = New-Object Chilkat.HttpResponse
$success = $http.HttpStr("POST","https://www.somewebsite.com/",$strXml,"utf-8","application/xml",$resp)
if ($success -eq $false) {
$($http.LastErrorText)
exit
}
# Examine the response status code:
$("response status code = " + $resp.StatusCode)
# Examine the response body:
$("response body: " + $resp.BodyStr)