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

  • Home
  • SEARCH
  • 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 6685643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:04:50+00:00 2026-05-26T05:04:50+00:00

I am sending a POST request to a Server from my Android Application. The

  • 0

I am sending a POST request to a Server from my Android Application. The Server is developed using Spring Framework. The request is received by the server but the parameter that I was sending is null/empty (shown in the log).

The code used to send POST request is:

DefaultHttpClient hc=new DefaultHttpClient();  
ResponseHandler <String> res=new BasicResponseHandler();  

String postMessage = "json String";

HttpPost postMethod=new HttpPost("http://ip:port/event/eventlogs/logs");  
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(1);    
nameValuePairs.add(new BasicNameValuePair("json", postMessage));

postMethod.setEntity(new UrlEncodedFormEntity(nameValuePairs));    
hc.execute(postMethod,res); 

I have also tried to set HttpParams as follows but it has also failed:

HttpParams params = new BasicHttpParams();
params.setParameter("json", postMessage);
postMethod.setParams(params);

The code on Server side that received this request is:

@RequestMapping(value = "/eventlogs/logs", method = RequestMethod.POST)
public String logs(@ModelAttribute("json") String json) {

    logger.debug("Received POST request:" + json);

    return null;
}

The Logger message that I am logging shows:

Received POST request:

Any ideas what I am missing here ?

  • 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-05-26T05:04:50+00:00Added an answer on May 26, 2026 at 5:04 am

    I have used the RequestParam Annotation and it works for me. Now the code on server is as follows:

    @RequestMapping(value = "/eventlogs/logs", method = RequestMethod.POST)
    public String logs(@RequestParam("json") String json) {
    logger.debug("Received POST request:" + json);
    
        return null;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am sending post request from android to the url using httpclient like this
I am sending POST request from client to the application. On the server side
i will be sending a POST request to login.php on my server from an
I am sending a POST request using HTTPWebRequest from the client to the Cassini
I got some sample code from the net here: http://www.javadb.com/sending-a-post-request-with-parameters-from-a-java-class That works fine. It
I am sending a image from android phone to server which is a servlet
Sending the below request in my phonegapp-ed android app works for GET but not
I'm sending an HTTP POST request from my C++ app to a PHP script
I am sending an image from android phone to the server which hanldes it
In IE 9, when sending an AJAX request to my server using either of

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.