【发布时间】:2010-12-07 04:53:51
【问题描述】:
我正在使用 Flex 的 RemoteObject 方法调用 ColdFusion cfc 方法。
<fx:Declarations>
<s:RemoteObject destination="ColdFusion" source="cfc.categoryGateway" id="categoryGateway">
<s:method name="getCategoryList" result="returnHandler(event)"
fault="mx.controls.Alert.show(event.fault.faultString)">
<s:arguments>
<orderby>categoryId</orderby>
<parentCategory>1</parentCategory>
</s:arguments>
</s:method>
</s:RemoteObject>
</fx:Declarations>
我的 cfc 以下列方式接受参数:
<cffunction name="getCategoryList" access="remote" output="false" returntype="query">
<cfargument name="parentCategory" type="string" required="false" />
<cfargument name="orderby" type="string" required="false" />
<!--- code... --->
<cfreturn qCategoryList />
</cffunction>
所以你可以看到我在调用cfc方法时改变了参数的顺序。但它不起作用。
表示<s:arguments>没有传递named参数。
有什么解决办法吗?正如你所看到的,我可能有一些参数不是强制性的,所以它必须按名称传递。
【问题讨论】:
-
您确定问题出在 flex 上吗?当 Flex 调用 cfc 方法时,您是否尝试将参数范围转储到文件中以查看其中的内容?
-
是的,因为当我交换参数时,我在 SQL 查询中收到错误,例如:无法调用 CFC - CFSQLTYPE CF_SQL_INTEGER 的数据类别 ID 无效。
parentCategory实际上不是字符串参数,而是我在 SQL 查询中使用的整数参数。
如果参数顺序相同,则完美运行。
标签: apache-flex coldfusion flex4