使用IBM MobileFirst 8.0平台,我正在探索从其他Java适配器端点调用Java适配器端点的选项。
IBM在这里解释的示例非常简单,对于GET方法来说很好。简化如下:
String otherAdapterUrlendPoint = "/otherAdapter/endpoint?param="+param;
HttpUriRequest req = new HttpGet(otherAdapterUrlendPoint);
HttpResponse response = adaptersAPI.executeAdapterRequest(req);
这里的问题是POST方法(或PUT或DELETE)会发生什么?我没有找到任何文档,也没有示例。我想可能是这样的:
HttpPost httpPost = new HttpPost(otherAdapterUrlendPoint);
...
<<do something with httpPost object>>
...
HttpUriRequest req = httpPost;
HttpResponse response = adaptersAPI.executeAdapterRequest(req);
但是我不知道如何将json主体添加到这个请求中。。。(关于标题,我想我可以使用方法
);
有人能帮我解决这个疑问吗?我敢肯定这不是IBM MobileFirst主题,而是Java主题。。。
提前谢谢!