Archive for the ‘Coldfusion’ Category

Remoting through Flex with Coldfusion

Tuesday, January 8th, 2008

I’m used to setting the ObjectEncoding to AMF0 when working with Flash Media Server 2, but haven’t realized till now that I also am required to do this when communicating with Coldfusion 8 through remoting:

1
2
3
import flash.net.NetConnection;
import flash.net.ObjectEncoding;
NetConnection.defaultObjectEncoding = flash.net.ObjectEncoding.AMF0;

The error “Unknown object type tag (17)” was being generated by CF8 as I attempted to pass an Object in AS3 over remoting to CF8 interpreted as a Structure. Apparently, there is also the need to wrap any such Object within a container Object for it to be properly read by the CFC:

1
2
3
4
var wrapper:Object = new Object();
wrapper.submissionObject = submissionObject;
submissionResponder = new Responder(onSubmissionResult, onSubmissionError);
testConnection.call("some.cfc.Test", submissionResponder, wrapper);

The CFC function expects a Structure named “submissionObject” in this case.

I hope this is helpful for someone- I had a hell of a time digging up this information.