我编写了一个简单的应用程序来测试RESTful API(由会计应用程序提供)。我已经在Firefox中安装了“Poster”来测试“GET和POST”XML,并且API的行为应该与它应该一样。我编写了一个简单的“GET”测试页面,从测试CF8应用程序中调用API,API返回了我期望的结果。我无法从测试CF8应用程序中进行POST。CFHTTP HTTPS连接失败CF8
我已插入以下到我的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>
这是一个错误的代码:
<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>
有关于这一主题发表了很多,我已经试过最多的事但其中一些帖子是关于甚至比我的旧CF版本!任何最新的帮助表示赞赏。
为什么要删除JsafeJCE安全提供程序?我认为这不会有帮助。最可能的问题是您需要将SSL证书导入到服务器的Java密钥库中。我已经概述了[这个其他答案]中的步骤(http://stackoverflow.com/a/20475763/1636917)。 – 2014-10-02 11:50:17
你能发布实际的回应/错误吗? – Nebu 2014-10-02 12:21:44
要验证的另一件事是您可以打开浏览器并连接到来自ColdFusion server_的URL _。 – 2014-10-02 12:45:23