ColdFusion 如何序列化从 Web 服务调用返回的变量?
我想知道 ColdFusion 如何序列化从 Web 服务调用返回的变量,以便我可以计算出它们有多大(以字节为单位)。
我遇到了一些问题,当我的一些 Web 请求返回时(我可以从日志语句中看出),但随后我收到调用错误:无法执行 Web 服务调用。
我从调试中得到的预感到目前为止所做的事情是,它尝试序列化并发回的返回结构太大,我想为其大小添加另一个日志语句。我可以在返回之前在远程方法中记录 len(resultStruct) 或 len(serializeJSON(resultStruct)) ,但理想情况下我会得到我们发回的真实长度在一系列管子上。
发出请求的代码(取自运行我们的功能测试的组件:-P)如下:
<cfinvoke webservice="#remoteFacadeURL#" method="executeTestCase" returnvariable="currMethodResult">
<cfinvokeargument name="componentName" value="#componentName#"/>
<cfinvokeargument name="methodNames" value="#getTestsQuery.methodName#"/>
<cfinvokeargument name="TestRunKey" value="#TestRunKey#"/>
</cfinvoke>
I would like to know how ColdFusion serializes variables returned from web service calls so that I can figure out how large (in bytes) they are.
I am having issues where when a few of my web requests are returning (I can tell from log statements) but then I get INVOCATION ERROR: Cannot perform web service invocation.
My hunch from the debugging I've done thus far is that the return struct it is trying to serialize and send back is too large, and I would like to add another log statement for its size. I could log len(resultStruct) or len(serializeJSON(resultStruct)) in the remote method right before returning, but ideally I'd have the true length we are sending back over the series of tubes.
The code (taken from a component that runs our functional tests :-P ) that makes the request is as follows:
<cfinvoke webservice="#remoteFacadeURL#" method="executeTestCase" returnvariable="currMethodResult">
<cfinvokeargument name="componentName" value="#componentName#"/>
<cfinvokeargument name="methodNames" value="#getTestsQuery.methodName#"/>
<cfinvokeargument name="TestRunKey" value="#TestRunKey#"/>
</cfinvoke>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我通过检查响应找到了答案,这让我找到了相应的文档,该文档表明序列化类型取决于 cffunction 标记的“returnFormat”属性,如果缺少该属性,则默认为 WDDX。
来自 cffunction ColdFusion 8 文档:
其他非默认选项是纯文本(可以转换为字符串的类型的文本)和 json。
I found the answer by inspecting the response and that let me to the appropriate documentation which indicates that the serialization type depends on the "returnFormat" attribute of the cffunction tag, which if missing defaults to WDDX.
Fromt the cffunction ColdFusion 8 Documentation:
The other, non-default, options are plain (text for type that can be converted to a string) and json.