<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Thanks, Mister! &#187; Status 201</title>
	<atom:link href="http://www.thanksmister.com/index.php/archive/tag/status-201/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thanksmister.com</link>
	<description>Adobe Flex &#38; AIR Development</description>
	<lastBuildDate>Mon, 19 Jul 2010 17:28:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>HTTP Status 201 causing Flex #2032 Error in IE only</title>
		<link>http://www.thanksmister.com/index.php/archive/http-status-201-causing-flex-2032-error-in-ie-only/</link>
		<comments>http://www.thanksmister.com/index.php/archive/http-status-201-causing-flex-2032-error-in-ie-only/#comments</comments>
		<pubDate>Sat, 28 Mar 2009 16:40:13 +0000</pubDate>
		<dc:creator>Mister</dc:creator>
				<category><![CDATA[API]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[2032 Error]]></category>
		<category><![CDATA[HTTPService]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Status 201]]></category>
		<category><![CDATA[Web Services]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://thanksmister.com/?p=508</guid>
		<description><![CDATA[I ran into a problem right when we were going to launch a new Flex web-based application to production (of course) with Internet Explorer and Flex. I was calling an RESTful service that returns XML and using the built-in Flex HTTPService with either POST/GET as the method for the request. Most of the service calls [...]]]></description>
			<content:encoded><![CDATA[<p>I ran into a problem right when we were going to launch a new Flex web-based application to production (of course) with Internet Explorer and Flex.  I was calling an <a href="http://en.wikipedia.org/wiki/REST">RESTful</a> service that returns XML and using the built-in Flex HTTPService  with either POST/GET as the method for the request.   Most of the service calls either return a HTTP Status Code of 200 (OK) or they throw an error.  For one  POST request that returned a HTTP Status of  &#8220;201 Created&#8221;  Flex threw up a <a href="http://livedocs.adobe.com/flex/201/langref/runtimeErrors.html">2032 Stream Error</a> in response.   Here is a brief definition of the error: </p>
<blockquote><p>
<a href="http://editthis.info/flexerrorcodes/Main_Page">The referenced resource does not exist or the swf is trying to access a file across a restricted domain. </a>
</p></blockquote>
<p>This error causes Flex to report a fault error on the request even though it was successful.   The 201 status code  is handled fine in all other browsers except IE (6 &#038; 7).    I did some research on the issue thinking it must be something easy to fix, that many others have run across before me.    It seems the error is out there for lots of different reasons.  </p>
<p>One post reported that IE was having a caching issues, and the way to solve it was to add a random number on the end of your service calls or you have to set the response headers in your server side page to prevent caching.  This one sounds similar to a <a href="http://thanksmister.com/?p=59">FireFox issue</a> I ran into a couple years back, but didn&#8217;t effect the results:</p>
<p><span id="more-508"></span></p>
<p><a href="http://www.judahfrangipane.com/blog/?p=87">http://www.judahfrangipane.com/blog/?p=87</a></p>
<p>The overwhelming number of posts on the subject suggested that Rails and Adobe both share the responsibility for this error (depending on if you are a Rails dev or a Flex dev, the debate rages as to who is to blame).   The fix seems to be changing status returned from Rails to something other than 201.  This seems to be the legit solution since the web service I was hitting is running Rails:</p>
<p><a href="http://stackoverflow.com/questions/354936/flex-2032-stream-error-in-ie-only">http://stackoverflow.com/questions/354936/flex-2032-stream-error-in-ie-only</a><br />
<a href="http://nachbar.name/blog/2008/06/14/flex-railsprotect_from_forgery-problem-with-rails-21-produces-ioerror-2032/">http://nachbar.name/blog/2008/06/14/flex-railsprotect_from_forgery-problem-with-rails-21-produces-ioerror-2032/</a><br />
<a href="http://onrails.org/articles/2008/02/20/dealing-with-http-errors-in-a-flex-with-rails-application">http://onrails.org/articles/2008/02/20/dealing-with-http-errors-in-a-flex-with-rails-application</a><br />
<a href="http://www.manning-sandbox.com/message.jspa?messageID=64372">http://www.manning-sandbox.com/message.jspa?messageID=64372</a><br />
<a href="http://nachbar.name/blog/tag/adobe-flex-programming/">http://nachbar.name/blog/tag/adobe-flex-programming/</a></p>
<p>If you think Adobe should fix the issue (as some Rails people protest) then you can view all the other bug reports Adobe already had lined up to fix that involve a 2032 Stream Error, just type in Explorer 2032 and you will find them:</p>
<p><a href="http://bugs.adobe.com/jira/secure/QuickSearch.jspa">http://bugs.adobe.com/jira/secure/QuickSearch.jspa</a></p>
<p>The workaround we ended up implemented was totally client based.  In the fault handler of this particular service request, I look for the errorID value of the Fault event and ignore it.   It was all I could do on short notice and I wasn&#8217;t about to convince the backend dudes that we needed to change the server response from 201 to 200, pick your battles and my first battle was to get this app into the war. </p>
<p>For me the real culprit is IE (easy target).  Something that works in every other browser but IE is so friggen familiar to anyone who has done any cross-browser work.  IE sucks, it has always sucked, and it will always suck, period.  My other thought is about web services and codes in general.   As an application developer, I use a lot of different services, consuming data from many different pipes.   I couldn&#8217;t tell you as a consumer of web services and an application designer what the value of having a returned  Status of 201 has over returning a Status of 200, can you?    I make a request, and if the request is good, just tell me ok, I don&#8217;t need to know that the server returned a HTTP Status Code of 311 (the server code for &#8220;I just made you a sandwich&#8221;).  I need to know only two basic things, was the request good, or did it explode?</p>
<p>I think some API dudes and backend dudes are purists, they want server codes to bubble up to the client so we can admire them, even though in practice (meaning you actually build applications with these services) you don&#8217;t really need the extra data.  Hey, I am totally used to having to make 5 service calls to accomplish one thing with a web service, I would never ask for the service to be changed to convenience the client, but some information is superfluous and could be scaled down. </p>
<p><strong>UPDATE</strong></p>
<p>Saw another blog post about the same topic at <a href="http://userflex.wordpress.com/2009/01/08/io-stream-errors-in-air/">UserFlex</a>.    </p>
<p>- Mister</p>
<p><map name='google_ad_map_508_1452acacd61817fb'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/508?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_508_1452acacd61817fb' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=508&amp;url= http%3A%2F%2Fwww.thanksmister.com%2Findex.php%2Farchive%2Fhttp-status-201-causing-flex-2032-error-in-ie-only%2F' /></p>]]></content:encoded>
			<wfw:commentRss>http://www.thanksmister.com/index.php/archive/http-status-201-causing-flex-2032-error-in-ie-only/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
