Results 1 to 3 of 3
  1. #1
    aakhan2021 is offline Member
    Join Date
    Jul 2016
    Posts
    1
    Rep Power
    0

    Default writing body in post throws error

    Hi , am writing a post method in java
    the body of the post is

    Java Code:
    {
        "documentQuery": {
            "ids":
                [
                    "100003",
                    100004
                ]  
        }   
    }
    when i write it in java

    Java Code:
    	StringEntity input = new StringEntity(
    				"{"
    				+"\"documentQuery\": {"
    				+"\"ids\":"
    				+"[\"100003\", "+ sDoc1 +"]"
    				+"}"
    				+"}");
    Looks like something wrong when i give "+ sDoc1 +" and it throws error 404 bad response.
    Last edited by Norm; 07-31-2016 at 08:26 PM. Reason: Changed end code tags to [/code]

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,003
    Rep Power
    33

    Default Re: writing body in post throws error

    There is not enough explanation or code here to know what the problem is.
    How is this a java programming problem and not a server configuration problem?
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    13,541
    Rep Power
    27

    Default Re: writing body in post throws error

    Why is one id a String and the other not?

    Do you know if your POST is reaching the correct bit of the server?
    Have you tried "hand posting" (using something like Postman) the data?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. Throws error array out of bounds when run
    By haritha in forum New To Java
    Replies: 2
    Last Post: 02-02-2016, 09:27 AM
  2. Replies: 2
    Last Post: 07-23-2013, 11:47 PM
  3. Replies: 2
    Last Post: 09-27-2011, 03:59 PM
  4. Included file throws error.
    By killerf2006 in forum New To Java
    Replies: 3
    Last Post: 08-20-2010, 11:18 AM
  5. Replies: 3
    Last Post: 05-04-2009, 03:15 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •