Can't use XMLHttpRequest?
Hi!
Why can't XMLHttpRequest be used anymore (instead of Titanium.Network.HTTPClient)? It was possible in previous versions (at least on v. 0.8.x).
I can't use Titanium.Network.HTTPClient because… it just doesn't work (well)…
3 Answers
-
Hello !
I haven't had unresolved problems with the HTTPClient yet. Could you explain more about the issues you encountered with this object ?
Best regards
Iiii|; )
-
The problems are not with Titanium.Network.HTTPClient itself but with the response we get, in the form of a Titanium.XML.DOMDocument object.
As you may know, Titanium.XML.DOMDocument has bugs in the last version (1.2) that make it unusable.
For example, myDoc.getElementsByTagName("myName")[i] doesn't work and have to be replaced by myDoc.getElementsByTagName("myName").item(i). I use some libraries that extensively use myDoc.getElementsByTagName("myName")[i] and I had to change all occurrences of it…
Another example is performance issues. I used to use some libraries to convert XML SOAP documents into JSON objects. When I was using v. 0.8.x, I used XMLHttpRequest, get the XML response and convert it to JSON using those libraries. It was almost instantaneous.
Now that we can't use XMLHttpRequest anymore and have to use Titanium.Network.HTTPClient instead, the conversion from Titanium.XML.DOMDocument to JSON takes DOZEN of MINUTES… on my Core2Duo MacBook! And for some of them, it takes several HOURS!I tried with several libraries and it was this slow for ALL of them.
Maybe the bug with myDoc.getElementsByTagName and these performances issues are linked together…
So, Titanium.Network.HTTPClient can't be used as long as all the problems Titanium.XML.DOMDocument are solved.
That's why I would like to use the "regular" XMLHttpRequest object. -
I 100% agree. We should be able to use the xmlhttprequest objects.