B4X
B4X
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 B4X Downloads
Dim success As Boolean = False
' This example requires the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.
Dim http As ChilkatHttp
http.Initialize("http")
Dim strXml As String = "<TransactionSetup xmlns=" & Chr(34) & "https://xyz.com" & Chr(34) & "><Credentials><AccountID>XXX</AccountID></Credentials></TransactionSetup>"
' Maybe you need other headers?
http.SetRequestHeader("Accept", "application/xml")
Dim resp As ChilkatHttpResponse
resp.Initialize
success = http.HttpStr("POST", "https://www.somewebsite.com/", strXml, "utf-8", "application/xml", resp)
If success = False Then
Log(http.LastErrorText)
Return
End If
' Examine the response status code:
Log("response status code = " & resp.StatusCode)
' Examine the response body:
Log("response body: " & resp.BodyStr)