【发布时间】:2015-01-27 19:31:01
【问题描述】:
我在现有的 REST cfc 中创建了一个新函数,但是当我尝试调用它时,我收到一个 404 错误,而其余函数正在运行。所有功能都遵循与我将要进一步向下链接的功能相同的结构。
我看到了另一个类似我的帖子,但我没有在其中找到任何答案。这是另一个帖子的链接here
<cfcomponent restpath="student" rest="true">
<cffunction name="npssummary" access="remote" output="false" returntype="any" httpmethod="get" restpath="npssummary" produces="application/json">
<cfquery name="nps_summary" datasource="dpsigweb2">
select top 10 * from contact
</cfquery>
<cfreturn serializeJSON(nps_summary,"struct")>
</cffunction>
</cfcomponent>
这就是我的称呼
<cfhttp url="http://dev.example.com/rest/IIT/student/npssummary" method="get">
<cfset results = "#cfhttp#">
<cfdump var="#results#">
当我尝试直接在浏览器中调用该函数时,我收到了预期的结果。
此外,每次我对组件进行更改时,我都使用此功能重置 REST 服务,到目前为止它似乎按预期工作。
<cftry>
<cfset restInitApplication("Z:\Sites\testSites\API\","IIT")>
<cfcatch type="any">
<cfdump var="#cfcatch#">
</cfcatch>
</cftry>
【问题讨论】:
-
您能否发布完整的 CFC,其中一种方法有效,另一种无效?还有你如何称呼他们。
-
我将更改我的功能并发布所有 cfc
-
干杯。足以重现这种情况,是的,而不是成吨的代码。
-
我想我刚刚发现了我的问题...我发送给该方法的参数太大...有这样的事情吗?
<cfhttpparam type="URL" name="DoctorIDs" value="2008013110482896439177,2010080209524690985587,2003051416543440840952">但想象一下它还有大约 100 个 ID @AdamCameron -
这很容易测试/(反)证明。我不希望这么长的字符串会给你带来问题,也就是说。如果是这样,我不希望出现 404。
标签: coldfusion coldfusion-10 coldfusion-11