无法获取元数据:无法执行OData元数据请求

时间:2018-10-09 10:11:43

标签: s4sdk

我正在尝试从S4hana云中读取数据。 我在身份验证类型为 OAuth2SAMLBearerAssertion 的Cloud Foundry中配置了目标。

我还编写了一个小servlet,以使用VDM机制获取数据。

但是,当我呼叫端点时,我却遇到了错误

 Caused by: com.sap.cloud.sdk.cloudplatform.connectivity.TokenRequestFailedException: Failed to get access token: no valid JWT bearer found in "Authorization" header of request.
   2018-10-09T15:34:52.84+0530 [APP/PROC/WEB/0] OUT     at com.sap.cloud.sdk.cloudplatform.connectivity.TokenRequest.getCurrentJwt(TokenRequest.java:308)
   2018-10-09T15:34:52.84+0530 [APP/PROC/WEB/0] OUT     at com.sap.cloud.sdk.cloudplatform.connectivity.TokenRequest.requestTokenWithUserTokenGrant(TokenRequest.java:352)
   2018-10-09T15:34:52.84+0530 [APP/PROC/WEB/0] OUT     at com.sap.cloud.sdk.cloudplatform.connectivity.XsuaaService.requestAccessToken(XsuaaService.java:135)
   2018-10-09T15:34:52.84+0530 [APP/PROC/WEB/0] OUT     at com.sap.cloud.sdk.cloudplatform.connectivity.XsuaaService.getServiceToken(XsuaaService.java:197)
   2018-10-09T15:34:52.84+0530 [APP/PROC/WEB/0] OUT     at com.sap.cloud.sdk.cloudplatform.connectivity.DestinationServiceCommand.getAccessToken(DestinationServiceCommand.java:109)
   2018-10-09T15:34:52.84+0530 [APP/PROC/WEB/0] OUT     ... 31 common frames omitted

我关注了https://blogs.sap.com/2018/02/05/deep-dive-8-with-sap-s4hana-cloud-sdk-leverage-principal-propagation-via-oauth-2-when-consuming-a-business-api-from-s4hana-cloud/

1 个答案:

答案 0 :(得分:7)

您是否设置了安全性/已配置了approuter?

错误消息表明请求中缺少JWT。

另请参阅:https://blogs.sap.com/2017/07/18/step-7-with-sap-s4hana-cloud-sdk-secure-your-application-on-sap-cloud-platform-cloudfoundry/