[AC-2208] Android: HTTPClient POST is not working
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Cannot Reproduce |
Resolution Date | 2013-08-22T23:00:19.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Alloy, Titanium SDK & CLI |
Labels | android |
Reporter | Braden Powers |
Assignee | Mauro Parra-Miranda |
Created | 2013-08-16T14:05:58.000+0000 |
Updated | 2016-03-08T07:41:12.000+0000 |
Description
I have been trying to connect to my remote server and it works correctly in iOS but not in Android.
This is the code:
var params = {
username : 'yourUserName',
password : 'yourPassWord'
};
var url = "http://www.google.com/";
var xhr = Ti.Network.createHTTPClient({
onload : function(e) {
Ti.API.debug(this.responseText);
alert('success');
},
onerror : function(e) {
Ti.API.debug(e.error);
alert('error');
},
timeout : 5000,
});
xhr.open("POST", url);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.send(params);
#1 The JIRA is for reporting verified, use case backed problems with the platform. This should be in the Q&A if you are a community level user, or in the help desk of enterprise. #2 Since we KNOW that httpclient works on android, this is NOT a verified problem with the platform. #3 You have two onerror/timeout declarations, and while the second should overwrite the first, it leads me to question your programming skills as you have posted pretty dirty code. #4 There is not enough information to produce a test case. Ticket should be closed. #5 httpClient works for me. Ticket should be closed.
I have confirmed by going through different versions of the Titanium SDK that it does work with 3.1.0 and actually stopped working in 3.1.1.
Hi Braden, I have changed the test case to have valid syntax. You're welcome to try it again. Ideally we will need your server URL (and code) to be able to reproduce the issue. Also please state your Ti SDK version. Thanks.
Can you try it with 3.1.2 as well?
Sorry syntax was a mess. I did confirm it didn't work with 3.1.2 as well.
The server is running drupal 6.0 using hte 3.0 services module.
There is also a similar report at TC-2501. But it's hard for us to know the problem without being able to reproduce it. It looks like a server specific issue, but it's interesting that you're seeing a regression between 3.1.0 and 3.1.1. I might escalate TC-2501 and we can go from there.
DUP TIMOB-14939