0
次のREST Webサービスを記述しました。Resttemplate Webサービスのcomsumingのレスポンスタイプの問題
ここでRestTemplateを使用してこのWebサービスを使用したいと思っています。しかし、restTemplate.exchange(?)の戻り値の型はどういうものかわかりません。
@RequestMapping(value = "/customercontact/transid/{brokerid}", method = RequestMethod.GET)
public ResponseEntity<HashMap<String, String>> getTransactionIdWithPublicKey(@PathVariable("brokerid") String brokerid){
HashMap<String, String> transactionid = customerService.getTransactionid(brokerid);
if(transactionid != null)
return new ResponseEntity<HashMap<String, String>>(transactionid,HttpStatus.OK);
else
return new ResponseEntity<HashMap<String, String>>(HttpStatus.NOT_FOUND);
}
public void doGet(HttpServletRequest request,
HttpServletResponse response) throws IOException
{
RestTemplate restTemplate = new RestTemplate();
HttpHeaders requestHeaders = new HttpHeaders();
requestHeaders.add("SM_USER", "wbrokere");
MultiValueMap<String, String> body = new LinkedMultiValueMap<String, String>();
HttpEntity<?> httpEntity = new HttpEntity<Object>(body, requestHeaders);
ResponseEntity<String> responseobj = restTemplate.exchange("http://127.0.0.1:24000/webbroker/getusername", HttpMethod.GET, httpEntity,?);
}
ます( "APIを:" するSystem.out.printlnを使用することができます+ responseobj.getBody());結果を見る –
レスポンスを抽出できませんでした:応答タイプ[java.util.HashMap]およびコンテンツタイプ[application/json; charset = UTF-8]でHttpMessageConverterが見つかりません] このエラーが発生しました –
jinal
更新された回答 –