我有一个类似这样的 CXF Web 服务:
@Service("MyWebService")
public class MyWebService implements IMyWebService {
@Autowired
private IMyService MyService;
public ResponseObject doSomething(RequestObject requestObject) {
ResponseObject responseObject = new ResponseObject;
.
// do something....
.
.
return responseObject;
}
}
需要输入 JSON,这样说:
{ "requestObject" : { "amount" : 12.50, "userName" : "abcd123" } }
并生成如下输出 JSON:
{ "responseObject" : { "success" : "true", "errorCode" : 0 } }
有没有办法配置 CXF,使其接受以下格式的输入 JSON:
{ "amount" : 12.50, "userName" : "abcd123" }
我需要在输入和输出 JSON 中去掉对象类型名称“requestObject”/“responseObject”。这甚至可能吗?
感谢您的帮助!