2016-02-13 40 views
0

我想追加我的查詢在我的customerDoaImpl文件中的服務url但它沒有返回正確的值。我試圖在服務端使用soapUI進行測試,但是在那裏它將正確的數據返回給我的請求。春天:其餘的webservice調用

我想基於的productId & datePeriod 這裏搜索結果是我的代碼snippet-

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

服務端控制器 -

@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) 

我在做什麼錯在我的查詢?

+0

確保您正在編碼查詢字符串。 –

回答

0

佔位符{productId}{Dateperiod}實際上必須用實字符串替換,否則它會逐字發送到服務器。例如,使用字符串格式:

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

感謝您的快速回答您的快速回答..讚賞它:) :) – JOGO

+0

如果它回答你的問題,你應該upvote答案並接受它。 – jah