How to convert Python HTTP Post to CF HTTP Post with Basic Authentication?
There seems to be an issue with the CF HTTP Post Authentication. It can't connect to the other side.
What am I missing in the CF code?
From - Python:
import datetime
import requests
auth = ('huant','vk2014')
url = 'https://www.mytestdomain.com'
inquiry_xml = "<inquiry>
<header>
<source>VK</source>
</header>
<data>
<request_date>2014-02-25T18:48:24</request_date>
<name>Huan</name>
<total_guests>4</total_guests>
<check_in>2014-02-25</check_in>
<check_out>2014-03-25</check_out>
<comment><![CDATA[hi could u please confirm there is availability and location wise are we close to sydney city centre as we have 2 young children. look forward to hearing from you. Thanks,John]]></comment>
<property_id>201027</property_id>
<email>myemail@test.com</email>
<phone_number>07747484202</phone_number>
<newsletter_opt_in>0</newsletter_opt_in>
<user_ip>90.221.169.227</user_ip>
<point_of_sale>mydomain.com</point_of_sale>
<utm_medium>mysync</utm_medium>
<utm_source>huant</utm_source>
<utm_campaign><![CDATA[VKPost]]></utm_campaign>
</data>
</inquiry>"
r = requests.post(url, auth=auth, data={'inquiry_xml': inquiry_xml}, verify=False)
print r.status_code
print r.text
To - Coldfusion
<cfsavecontent variable="strXML">
<inquiry><header><source>VK</source></header><data><request_date>2014-01->31T18:48:24</request_date><name>Huan</name><total_guests>4</total_guests><check_in>2014-06-20</check_in><check_out>2014-06-28</check_out><comment><![CDATA[hi could u please confirm]]></comment><property_id>350278</property_id><email>myemail@test.com</email><phone_number>07747484202</phone_number><newsletter_opt_in>0</newsletter_opt_in><user_ip>90.221.169.227</user_ip><point_of_sale>mydomain.com</point_of_sale><utm_medium>mysync</utm_medium><utm_source>huant</utm_source><utm_campaign>![CDATA[VKPost]]</utm_campaign></data></inquiry>
</cfsavecontent>
<cfhttp url="https://www.mytestdomain.com" method="post" result="objGet" username="huant" password="vk2014">
<cfhttpparam type="XML" value="#strXML.trim()#"/>
</cfhttp>
<cfdump var="#objGet#">
Update from comments
I've tried
<cfhttparam type="formfield" name="inquiry_xml" value="#strXML.trim()#">
and it still cannot authenticate. Here's the CFDump:
Charset [empty string]
ErrorDetail I/O Exception: peer not authenticated
Filecontent Connection Failure
Header [empty string]
Mimetype Unable to determine MIME type of file.
Responseheader struct [empty]
Statuscode Connection Failure. Status code unavailable. Text YES