Closed gpinkham closed 11 years ago
for the record I converted my code to use the RestTemplate directly.. even using that produces a request with the wrong accepts header and results in a 406..
def accepts = new ArrayList()
accepts.add(MediaType.APPLICATION_XML)
headers.setAccept(accepts)
headers.setContentType(MediaType.APPLICATION_XML)
def rest = new RestTemplate()
rest.setRequestFactory(new SimpleClientHttpRequestFactory(connectTimeout:10000, readTimeout:20000))
def responseEntity = rest.exchange("${baseUrl}/rest/v1/fooxml",
HttpMethod.POST,
new HttpEntity(XMLDATA, headers),
String, [:])
def resp = new RestResponse(responseEntity: responseEntity)
debug message:
DEBUG client.RestTemplate - Setting request Accept header to [text/plain, application/json, */*]
looks like I'll have to go old school.. wish I could sneak some ruby into this project. ha!
adding in an accept all (/) fixed the issue.. apparently the debug message must be wrong.. as it still says the same thing despite the request now working.. I will close this as it looks like an issue in the RestTemplate and not the plugin.. thanks
Thanks for the solution, it really helped
using the restbuilder like this:
results in the following debug line:
so in turn I get a 406 from the Rest Service..