The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

pouncilt (16) [Avatar] Offline
#1
Greetings:

First let me say, in comparison to the first two books, this book is very nicely written.

I am trying to test a Restful WebService that is deployed by a thirdparty. Hence, I do not have the code for the Restful WebService on the server. I do however, have the payload classes of the response body; which in this case is WebServiceValue.class. I read all of Chapter 11; but it really didn't tell me how to wire up my Restful Client.


I am getting the following error:

org.springframework.web.client.RestClientException: Could not extract response: no suitable HttpMessageConverter found for response type [com.mycompany.model.WebServiceValue] and content type [text/xml;charset=UTF-8]
at org.springframework.web.client.HttpMessageConverterExtractor.extractData(HttpMessageConverterExtractor.java:77)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:446)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:409)
at org.springframework.web.client.RestTemplate.getForObject(RestTemplate.java:206)
at com.mycompany.ws.client.OPA_CrossReferenceTest.testCrossReferenceForOPA(OPA_CrossReferenceTest.java:24)




The books says, in section 11.3.2, that "Spring comes a variety of message converters...". I took that to mean that, by default I didn't have to wire up the message converters, if I am using the message converters in the table listing.

So my question is do I have to wire up the MarshallingHttpMessageConverter; as I am using xstream?
pouncilt (16) [Avatar] Offline
#2
Re: Need Help With Spring Restful Client
I figured out that I do, in fact, need to configure the RestTemplate with the MessageConverter; which in turn is configured with a OXM Marshaller.

Thanks.

Tonté