0
Illegal character in query at index 127: http://192.168.1.7:8080/service-0.0.1-SNAPSHOT/report/genReport/generateReport?reportname=REPORT&doctype=PDF&param={"StartDate":"20140604","EndDate":"20140630","Range":"10"}

can any one help me to get out of this error

Shiva
  • 1
  • 3

2 Answers2

0

You should urlencode the JSON

{"StartDate":"20140604","EndDate":"20140630","Range":"10"}

to

%7B%22StartDate%22%3A%2220140604%22%2C%22EndDate%22%3A%2220140630%22%2C%22Range%22%3A%2210%22%7D    

The URL will then be

http://192.168.1.7:8080/service-0.0.1-SNAPSHOT/report/genReport/generateReport?reportname=REPORT&doctype=PDF&param=%7B%22StartDate%22%3A%2220140604%22%2C%22EndDate%22%3A%2220140630%22%2C%22Range%22%3A%2210%22%7D
  • i can't hard code the json string, it's a json string – Shiva Aug 07 '14 at 10:45
  • You don't have to hard code anythin. Just have the code that generates this URL encode the JSON into a save format. That's what URL encoding ist for. –  Aug 07 '14 at 10:46
  • Look [here](http://stackoverflow.com/questions/10786042/java-url-encoding) how to do url encoding. – Jens Aug 07 '14 at 11:00
-2

You are trying to send a JSON object via your Get Request.

You should try POST method.

For HTTP Client & Post Method, Check this link

gprathour
  • 14,813
  • 5
  • 66
  • 90