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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:28:46+00:00 2026-05-27T17:28:46+00:00

I trying to send two parameters to some server. the server is responding to

  • 0

I trying to send two parameters to some server.
the server is responding to http-post call and the two parameters are
Int
Some Enum ( that i sending as string )

I want to send the parameters as json:

        StringEntity t = new StringEntity("{ \"intValParam\":-100 , \"enumParam\":\"enumValueAsString\" }" , "UTF-8");

        httppost.setEntity(t);

        httppost.setHeader("content-type", "application/json");

The response that i get is 400 ( bad request )

** There is one more method that i can call that need to have one parameter … only the int – and this method is working good – so this is not problem from the bad connection or something like that.

  • 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-27T17:28:46+00:00Added an answer on May 27, 2026 at 5:28 pm

    You should not try to add your parameters like that. Either use the method setParams from httpPost or use NameValuePair entities and encode them in your request, like that :

    List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2); 
    nameValuePairs.add(new BasicNameValuePair("userid", "12312"));
    nameValuePairs.add(new BasicNameValuePair("sessionid", "234")); 
    httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
    

    code taken here.

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

Sidebar

Related Questions

I trying to make http - post call. The server that i send him
I have two web pages that I am trying to send information between. One
Trying to send some email in my C# app. I am behind a proxy
i'm trying to send fake keyboard input to an application that's running in a
I am trying to send some data from a LINQ query in C# to
I am trying to send an URL-encoded post to a REST API implemented in
I am trying to send emails that will bounce to a known mailbox. I
Im trying to build a simple AJAX script that uses a form to send
I'm trying to take two doubles (GPS coordinates) and send them over the ZigBee
I've Got two Programs (Server / Client) I'm trying to setup IPC for them

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.