title: Invalid amount of variables values while passing json as request url using resttemplate
body: <p>i am consuming a rest webservice using spring resttemplate class blow is my url which is given by 3rd party application vendor </p>
  
  <pre><code>[http://10.123.84.143:8080/ServiceWebService/updateModelMPData.do?lmgCode=186353&amp;applicationId=8&amp;uuid=9a26038f-6dd1-40b6-b847-f2fd16366fc0&amp;jsonData={No. of Organizations -: 1,No. of officals  -: 20,No. of Ers  -: 5}
  </code></pre>
  
  <p>so according to his requirement i need pass the json values dynamically like i mentioned above 1,20,5 are i am getting from database and i am passing. while i am executing using resttemplate exchange method and along with all the parameters i am passing i am getting the below exception </p>
  
  <p>EXCEPTION ------------------- Invalid amount of variables values in </p>
  
  <pre><code>[http://10.123.84.143:8080/ServiceWebService/updateModelMPData.do?lmgCode=186353&amp;applicationId=8&amp;uuid=9a26038f-6dd1-40b6-b847-f2fd16366fc0&amp;jsonData={No. of Organizations -: 1,No. of officals  -: 20,No. of Ers  -: 5}: expected 1; got 0
  java.lang.IllegalArgumentException: Invalid amount of variables values in [http://10.123.84.143:8080/ServiceWebService/updateModelMPData.do?lmgCode=186353&amp;applicationId=8&amp;uuid=9a26038f-6dd1-40b6-b847-f2fd16366fc0&amp;jsonData={No. of Organizations -: 1,No. of officals  -: 20,No. of Ers  -: 5}: expected 1; got 0
      at org.springframework.web.util.UriTemplate.expand(UriTemplate.java:127)
      at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:400)
      at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:377)
      at com.org.ep.trg.webservice.ModelGPStatusController.GpStatusSubmit(ModelGPStatusController.java:92)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:601)
      at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)
      at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:436)
      at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:424)
      at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
      at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
      at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:669)
      at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:585)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at in.nic.pes.common.interceptor.AUthenticatUserFilter.doFilter(AUthenticatUserFilter.java:23)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at com.org.ep.help.HelpFilter.doFilter(HelpFilter.java:74)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at com.org.ep.interceptor.NoCacheFilter.doFilter(NoCacheFilter.java:37)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
      at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:309)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)
      at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
      at java.lang.Thread.run(Thread.java:722)
  </code></pre>
  
  <p>here my doubt is how to pass json values dynamically in url and which method is the best option to consume a rest service using resttemplate.
  here one more thing is i didn't  see the rest service method implementation method, i only know the url which is i mentioned above 
  thanks for looking my query.</p>
  
  <p>this is my code which is causing the the exception in my controller class</p>
  
  <pre><code>  ResponseEntity&lt;ModelStatusEntity&gt; result = restTemplate.exchange(uri, HttpMethod.POST, null, ModelStatusEntity.class);
  </code></pre>