我使用 apache olingo 2.0 作为客户端来访问 ODATA 服务。我能够成功获取特定实体的元数据。我能够使用
EntityProvider.readFeed(contentType,
entityContainer.getEntitySet(entitySetName),
content,
EntityProviderReadProperties.init().build());
当我尝试编写条目时弹出问题
ODataResponse response = EntityProvider.writeEntry(contentType, entitySet, data, properties);
这里 contentType= Application\Json
entitySet = Entity set retrieved from EDM (metadata)
data = data is map Map<String,object> with added property name and value.
使用此 api 创建条目时 ODataResponse response = EntityProvider.writeEntry(contentType, entitySet, data, properties);
当我使用打印内容时,我也收到错误 400 - Bad Request
Object entity = response.getEntity();
if (entity instanceof InputStream) {
byte[] buffer = streamToArray((InputStream) entity);
// just for logging
String content = new String(buffer);
print(httpMethod + " request on uri '" + absolutUri + "' with content:\n " + content + "\n");
I do see that input object is not formed correctly and I am unable to understand why since it is handle by olingo jars.
我在地点遵循相同的客户教程
https://olingo.apache.org/doc/odata2/tutorials/OlingoV2BasicClientSample.html
我修改了这个客户端以调用成功因素 ERP 上存在的 ODATA 服务。我只是使用教程中的客户端代码并修改为调用成功因素 ERP 上存在的 ODATA 服务。