开发者

Boolean return type not working with RestTemplate

开发者 https://www.devze.com 2023-01-21 21:33 出处:网络
I am using Spring 3.0.3 RestTemplate for making RESTfull call to service which is deployed in servicemix ESB. Service method returns boolean value, and am unable to receive this in RestTemplate respon

I am using Spring 3.0.3 RestTemplate for making RESTfull call to service which is deployed in servicemix ESB. Service method returns boolean value, and am unable to receive this in RestTemplate response.

String query = "?userId="+userId;
RestTemplate rest = new RestTemplate();
Map<String, String> params = new HashMap<String, String>();

boolean status = rest.getForObject(SERVICE_URL+query,boolean.class,params);

And am getting below error

WARN : org.springframework.web.client.RestTemplate - GET request for "http://localhost:818 1/cxf/monitoring/logclear?userId=admin" resulted in 406 (Not Acceptable); invoking error handler org.springframework.web.client.HttpClientErrorException: 406 Not Ac开发者_StackOverflow社区ceptable at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultR esponseErrorHandler.java:69) at org.springframework.web.client.RestTemplate.handleResponseError(RestTemplate.java:486)
    at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:443)
    at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:409)
    at org.springframework.web.client.RestTemplate.getForObject(RestTemplate.java:206)

Any help is greatly appreciated. Thank you!

0

精彩评论

暂无评论...
验证码 换一张
取 消