2015-01-14 29 views
0

我很新与休息WSSoapUi和Rest WS,如何通过JSon?

我尝试创建一个休息WS中,我想通过一些JSON:

{ 
name: "conversation.start", 
datetime: { 
    created: "2014-01-01 00:00:00", 
    sent: "2014-01-01 00:00:01" 
}, 
parameters: { 
    conversation_id: 1, 
    type:   "chat|call|video", 
    operator_id:  1, 
    website_id:  1, 
    group_id:  1, 
    custom_data:  { 
     example:  "value" 
    } 
} 
} 

我的WS:

@POST 
@Consumes("application/json") 
@Path("push") 
public Response push(@RequestParam("CustomData") String text) { 

    .... 

    return null; 
} 

但我不知道什么和如何传递我的Json结构与SoapUI,我的字符串文本总是空或“” 任何想法? THX

回答

0
@POST 
@Consumes("application/json") 
@Path("push") 
public Response push(YourObjectType yourDataOpbect) { 

    .... 

    return null; 
} 

enter image description here

在这里,你必须把你的JSON字符串精确匹配与你的对象。