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 t开发者_Go百科he 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>
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:
By default, ColdFusion serializes all return types (including simple return types), except XML, into WDDX format, and returns XML data as XML text.
You can also use returnformat as an HTTP request parameter when calling a remote CFC function. This parameter has the same effect as the returnformat attribute and overrides any returnformat attribute value specified in the cffunction tag.
The other, non-default, options are plain (text for type that can be converted to a string) and json.
精彩评论