简体   繁体   English

对于错误“在JSON中找不到错误字段”(VDM:401),我们该怎么办?

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

We try to call the API API_BUSINESS_PARTNER via our Java application. 我们尝试通过我们的Java应用程序调用API API_BUSINESS_PARTNER The Java implementation communicates with a SAPUI5 - Front End application, so that the data can be displayed via an app. Java实现与SAPUI5-前端应用程序通信,因此可以通过应用程序显示数据。 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. 但是通过应用程序,我们得到错误“在JSON中找不到错误字段”,并且ODataConnectivityUtil的SCP-日志向我们显示了相应用户未获得授权。 Accordingly we tried to call an older one MMIM_MATERIAL_DATA_SRV and it works without any problems. 因此,我们尝试调用一个较旧的MMIM_MATERIAL_DATA_SRV ,它可以正常工作。 We get the same error message in API_PRODUCT_SRV . 我们在API_PRODUCT_SRV得到相同的错误消息。 So it doesn't seem to work with the new APIs in general. 因此,它似乎通常不适用于新的API。

Thank you, best regards. 谢谢您最好的问候。

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. 问题是尽管我们在目标配置中设置了“ sap-client = 200”,但第一个元数据请求却在默认客户端(客户端100)上执行。 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. 我们怀疑“较新的” API将无法从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). 我们面临的一个问题是,Cloud SDK无法从目标配置中获取客户端(用于元数据请求)。

The other problem was that the error message "No error field found in JSON" was misleading. 另一个问题是错误消息“在JSON中找不到错误字段”具有误导性。

Only by the tip with "ODataConnectivityUtil", we could see our authentication error. 只有通过“ ODataConnectivityUtil”的技巧,我们才能看到认证错误。 So thanks again. 再次感谢。

Which version of the S/4HANA Cloud SDK are you using? 您正在使用哪个版本的S / 4HANA Cloud SDK? 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/ 可以在这里找到有关发行的详细信息: 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. 提示:我也建议使用我们提供的虚拟数据模型类来调用此类OData服务。 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/ 您可以在此处找到有关此主题的博客文章: https : //blogs.sap.com/2017/05/21/step-4-with-sap-s4hana-cloud-sdk-calling-an-odata-service/

Pls take a look in the S/4HANA OData log which you can find using transaction /iwfnd/error_log (put /n before it). 请看一下S / 4HANA OData日志,您可以使用事务/ iwfnd / error_log(在其之前放入/ n)找到该日志。 Then you execute the OData call to provoke the error. 然后,执行OData调用以引发错误。 If you then find an entry in the OData log, it does mean that the authentication to S/4HANA was succesful. 如果随后在OData日志中找到一个条目,则确实意味着对S / 4HANA的身份验证成功。 Also then you would figure out mor error details. 另外,您还将找出mor错误的详细信息。 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. 在这种情况下,S / 4HANA返回401和一个HTML文档作为响应有效负载。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM