【发布时间】:2012-03-16 08:29:33
【问题描述】:
好的,我到处寻找答案。快把我逼疯了。
我需要做的就是解组一个非常简单的 Web 服务响应。唯一的问题是,我使用的是没有@XmlRootElement 注释的生成源文件。我也无法编辑这个生成的源文件来添加@XmlRootElement。我需要“按原样”使用它。
这是我拥有的当前代码,但它会导致本文底部显示错误。我曾尝试使用 JAXBElement 包装器,但无济于事。有人可以给我我需要的代码吗?我不知道如何使用"QName"s 等。
下面的代码非常适用于具有@XmlRootElement 的类:
MyGeneratedClass response = restTemplate.getForObject("url to webservice!"),
MyGeneratedClass.class);
return response
遗憾的是,在这种情况下会产生此错误。请帮我解组 REST 响应!
Could not extract response: no suitable HttpMessageConverter found for response
type [MyGeneratedClass] and content type [application/xml;version=1]
【问题讨论】:
标签: web-services rest jaxb wsdl resttemplate