I want to send POST request to server. I have to pass JSON object as a parameter, and get JSON as a response, but I am getting this error:
org.springframework.web.client.RestClientException: Could not extract response: no suitable HttpMessageConverter found for response type [com.package.Response] and content type [application/octet-stream]
Code
Sending request:
@RestService
RestClient restClient;
...
String json = "{\"param\":3}";
restClient.getRestTemplate().getMessageConverters().add(new GsonHttpMessageConverter());
Response res = restClient.send(json);
RestClient
@Rest("http://my-url.com")
public interface RestClient
{
@Post("/something/")
Response send(String json);
RestTemplate getRestTemplate();
void setRestTemplate(RestTemplate restTemplate);
}
I'm using these JAR files:
- spring-android-rest-template-1.0.0.RC1
- spring-android-core-1.0.0.RC1
- spring-android-auth-1.0.0.RC1
- gson-2.2.2
What I'm doing wrong?
When I change send
parameter to JSONObject
I am getting the same error.
Btw. AA docs are really enigmatic - can I use Gson anyway?
Or should I use Jackson?
Which file do I need to include then?
Thanks for any help!