Model Derivative API responses not mapping through Jackson

随声附和 提交于 2019-12-04 05:22:29

问题


Have there been updates made to the response objects from the Model Derivative API as we are having issues mapping the responses from requests for 3D models back into the Manifest and Metadata objects.

Both are throwing Jackson errors.

  1. GetManifest is returning an unhandled role enum
  2. GetMetadataForGuid is throwing - Illegal character ((CTRL-CHAR, code 31))

Thanks


回答1:


I got what's wrong with the issue. The response of Get Manifest endpoint did changed a bit recently. There will a property database node aside the geometry nodes for Revit generated manifest. So one new role is 'Autodesk.CloudPlatform.PropertyDatabase'. While the old JAVA object ManifestChildren.JAVA does not declare the role. which caused the failure.

To fix it, you can simply add the new role in ManifestChildren.JAVA e.g.

i have requested a commit for JAVA SDK. you could modify it directly at your side if you merge the SDK source code to your project.

Hope this helps.




回答2:


This is to answer the second question as references for all.

The problem is due to the header is set to "gzip" format when calling GET :urn/metadata/:guid. If it is not "gzip", all work well. While with other ways such as Postman, the header with gzip can also work.

In the past, when clients used gzip header, actually it doesn't trigger a gzip encoding. So everything is fine. After the release recently, the content returns the content in gzip if gzip is specified, while the SDK doesn't handle it correctly. Postman unzips the gzip to json automatically, so it looks working.

So, the fix could be adding one line in the ApiClient.java at line 115: client.addFilter(new GZIPContentEncodingFilter(false));

I also forked the source github repository in my space with the fixes on the two problems. a pull request is commit to the main repo. that is to allow the response of API call can handle gzip content and unzip it. https://github.com/xiaodongliang/forge-api-java-client

We apologize for the two issues that have affected some projects using SDK.



来源:https://stackoverflow.com/questions/47573466/model-derivative-api-responses-not-mapping-through-jackson

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!