In your first code snippet, I don't see where you are checking the HTTP response code. You could be successfully reaching the server but getting an error code, like 401 or 500.
Also, do you know which of the connections you are using in this failure case? |