Author Topic: How to use HttpRequest to send XML data  (Read 705 times)

bbdesign

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
How to use HttpRequest to send XML data
« 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!

dev guy

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: How to use HttpRequest to send XML data
« Reply #1 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

bbdesign

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: How to use HttpRequest to send XML data
« Reply #2 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!

bbdesign

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: How to use HttpRequest to send XML data
« Reply #3 on: January 03, 2018, 06:51:06 PM »
That worked perfectly, thanks again!