简体   繁体   中英

Spring: rest webservice call

I am trying to append my query in the service url in my customerDoaImpl file But it is not returning correct value. I tried to test using soapUI on service side but there it is returning correct data to my request.

I am trying to Search result based on productId & datePeriod Here is my code snippet-

  url.append(getServiceUrl()).append( "/transaction/find/customerrequestv2?id={productId}&dateperiod={Dateperiod}");

Service side Controller-

    @RequestMapping(value = "/find/customerrequestv2", method = RequestMethod.GET,produces = "application/json")

  public List<Customer> CustomerRequestv2(@RequestParam(value = "id") final String pProductId,
  @RequestParam(value = "dateperiod") final String pDateperiod)

What am i doing wrong in my query?

The placeholder {productId} and {Dateperiod} actually have to be substituted with real string, otherwise it'll get send to the server verbatim. For example, use string format:

String url = String.format("/transaction/find/customerrequestv2?id=%s&dateperiod=%s", productId, datePeriod);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM