title: SyntaxError : Json.parse:unexpected end of data GWT
body: <p>I am getting <strong>"Json.parse:unexpected end of data"</strong> in my client side,When i make rest request to my API using GWT.</p>
  
  <p>Client side code :</p>
  
  <pre><code>private void executeUnAccountedTransactionByService(String requestJson)
      {
          String requestData = "request=" + URL.encodeQueryString(requestJson);
  
          RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL.encode(postPaymentUrl));
  
          builder.setHeader("Content-Type","application/x-www-form-urlencoded");
          builder.setHeader("Accept","application/json") ;
          try  {
  
              builder.sendRequest(requestData, new RequestCallback()  {
  
                  @Override
                  public void onResponseReceived(Request request, Response response)  {
  
                      JSONValue jsonValue = JSONParser.parseStrict(response.getText());
                      JSONObject responseObject = jsonValue.isObject();
                      //my logic
                  }
  
                  @Override
                  public void onError(Request request, Throwable exception) {
                  }
              });
          } 
          catch (RequestException e)  {
          }
      }
  </code></pre>
  
  <p>My API Code :</p>
  
  <pre><code>    @RequestMapping(value = "/url",
                      method = RequestMethod.POST)
      public @ResponseBody ResponseEntity&lt;?&gt; processPayment(
                                              @RequestParam("request") String payRequestJson,
                                              HttpServletRequest servletRequest) {
  
          PutUnAccountedTransaction unAccountedTransaction = null ;
          try {
              LOGGER.info("request recieved unaccounted transaction : " +
                      payRequestJson);
               unAccountedTransaction = objectMapper.readValue(payRequestJson, PutUnAccountedTransaction.class) ;
         } catch (Exception e) {
            //currenlty handling success case only.
              return ResponseEntity.ok(unAccountedTransaction);
         }
      return ResponseEntity.ok(unAccountedTransaction);
      }
  </code></pre>
  
  <p>The same API I call in postman with following values:
  HEADERs :</p>
  
  <pre><code>Content-Type : application/x-www-form-urlencoded
  </code></pre>
  
  <p>request : <code>{"applicationIdentiferICC":"jh2b32vy","amount":"100","authCode":"hhbjhbjh","orderNumber":"jhsbhjb","dateTimeInUTC":"03/01/2017 07:20:57","gatewayName":"gatewayname","transactionReference":"asdhgwvg","dealerId":"bhjhahdbj","cardType":"VISA","terminalId":"jjhbjhbhjbj","userReference":"bjhbjh","paymentType":"EMV_CHIP","expMonth":"09","expYear":"19","cardNumber":"1111"}</code></p>
  
  <p>and I am getting expected response back.</p>
  
  <p>I thought the problem is due to "Accept" header .I have tried with "<em>/</em>","application/x-www-form-urlencoded" ,But I am getting same error.</p>
  
  <p>the response I am getting back in postman:</p>
  
  <pre><code>{
    "gatewayName": "credit-call",
    "dealerId": 1278,
    "terminalId": "jjhbjhbhjbj",
    "amount": 100,
    "orderNumber": "jhsbhjb",
    "cardNumber": "9111",
    "cardType": "Disc",
    "dateTimeInUTC": "03/01/2017 07:20:57",
    "paymentType": "EMV_CHIP",
    "authCode": "hhbjhbjh",
    "transactionReference": "asdhgwvg",
    "userReference": "bjhbjh",
    "applicationIdentiferICC": "jh2b32vy",
    "expMonth": 9,
    "expYear": 12,
    "dateTimeInPST": null,
    "inoiceGuid": null,
    "description": null
  }
  </code></pre>
  
  <p>Response heades recieved after inspecting client in browser.</p>
  
  <pre><code>Server: Apache-Coyote/1.1
  X-Application-Context: postpayment:devvm
  Content-Type: application/json;charset=UTF-8
  Transfer-Encoding: chunked
  Date: Wed, 01 Mar 2017 15:28:17 GMT
  </code></pre>
  
  <p>I am using GWT 2.5 version.</p>
  
  <p>I am getting following error :</p>
  
  <pre><code>java.lang.IllegalArgumentException: empty argument
      at com.google.gwt.json.client.JSONParser.parse(JSONParser.java:210)
      at com.google.gwt.json.client.JSONParser.parseStrict(JSONParser.java:87)
  </code></pre>
  
  <p>at line</p>
  
  <pre><code> JSONValue jsonValue = JSONParser.parseStrict(response.getText())
  </code></pre>