I wrote a simple application to test a RESTful API (provided by an accounting application). I have installed "Poster" in Firefox to test "GET and POST" XML and the API is behaving as it should. I wrote a simple "GET" test page to call the API from within the test CF8 application and the API returned the results I expected. I cannot POST from within the test CF8 application.
I have inserted the following into my application.cfm:
<!--- fix for HTTPS connection failures --->
<cfif NOT isDefined("Application.sslfix")>
<cfset objSecurity = createObject("java", "java.security.Security") />
<cfset objSecurity.removeProvider("JsafeJCE") />
<cfset Application.sslfix = true />
</cfif>
This is the code that is failing:
<cfprocessingdirective suppressWhiteSpace = "Yes">
<cfxml variable="customerxml">
<?xml version="1.0" encoding="UTF8" standalone="yes"?>
<dataentry>
<interface name="Customer Edit"></interface>
<entity>
<attribute name="Customer Code">REP003</attribute>
<attribute name="Customer Name">Repsol3</attribute>
<attribute name="Address Line 1">El House</attribute>
<attribute name="Address Line 2">El Street</attribute>
<attribute name="Address Line 3">El Town</attribute>
</entity>
</dataentry>
</cfxml>
</cfprocessingdirective>
<cfhttp
method="post"
url="https://***/wsapi/1.1/dataentry/"
username="***"
password="***"
charset="utf-8">
<cfhttpparam type="header" name="Accept-Encoding" value="*" />
<cfhttpparam type="header" name="TE" value="deflate;q=0" />
<cfhttpparam type="header" name="Content-Type" value="application/xml" />
<cfhttpparam name="XML_Test" type="xml" value="#customerxml#">
</cfhttp>
There's a lot published on this topic and I have tried most things but some of the posts are about even older CF versions than mine! Any up-to-date help appreciated.