<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
> 
<channel>
	<title>Appcelerator Developer Center Q&amp;A Tag Feed (0)</title> 
	<atom:link href="http://developer.appcelerator.com/questions/feed/tag/0" rel="self" type="application/rss+xml" /> 
	<link>http://developer.appcelerator.com/questions/feed/tag/0</link> 
	<description>Appcelerator Developer Center Q&amp;A feed for the tag: "0"</description> 
	<lastBuildDate>Sun, 26 May 2013 00:24:08 -0700</lastBuildDate> 
	<pubDate>Sun, 26 May 2013 00:24:08 -0700</pubDate>
	<copyright>Copyright (c) 2008-2013 by Appcelerator Inc.</copyright>
	<webMaster>info@appcelerator.com</webMaster>
	<generator>Appcelerator Developer Center</generator>
	<ttl>5</ttl>
	<language>en</language>
	<item>
		<title>HTTPClient returns status code 0 on other's device but not mine</title> 
		<link>http://developer.appcelerator.com/question/131472/httpclient-returns-status-code-0-on-others-device-but-not-mine</link>
		<pubDate>Wed, 01 Feb 2012 01:45:44 -0800</pubDate>
		<dc:creator>Peter Willemsen</dc:creator> 
				<category><![CDATA[image]]></category> 
				<category><![CDATA[iphone]]></category> 
				<category><![CDATA[httpclient]]></category> 
				<category><![CDATA[status]]></category> 
				<category><![CDATA[0]]></category> 
				<guid isPermaLink="true">http://developer.appcelerator.com/question/131472/httpclient-returns-status-code-0-on-others-device-but-not-mine</guid>
		<description><![CDATA[Hi,

I have a really weird problem here.
One person said to me that he has a error message saying status code 0 on iPhone 4. Using WiFi

SDK version: 1.7.5 and 1.9.0.v20120130214634
But I cannot reproduce it. It seems to be a very strange problem.

HTTPClient is a really buggy component, I think I even go save and make a native module as a replacement.

But first maybe this can be fixed, this is my code:
~~~
if(isIOS) {
		// TODO
	} else {
		var toast = Titanium.UI.createNotification({
			duration : 5000,
			message : &quot;Uploading photo...&quot;
		});
		toast.show();
	}
	xhr = Titanium.Network.createHTTPClient({
		enableKeepAlive : false
	});
	xhr.open('POST', &quot;http://example.nl/test/index.php&quot;, true);
	//xhr.setRequestHeader(&quot;Content-Type&quot;,&quot;multipart/form-data&quot;);
	//xhr.setRequestHeader('Content-Type', 'application/json; charset=utf-8');
	xhr.setRequestHeader('User-Agent', 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/534.30 (KHTML, like Gecko) Ubuntu/11.04 Chromium/12.0.742.112 Chrome/12.0.742.112 Safari/534.30');
	//xhr.setTimeout(5000);
	app.showLoader();
	xhr.onerror = function() {
		alert(&quot;error code: &quot; + this.status);
		/// this.status = 0
	};
	xhr.onload = function() {
		if(this.status == '200') {
			if(this.readyState == 4) {
				// do something with response
			} else {
				app.hideLoader();
			}
		} else {
			alert('HTTP Error Response Status Code = ' + this.status);
			app.hideLoader();
		}
	};
	xhr.send({
		name : &quot;photo.png&quot;,
		file : image /* this is a image returned from the photo library or camera (event.media) */
	});
};
~~~

What i found was that status code is 0, onload is never called on the iPhone 4, but the photo is actually visible on my server!]]></description>
		<content:encoded><![CDATA[<p>Hi,</p>

<p>I have a really weird problem here.
One person said to me that he has a error message saying status code 0 on iPhone 4. Using WiFi</p>

<p>SDK version: 1.7.5 and 1.9.0.v20120130214634
But I cannot reproduce it. It seems to be a very strange problem.</p>

<p>HTTPClient is a really buggy component, I think I even go save and make a native module as a replacement.</p>

<p>But first maybe this can be fixed, this is my code:<pre class="javascript codeblock"><span class="kw1">if</span><span class="br0">&#40;</span>isIOS<span class="br0">&#41;</span> <span class="br0">&#123;</span>
        <span class="co1">// TODO</span>
    <span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span>
        <span class="kw2">var</span> toast <span class="sy0">=</span> Titanium.<span class="me1">UI</span>.<span class="me1">createNotification</span><span class="br0">&#40;</span><span class="br0">&#123;</span>
            duration <span class="sy0">:</span> <span class="nu0">5000</span><span class="sy0">,</span>
            message <span class="sy0">:</span> <span class="st0">&quot;Uploading photo...&quot;</span>
        <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span>
        toast.<span class="me1">show</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
    <span class="br0">&#125;</span>
    xhr <span class="sy0">=</span> Titanium.<span class="me1">Network</span>.<span class="me1">createHTTPClient</span><span class="br0">&#40;</span><span class="br0">&#123;</span>
        enableKeepAlive <span class="sy0">:</span> <span class="kw2">false</span>
    <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span>
    xhr.<span class="kw3">open</span><span class="br0">&#40;</span><span class="st0">'POST'</span><span class="sy0">,</span> <span class="st0">&quot;http://example.nl/test/index.php&quot;</span><span class="sy0">,</span> <span class="kw2">true</span><span class="br0">&#41;</span><span class="sy0">;</span>
    <span class="co1">//xhr.setRequestHeader(&quot;Content-Type&quot;,&quot;multipart/form-data&quot;);</span>
    <span class="co1">//xhr.setRequestHeader('Content-Type', 'application/json; charset=utf-8');</span>
    xhr.<span class="me1">setRequestHeader</span><span class="br0">&#40;</span><span class="st0">'User-Agent'</span><span class="sy0">,</span> <span class="st0">'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/534.30 (KHTML, like Gecko) Ubuntu/11.04 Chromium/12.0.742.112 Chrome/12.0.742.112 Safari/534.30'</span><span class="br0">&#41;</span><span class="sy0">;</span>
    <span class="co1">//xhr.setTimeout(5000);</span>
    app.<span class="me1">showLoader</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
    xhr.<span class="kw3">onerror</span> <span class="sy0">=</span> <span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
        <span class="kw3">alert</span><span class="br0">&#40;</span><span class="st0">&quot;error code: &quot;</span> <span class="sy0">+</span> <span class="kw1">this</span>.<span class="kw3">status</span><span class="br0">&#41;</span><span class="sy0">;</span>
        <span class="co1">/// this.status = 0</span>
    <span class="br0">&#125;</span><span class="sy0">;</span>
    xhr.<span class="kw3">onload</span> <span class="sy0">=</span> <span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
        <span class="kw1">if</span><span class="br0">&#40;</span><span class="kw1">this</span>.<span class="kw3">status</span> <span class="sy0">==</span> <span class="st0">'200'</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
            <span class="kw1">if</span><span class="br0">&#40;</span><span class="kw1">this</span>.<span class="me1">readyState</span> <span class="sy0">==</span> <span class="nu0">4</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
                <span class="co1">// do something with response</span>
            <span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span>
                app.<span class="me1">hideLoader</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
            <span class="br0">&#125;</span>
        <span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span>
            <span class="kw3">alert</span><span class="br0">&#40;</span><span class="st0">'HTTP Error Response Status Code = '</span> <span class="sy0">+</span> <span class="kw1">this</span>.<span class="kw3">status</span><span class="br0">&#41;</span><span class="sy0">;</span>
            app.<span class="me1">hideLoader</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
        <span class="br0">&#125;</span>
    <span class="br0">&#125;</span><span class="sy0">;</span>
    xhr.<span class="me1">send</span><span class="br0">&#40;</span><span class="br0">&#123;</span>
        <span class="kw3">name</span> <span class="sy0">:</span> <span class="st0">&quot;photo.png&quot;</span><span class="sy0">,</span>
        file <span class="sy0">:</span> image <span class="co2">/* this is a image returned from the photo library or camera (event.media) */</span>
    <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="br0">&#125;</span><span class="sy0">;</span></pre>
What i found was that status code is 0, onload is never called on the iPhone 4, but the photo is actually visible on my server!</p>
]]></content:encoded>
	</item>
	<item>
		<title>about Titanium.Network.createHTTPClient API</title> 
		<link>http://developer.appcelerator.com/question/128671/about-titaniumnetworkcreatehttpclient-api</link>
		<pubDate>Thu, 24 Nov 2011 03:39:52 -0800</pubDate>
		<dc:creator>RICHA s.</dc:creator> 
				<category><![CDATA[0]]></category> 
				<guid isPermaLink="true">http://developer.appcelerator.com/question/128671/about-titaniumnetworkcreatehttpclient-api</guid>
		<description><![CDATA[Give me full detail about Titanium.Network.createHTTPClient API . how i can insert this in our code when i m creating desktop project, what r the steps i will have to follow . bcoz when i insert this  API and run the app. it is showing internal server error .]]></description>
		<content:encoded><![CDATA[<p>Give me full detail about Titanium.Network.createHTTPClient API . how i can insert this in our code when i m creating desktop project, what r the steps i will have to follow . bcoz when i insert this  API and run the app. it is showing internal server error .</p>
]]></content:encoded>
	</item>
	<item>
		<title>How i can call  web services from html page in titanium desktop project</title> 
		<link>http://developer.appcelerator.com/question/128624/how-i-can-call-web-services-from-html-page-in-titanium-desktop-project</link>
		<pubDate>Wed, 23 Nov 2011 06:58:06 -0800</pubDate>
		<dc:creator>RICHA s.</dc:creator> 
				<category><![CDATA[0]]></category> 
				<guid isPermaLink="true">http://developer.appcelerator.com/question/128624/how-i-can-call-web-services-from-html-page-in-titanium-desktop-project</guid>
		<description><![CDATA[i have created one form in html . i want it will call my wsdl web service when i will submit that form. and i have already created one link for web service.]]></description>
		<content:encoded><![CDATA[<p>i have created one form in html . i want it will call my wsdl web service when i will submit that form. and i have already created one link for web service.</p>
]]></content:encoded>
	</item>
</channel>
</rss>