java - Getting Error 400 The request sent by the client was syntactically incorrect (): Using RestTemplate, Spring -


i have client-server architecture in rest, spring mvc. tghe client hitting server url , sending 2 parameters along it. server supposed reply client responce value. 1 client side using resttemplate access server url. when running, server url getting accessed (server side logic getting executed), getting following error on client side:

http status 400 -   --------------------------------------------------------------------------------  type status report  message   description request sent client syntactically incorrect (). 

the client side code is:

rresult = resttemplate.getforobject("http://localhost:8081/merchant/api/movietheater"+params.tostring(), responsetext.class); 

the esrver side code is:

@responsebody @requestmapping(value="movietheater") public responsetext getcustomerinput(@requestparam("name") string name, @requestparam("price") double price) {     system.out.println("requst url got accessed here");     responsetext result = new responsetext();     transaction transaction = new transaction();     transaction.setmoviename(name);     transaction.setticketprice(price);     transaction.setdatetime(new date());     if(transactionservice.addtransaction(transaction))         result.setmessage(responsestatus.success.getstatus());     else         result.setmessage(responsestatus.failed.getstatus());     return result; }                 

when accessing url separately, working fine. not sure doing wrong. please help! in advance!

i figured out!!! have inner class creating json structure in client side. solution make class static! not static, trying instantiate, , hence, got error message: "could not read json: no suitable constructor found type"


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -