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 8941723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:22:15+00:00 2026-06-15T11:22:15+00:00

When I run this code, I get the response in httpResponse. It’s reporting the

  • 0

When I run this code, I get the response in httpResponse. It’s reporting the correct number of bytes in the header. But the body is empty. when I call .getBody() it’s null.

Header:

<200 OK,{Date=[Thu, 29 Nov 2012 16:26:06 GMT], Server=[Apache], Vary=[Accept-Encoding], Content-Length=[5072], Keep-Alive=[timeout=10, max=100], Connection=[Keep-Alive], Content-Type=[text/html]}>

What am I doing wrong?

    String url = new String("http://www.myurl.com/scripts/json/v1/slipmanager.php");

    MultiValueMap<String, Object> formData = new LinkedMultiValueMap<String, Object>();
    formData.add("username", userName);
    formData.add("password", md5(userPassword));
    formData.add("method", "getslips");

    RestTemplate template = new RestTemplate(true);
    template.setRequestFactory(new HttpComponentsClientHttpRequestFactory());
    HttpHeaders requestHeaders = new HttpHeaders();

    requestHeaders.setContentType(new MediaType("multipart", "form-data"));
    template.getMessageConverters().add(new StringHttpMessageConverter());

    HttpEntity<MultiValueMap<String, Object>> request = new HttpEntity<MultiValueMap<String, Object>>(formData, requestHeaders);
    ResponseEntity<?> httpResponse = null;
    try
    {
        httpResponse = template.exchange(url, HttpMethod.POST, request, null);
        String tmp = (String) httpResponse.getBody();
                    //THIS IS WHERE THE BODY IS NULL
    }
    catch (Exception e) 
    {
        Log.e("POST", e.getMessage(), e);
    }
  • 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-15T11:22:15+00:00Added an answer on June 15, 2026 at 11:22 am

    You asked for a response type “null” so Spring thinks you want to discard the body. If you wanted it to be a String, String.class should work. You don’t even need the explicit StringHttpMessageConverter as far as I know.

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

Sidebar

Related Questions

This Java code compiles fine, but when I try to run it I get:
When I run this C code: // Get rid of the CRT and stuff;
When I try to run this code, I get incorrect maximums and minimums. Could
When I run this code to call the Google API, all I get is
If I run this code on IE8 or lower, I get this error: Object
I run this piece of code on Visual C++ 2010 char c[10]; cin.get(&c[0],5); cin.get(&c[2],4);
I have this code and I couldn't run it because i get this error:
I get this error when I run the code below. I have normally used
I have the below code but for some reason I cannot get the correct
I wrote code to make get request on Android, but I error like this:

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.