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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:51:33+00:00 2026-05-22T17:51:33+00:00

SO I post this json to this restful web service and the post is

  • 0

SO I post this json to this restful web service and the post is successful (http code:200) however I get back as a response the original Json object that posted. Is this a regular behavior ?

InputStream in = null;
    int resCode;
    String text;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);




     // POST request to <service>/SaveVehicle
        HttpPost request = new HttpPost("http://origin.staging.scion.com/PE/service/rest/getit");
        //request.setHeader("Accept", "application/json");
        request.setHeader("Content-type", "application/json");
        request.setHeader("user-agent", "Yoda");
        try {
        // Build JSON string
        JSONStringer vehicle = new JSONStringer()
            .object()
                .key("getItInputTO")
                    .object()
                        .key("zipCode").value("90505")
                        .key("financingOption").value("B")
                        .key("make").value("Scion")
                        .key("baseAmountFinanced").value("12000")
                        .key("modelYear").value("2010")
                        .key("trimCode").value("6221")
                        .key("totalMSRP").value("15000")
                        .key("aprRate").value("")
                    .endObject()
                .endObject();

        StringEntity entity = new StringEntity(vehicle.toString());


        request.setEntity(entity);

        // Send request to WCF service
        DefaultHttpClient httpClient = new DefaultHttpClient();
        HttpResponse response = httpClient.execute(request); 
        resCode = response.getStatusLine().getStatusCode();
        Toast.makeText(getApplicationContext(),response.getStatusLine().getStatusCode()+"", Toast.LENGTH_LONG).show();   

        if (resCode == 200) {

            Toast.makeText(getApplicationContext(),response.getStatusLine().getStatusCode()+"", Toast.LENGTH_LONG).show();   
            BufferedReader in = 
                new BufferedReader(new InputStreamReader(entity.getContent()));
            String line="";
            StringBuffer returnFromServer = new StringBuffer();

            while ((line=in.readLine())!=null) 
            {
                returnFromServer.append(line);
            }
            //Toast what we got from server
            Toast.makeText(getApplicationContext(),returnFromServer.toString(), Toast.LENGTH_LONG).show();   


            if (entity != null) 
            {
                entity.consumeContent();
            }

        }  
        }catch (Exception e) {
            // TODO: handle exception
        }  

any Ideas are more than welcomed.

  • 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-22T17:51:34+00:00Added an answer on May 22, 2026 at 5:51 pm

    What you are reading in your BufferedReader is the entity of the original request:

    BufferedReader in = new BufferedReader(new InputStreamReader(entity.getContent()));
    

    The above line is the offender. You want to read in the entity from the response, like this:

    BufferedReader in = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to contact a RESTful WCF POST web service from an android client
I am configuring a RESTful web service via Spring, with various representations, including JSON.
I have a RESTful web service that returns JSON-serialized data. It can successfully serialize
$.post($(this).attr(action), $(this).serialize(), function(json) { alert('red'); AddItemAjax(json); }, json); This works in Chrome but not
I am using a RESTfull webservice with this methode: @POST @Consumes({application/json}) @Path(create/) public void
I am trying to make a post request to my restful WCF service. The
I am wanting to expose a restful web service for posting and retrieving data,
I'm developing a RESTful web service with WCF and C#. The service works fine,
I am developing RESTful API for my application. All getters (that use HTTP GET)
I have a RESTful WCF service with a method declared like this: [OperationContract(Name =

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.