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 😛 ) 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:
The other, non-default, options are plain (text for type that can be converted to a string) and json.