我正在尝试使用 SAP Cloud SDK for JavaScript通过 Cloud Connector 和 SAP Cloud Platform 连接服务访问 S/4HANA on Premise 系统(版本 1.5.0)通过 Cloud Connector 和 SAP Cloud Platform 连接服务访问 S/4HANA on Premise 系统。
详细的,我有
- 云连接器
- 连接服务
- xsuaa 服务实例
- 应用路由器 (app-router)
- 目的地
- 目的地服务
这一切都按预期工作。这些先决条件由不同的教程解释(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 for Java时时,一切都按预期工作,即我可以访问本地系统。我在本地系统上拥有足够的权限。使用基本身份验证。
使用 SAP Cloud SDK JavaScript 检索文档信息记录的示例 GET 请求:
let destination = await useOrFetchDestination({
destinationName: 'MY_DESTINATION',
jwt: 'MY_JWT' });
DocumentInfoRecord.requestBuilder()
.getAll()
.execute(destination);
但是针对本地系统进行测试会使 GET 请求失败,状态码为 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 标头才能使请求成功?
更新:将目标信息添加到代码片段并完成错误消息。
第二次更新:目标配置类似于:
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>