What can we do for the error “No error field found in JSON” (VDM:401)?

随声附和 提交于 2020-01-04 07:51:04

问题


We try to call the API API_BUSINESS_PARTNER via our Java application. The Java implementation communicates with a SAPUI5 - Front End application, so that the data can be displayed via an app. Through our On - Premise System it works without any problems and we also get back data. But via the application we get the error "No error field found in JSON" and the SCP - Log for ODataConnectivityUtil shows us that the respective user is not authorized. Accordingly we tried to call an older one MMIM_MATERIAL_DATA_SRV and it works without any problems. We get the same error message in API_PRODUCT_SRV. So it doesn't seem to work with the new APIs in general.

Thank you, best regards.

  • The error message
  • Our source code
  • Logging snippet

回答1:


Thanks again for the support.

We have solved the problem now. The problem is that the first metadata request is executed on the default client (client 100) although we have set "sap-client=200" in the destination configuration. Our passwords between the clients were different, so we received an authentication error.

We suspect that the "newer" API's will not be able to access the configuration for the destination from the SCP. So it probably worked with the older ones.

One problem for us was that the Cloud SDK does not take the client from the destination configuration (for the metadata request).

The other problem was that the error message "No error field found in JSON" was misleading.

Only by the tip with "ODataConnectivityUtil", we could see our authentication error. So thanks again.




回答2:


Which version of the S/4HANA Cloud SDK are you using? This might be an issue that we had in an older version. Could you update to the latest release version and give it a try again?

Details on releases can be found here: https://sap.github.io/cloud-s4-sdk-examples/release-notes/

Hint: I would also suggest to use our virtual data model classes that we provide for invoking such OData services. You can find a blog post on this topic here: https://blogs.sap.com/2017/05/21/step-4-with-sap-s4hana-cloud-sdk-calling-an-odata-service/




回答3:


Pls take a look in the S/4HANA OData log which you can find using transaction /iwfnd/error_log (put /n before it). Then you execute the OData call to provoke the error. If you then find an entry in the OData log, it does mean that the authentication to S/4HANA was succesful. Also then you would figure out mor error details. In case you do not find any entry, it is very likely that you are not authenticating correctly. In this case S/4HANA returns 401 and an HTML document as response payload.



来源:https://stackoverflow.com/questions/48225150/what-can-we-do-for-the-error-no-error-field-found-in-json-vdm401

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