Chilkat Forum

Technologies => REST / HTTP / HTTPS => Topic started by: bbdesign on January 03, 2018, 04:30:09 PM

Title: How to use HttpRequest to send XML data
Post by: bbdesign on January 03, 2018, 04:30:09 PM
I normally use HttpRequest to POST parameters to a URL and receive the results. I would like to use the component to POST XML data instead, and I'm not sure of the syntax.

Here is what I normally do (this is Classic ASP):

<%

set inet=server.CreateObject("Chilkat_9_5_0.Http")
inet.UnlockComponent "xxx"
set inetRequest=server.CreateObject("Chilkat_9_5_0.HttpRequest")
inetRequest.AddParam "parameter1","value1"
set inetResponse=inet.PostUrlEncoded("https://secure2.authorize.net/gateway/transact.dll", inetRequest)
response.write(inetResponse.BodyStr)

%>

Here is what I started doing with XML instead:

<%

xml="[xml data here]"

set inet=server.CreateObject("Chilkat_9_5_0.Http")
inet.UnlockComponent "xxx"
set inetRequest=server.CreateObject("Chilkat_9_5_0.HttpRequest")
inetRequest.HttpVerb="POST"
inetRequest.ContentType="text/xml"

%>

...but that is where I get stuck, because I'm not sure what to use instead of PostUrlEncoded. Can someone point me in the right direction? Thank you!
Title: Re: How to use HttpRequest to send XML data
Post by: dev guy on January 03, 2018, 05:32:41 PM
Have you looked at the XML Request example? https://www.example-code.com/asp/http_xmlHttpRequest.asp
Title: Re: How to use HttpRequest to send XML data
Post by: bbdesign on January 03, 2018, 06:47:25 PM
That seems to be what I was looking for, I couldn't find that example for some reason. I'll give it a try. Thanks!
Title: Re: How to use HttpRequest to send XML data
Post by: bbdesign on January 03, 2018, 06:51:06 PM
That worked perfectly, thanks again!