asw*_*yak 12 java web-services cxfrs
当我试图返回List时,它已经找到了没有消息体编写器的响应类ArrayList.
我的代码如下:
@POST
@Path("/{scope}/{application}/tables")
@Produces("application/xml")
public List<String> getTableNames(@PathParam("scope") String scope,
@PathParam("application") String application, Request request) {
// For example, I am returning a list of String
return new ArrayList<String>(4);
}
Run Code Online (Sandbox Code Playgroud)
请帮我.提前致谢
Urs*_*pke 19
要返回一个列表,最好将其包装到一个带注释的容器中@XmlRootElement,并将该列表作为一个字段给予该容器,注释为@XmlElement.
像这样:
@XmlRootElement
public class Container {
@XmlElement
public List yourlist;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
46505 次 |
| 最近记录: |