3

我正在使用 Apache-CXF 创建 REST Web 服务并尝试对数据库中的名称进行操作。

服务器:这是我的方法,预计获取json数据。

@PUT
@Path("/name/")
@Consumes("multipart/mixed")
@Produces("application/json")   
public NameTO updateName(@Multipart (value = "accountIdentifier", 
type =  "application/json")AccountIdentifier accountIdentifier, 
@Multipart (value = "name", type = "application/json")NameTO nameTO)
{
//      do business logic over here
    return nameTO;
} 

客户端:我正在使用 firefox REST 插件提交请求:使用 REST 客户端,我发布了以下 json 作为请求正文:

{{  "accountIdentifier": {"accountNo":"12345","division":"10","portfolio":"OT","channel": "MB"}} ,
{"name": { "firstName" : "Test", "middleInitial" : "R", "lastName" : "Test123", "suffix" : "Mr", "fullName" : "Test Test123"}}}

我在 Rest Client 中设置了以下内容类型:

内容类型:多部分/混合

我得到以下异常:

2012-12-10 14:23:54 WebApplicationExceptionMapper.java:toResponse [WARN] javax.ws.rs.WebApplicationException: org.apache.cxf.interceptor.Fault: 无法从消息中确定边界!

任何我可以将 Json Request 有效负载中的多个对象传递给 Rest Service 并且在服务端完成的更改的示例示例都会有所帮助。

4

0 回答 0