Dealing With Dreaded Error 2032 For Flex on Rails Developers
CommentsJudging by the number of comments on this blog (which by the way, is a must-read that contains lots of useful information on the problem), Error # 2032 is a very troublesome error for Flex (and Flex on Rails) developers, especially the first time you run into it. I think the problem is that the error message, typically something like:
PC Fault faultString=“HTTP request error” faultCode=“Server.Error.Request” faultDetail=“Error: [IOErrorEvent type=”ioError" bubbles=false cancelable=false eventPhase=2 text=“Error #2032: Stream Error. URL: http://localhost:3000”]
and in the case of Rails developers, a “General Server Error” appearing in your production or development log, doesn’t reveal much about what the specific problem is.
I ran into this problem myself and wrestled with it for the better part of a day before I figured out what was happening. A couple of tips for Flex and Rails developers that hopefully will save somebody some pain:
(1) On your Flex HttpService component, do NOT set the content_type attribute to “application/xml” unless you are making an HTTP POST request that sends XML parameters in your request to the server. If are making a GET request, or a POST that does not send XML, and you set content_type=“application/xml,” it may/will cause a General Server Failure error. Ugly, and not informative.
(2) Make sure the URL for your HTTPService request is correctly/properly formed, that it routes correctly to your Rails controller and action and is made to the correct port that your application is running on.
(3) Be aware that Flex does not play nicely in some cases with HTTP error codes returned by your Rails app. For more information, see this.
(4) Make sure your Rails application is actually running! A 2032 error is generated by Flex when the Flex HTTPService cannot connect to your application. This is a gotcha that can cause you to fuss with your HTTPService before you realize what is happening, and break your Flex code when it is in fact working.
That’s it. If you have more tips on this subject, please send them along.