Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9151589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:50:25+00:00 2026-06-17T11:50:25+00:00

I recently came across strange problem when sending / recieving data thru http POST

  • 0

I recently came across strange problem when sending / recieving data thru http POST request on Android.

I had difficulties with setting Fiddler to monitor the traffic between my Android app and server so I created simple web form to simulate the POST request.

<form action="http://www.my.server.org/my_script.php" method="POST">
  <input name="deviceID" type="text" width=30> Device ID <br>
  <input name="lang" type="text" width=30> Language (en / cs) <br>
  <input name="lastUpdated" type="text" width=30> Last Updated (yyyy-MM-dd hh:mm) <br>
  <button type="submit">Send</button>
</form>

When I send the request using this form, a response is delivered back with 200 OK status code and desired XML file.

I thought it would be equivalent to Java code I have in my Android app.

private static final String POST_PARAM_LAST_UPDATED = "lastUpdated";
private static final String POST_PARAM_DEVICE_ID = "deviceId";
private static final String POST_PARAM_LANG = "lang";

...

// Create a POST Header and add POST Parameters
HttpPost httpPost = new HttpPost(URL_ARTICLES);
List<NameValuePair> postParameters = new ArrayList<NameValuePair>(3);
postParameters.add(new BasicNameValuePair(POST_PARAM_DEVICE_ID, deviceId));
postParameters.add(new BasicNameValuePair(POST_PARAM_LANG, lang));
postParameters.add(new BasicNameValuePair(POST_PARAM_LAST_UPDATED, lastUpdated));
httpPost.setEntity(new UrlEncodedFormEntity(postParameters));

// Create new HttpClient and execute HTTP Post Request
HttpClient httpClient = new DefaultHttpClient();
HttpResponse response = httpClient.execute(httpPost);

// Get and parse the response
List<Article> parsedArticles = new ArrayList<Article>();
HttpEntity entity = response.getEntity();
if (entity != null) {
  parsedArticles = Parser.parseArticles(entity.getContent());
}

However even when I put the same parameter values (as those I put in the web form), the response in this case is 204 NO CONTENT and no XML file obviously.

Can somebody here please tell me how come these two methods are not equivalent and the responses are different? Is it something with encoding or what am I missing?

I unfortunately don’t have access to the server and I’m not able to debug Android outgoing and incoming data because Fiddler and my emulator / device connected to PC refused to cooperate.

And I also wondered if I should use AndroidHttpClient instead of DefaultHttpClient but I think it’s not going to change anything in this case.

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T11:50:26+00:00Added an answer on June 17, 2026 at 11:50 am

    Due to Maxims comment I found out what’s wrong.

    It was one stupid lower case letter in the POST_PARAM_DEVICE_ID constant. It’s value was “deviceId” (and should be “deviceID” as in web form).

    Well, my fellow developers, pay attention when defining String keys – it’s case sensitive!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I recently came across a forum post in the android developers group. (link below)
recently i came across strange problem while uploading files to my new server. I
I recently came across this post on Forrst: http://forr.st/~Nbp and thought it'd be a
i recently came across an exciting jquery plugin for image overlays http://jobyj.in/adipoli/ it says
I recently came across a great data structures book, Data Structures Using C (c)
Recently I came across some strange behaviour of my application. It has been developed
I recently came across this website: http://studiostyles.info , which contains a list of color
I recently came across a very very strange, and very bad bug in jQuery
I recently came across a problem with My.Computer.FileSystem.DeleteDirectory() . It will not delete read
I recently came across some weird looking class that had three constructors: class Class

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.