无法使用适用于JavaScript的SAP Cloud SDK通过Cloud Connector在Premise系统上访问S/4HANA [英] Cannot access S/4HANA on Premise system via Cloud Connector using SAP Cloud SDK for JavaScript

查看:196
本文介绍了无法使用适用于JavaScript的SAP Cloud SDK通过Cloud Connector在Premise系统上访问S/4HANA的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用适用于 JavaScript 的SAP Cloud SDK(版本1.5.0)通过Cloud Connector和SAP Cloud Platform连接服务在Premise系统上访问S/4HANA.

I'm trying to access an S/4HANA on Premise system via the Cloud Connector and SAP Cloud Platform connectivity service using the SAP Cloud SDK for JavaScript (version 1.5.0).

详细,我有

  • 云连接器
  • 连通性服务
  • xsuaa服务实例
  • 应用路由器(应用路由器)
  • 目的地
  • 目的地服务

它们都能按预期工作.这些先决条件由不同的教程( https://blogs.sap.com/2019/04/02/a-do-it-yourself-at-home-guide-how-to-connect-a-node.js-app-on-sap-cloud -platform-for-the-cloud-foundry-to-an-s4hana-premise-system-securely-via-cloud-connector/

which all work as expected. These preconditions are explained by different tutorials (https://blogs.sap.com/2019/04/02/a-do-it-yourself-at-home-guide-how-to-connect-a-node.js-app-on-sap-cloud-platform-for-the-cloud-foundry-to-an-s4hana-on-premise-system-securely-via-cloud-connector/, https://blogs.sap.com/2017/07/13/part-2-how-to-use-the-sap-cloud-platform-connectivity-and-the-cloud-connector-in-the-cloud-foundry-environment/).

使用此设置,我可以轻松访问S/4HANA Cloud系统. 将SAP Cloud SDK用于 Java 时,一切都按预期工作,即,我可以访问内部系统.我对本地系统具有足够的权限.使用基本身份验证.

With this setup I have no difficulties accessing an S/4HANA Cloud system. When using the SAP Cloud SDK for Java everything works as expected, i.e. I can access the on premise system. I have sufficient rights on the on premise system. Basic Authentication is used.

使用SAP Cloud SDK JavaScript检索文档信息记录的GET请求示例:

Example GET request for retrieving document info records using the SAP Cloud SDK JavaScript:

let destination = await useOrFetchDestination({
destinationName: 'MY_DESTINATION',
jwt: 'MY_JWT' });
DocumentInfoRecord.requestBuilder()
.getAll()
.execute(destination);

但是对本地系统进行测试会使GET请求失败,状态码为503:

But testing against an on premise system makes the GET request fail with status code 503:

ERR Error: get request failed!
ERR     at Object.errorWithCause (/path-to-app/node_modules/@sap/cloud-sdk-util/dist/error.js:14:20)
ERR     at specializeError (/path-to-app/@sap/cloud-sdk-core/dist/request-builder/request/odata-request.js:175:32)
ERR     at /path-to-app/@sap/cloud-sdk-core/dist/request-builder/request/odata-request.js:162:58
ERR     at processTicksAndRejections (internal/process/task_queues.js:86:5)
ERR Caused by:
ERR Error: Request failed with status code 503
ERR     at createError (/path-to-app/axios/lib/core/createError.js:16:15)
ERR     at settle (/path-to-app/axios/lib/core/settle.js:17:12)
ERR     at IncomingMessage.handleStreamEnd (/path-to-app/axios/lib/adapters/http.js:237:11)
ERR     at IncomingMessage.emit (events.js:198:15)
ERR     at endReadableNT (_stream_readable.js:1139:12)
ERR     at processTicksAndRejections (internal/process/task_queues.js:81:17)

我可能错过了什么?要使请求成功,是否需要其他HTTP标头?

What might I have missed? Are additional HTTP headers necessary to make the request succeed?

更新:将目标信息添加到代码段并完成了错误消息.

UPDATE: added destination information to the code snippet and completed error message.

第二次更新::目标配置与此类似:

2nd UPDATE: The destination config looks similar to this:

Name: <MY_DESTINATION>
Type: HTTP
URL: http://...    //this matches the cloud connector host, i.e. in SAP Cloud Platform Cockpit --> Cloud Connectors --> Exposed Back-End Systems
ProxyType: OnPremise
Authentication: BasicAuthentication
User: <USERNAME>
Password: <PASSWORD>

推荐答案

经过一番调查,结果发现位置ID 导致了该问题.在目标和云连接器上已将其设置为特定值. 因此,云连接器将仅接受提供此属性的请求.

After some investigation the location ID turned out to cause the problem. It had been set to a specific value on the destination and the cloud connector. Therefore, the cloud connector would only accept requests providing this property.

云连接器的日志中没有错误.但可以远程调试应用程序(遵循这些说明)显示此错误消息:

There were no errors in the cloud connector's logs. But remotely debugging the application (following these instructions) brought up this error message:

没有将SAP Cloud Connector(SCC)连接到您的子帐户.请求为子帐户"SUBACCOUNT_ID"和SCC位置ID(默认值为空字符串或根本未配置)打开隧道.检查SCC和云端的配置.

There is no SAP Cloud Connector (SCC) connected to your subaccount. Requested opening of a tunnel for subaccount "SUBACCOUNT_ID" and SCC location ID, with default value, that is empty string or simply not configured. Check the configuration on SCC and cloud side.

使用SAP Cloud SDK JavaScript中的useOrFetchDestination检索目标信息未返回此属性,这就是为什么从未将其添加到请求中的原因.

Using useOrFetchDestination from the SAP Cloud SDK JavaScript to retrieve destination information did not return this property which is why it had never been added to a request.

当前的解决方法是从目标和云连接器中都删除位置ID.然后请求成功.

The current workaround is to remove the location ID from both the destination and the cloud connector. Then the requests succeed.

是否可以检索目的地的位置ID?

Is there a way to retrieve the location ID of a destination?

更新:可以使用originalProperties属性从目标位置检索位置ID.如果存在,它将保存名为CloudConnectorLocationId的属性.如此处所述,该值可以添加为SAP-Connectivity-SCC-Location_ID请求的标头.

Update: The location ID can be retrieved from the destination using the originalProperties property. If present, it holds the property called CloudConnectorLocationId. As described here this value can be added as SAP-Connectivity-SCC-Location_ID header to the request.

感谢Dennis H的支持.

Thanks Dennis H for your support.

这篇关于无法使用适用于JavaScript的SAP Cloud SDK通过Cloud Connector在Premise系统上访问S/4HANA的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆