简体   繁体   English

无法获取订户子帐户SAP Cloud Platform -CF的目的地

[英]Failed to get destinations of subscriber sub account SAP Cloud platform -CF

Getting Error Connecting to Subscriber Sub account destination connected to on-prem. 连接到订阅服务器时出现错误将子帐户目标连接到本地。 system in cloud foundry from multitenant application from provider account via connectivity service and S4 SDK api . 通过连接服务和S4 SDK api从提供商帐户中的多租户应用程序中在Cloud Foundry中创建一个系统。 Same arrangement is working fine with the destination connection pointing to another on-premise system connected with provider subaccount . 相同的安排可以正常工作,目标连接指向另一个与提供者子帐户连接的本地系统。

Referring the SAP help which shows that connectivity service has this inbuilt capabality out of the box: https://help.sap.com/viewer/cca91383641e40ffbe03bdc78f00f681/Cloud/en-US/9c0bdd0efc8640739c9d2fa5cfe56cbd.html 请参考SAP帮助,其中显示了连接服务具有开箱即用的内置能力: https : //help.sap.com/viewer/cca91383641e40ffbe03bdc78f00f681/Cloud/en-US/9c0bdd0efc8640739c9d2fa5cfe56cbd.html

getting following error when accessing Subscriber subaccount destination from Provider SAAS Application running in Provider Subaccount via S4 SDK API: 通过S4 SDK API从提供商子帐户中运行的提供商SAAS应用程序访问订户子帐户目标时收到以下错误:

Complete Stack Trace : 完整的堆栈跟踪:

"2019-04-09T11:25:03.714+0000 [APP/PROC/WEB/0] OUT { "written_at":"2019-04-09T11:25:03.708Z","written_ts":2225588987993569,"component_type":"application","component_id":"212c1a7d-c897-4834-8f7c-6e2a3d6bfed3","space_name":"Sandbox","component_name":"connectivity","component_instance":"0","organization_id":"-","correlation_id":"-","organization_name":"-","space_id":"f057513a-85e3-4229-b42f-f0fe7a058fa6","container_id":"10.0.75.11","type":"log","logger":"org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/].[dispatcherServlet]","thread":"http-nio-8080-exec-6","level":"ERROR","categories":[],"msg":"Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; “ 2019-04-09T11:25:03.714 + 0000 [APP / PROC / WEB / 0] OUT {” write_at“:” 2019-04-09T11:25:03.708Z“,” write_ts“:2225588987993569,” component_type“: “ application”,“ component_id”:“ 212c1a7d-c897-4834-8f7c-6e2a3d6bfed3”,“ space_name”:“沙盒”,“ component_name”:“连接性”,“ component_instance”:“ 0”,“ organization_id”:“- “,” correlation_id“:”-“,” organization_name“:”-“,” space_id“:” f057513a-85e3-4229-b42f-f0fe7a058fa6“,” container_id“:” 10.0.75.11“,” type“:” log “,” logger“:” org.apache.catalina.core.ContainerBase。[Tomcat]。[localhost]。[/]。[dispatcherServlet]“,” thread“:” http-nio-8080-exec-6“, “级别”:“ ERROR”,“类别”:[],“ msg”:“路径为[]的上下文中Servlet [dispatcherServlet]的Servlet.service()引发异常[请求处理失败; nested exception is com.sap.cloud.sdk.cloudplatform.connectivity.exception.DestinationAccessException: com.sap.cloud.sdk.cloudplatform.connectivity.exception.DestinationAccessException: Failed to get destinations of subscriber service instance: Failed to get access token for destination service. 嵌套的异常是com.sap.cloud.sdk.cloudplatform.connectivity.exception.DestinationAccessException:com.sap.cloud.sdk.cloudplatform.connectivity.exception.DestinationAccessException:无法获取订户服务实例的目的地:无法获取访问令牌的实例目的地服务。 If your application is running on Cloud Foundry, make sure to have a binding to both the destination service and the authorization and trust management (xsuaa) service, AND that you either properly secured your application or have set the "ALLOW_MOCKED_AUTH_HEADER" environment variable to true. 如果您的应用程序在Cloud Foundry上运行,请确保同时绑定到目标服务以及授权和信任管理(xsuaa)服务,并且您已正确保护了您的应用程序或将环境变量“ ALLOW_MOCKED_AUTH_HEADER”设置为true 。 Please note that authentication types with user propagation, for example, principal propagation or the OAuth2 SAML Bearer flow, require that you secure your application and will not work when using the "ALLOW_MOCKED_AUTH_HEADER" environment variable. 请注意,具有用户传播的身份验证类型(例如主体传播或OAuth2 SAML承载流)要求您保护应用程序安全,并且在使用“ ALLOW_MOCKED_AUTH_HEADER”环境变量时将不起作用。 If your application is not running on Cloud Foundry, for example, when deploying to a local container, consider declaring the "destinations" environment variable to configure destinations.] with root cause","stacktrace":["com.sap.cloud.sdk.cloudplatform.security.exception.TokenRequestDeniedException: Unable to get access token: XSUAA service denied request with HTTP status 401 (Unauthorized). 例如,如果您的应用程序未在Cloud Foundry上运行,则在部署到本地容器时,请考虑声明“目的地”环境变量以配置目标。]根本原因“,” stacktrace“:[” com.sap.cloud。 sdk.cloudplatform.security.exception.TokenRequestDeniedException:无法获取访问令牌:XSUAA服务拒绝了HTTP状态为401(未授权)的请求。 Please make sure to correctly bind your application to a XSUAA service instance. 请确保将您的应用程序正确绑定到XSUAA服务实例。 Note that this error may also occur if you are using a service plan that is not suitable for your scenario. 请注意,如果您使用的服务计划不适合您的方案,也可能会发生此错误。 If you are building a SaaS application on Cloud Foundry, select service plan "application" when creating your XSUAA instance. 如果要在Cloud Foundry上构建SaaS应用程序,则在创建XSUAA实例时选择服务计划“应用程序”。 If you are building a reuse service that should be consumed by other applications, select service plan "broker".","tat com.sap.cloud.sdk.cloudplatform.connectivity.TokenRequest.executeTokenRequest(TokenRequest.java:128)","tat com.sap.cloud.sdk.cloudplatform.connectivity.TokenRequest.requestTokenWithClientCredentialsGrant(TokenRequest.java:385)","tat com.sap.cloud.sdk.cloudplatform.connectivity.XsuaaService.requestAccessToken(XsuaaService.java:156)","tat com.sap.cloud.sdk.cloudplatform.connectivity.XsuaaService.getServiceToken(XsuaaService.java:216)","tat com.sap.cloud.sdk.cloudplatform.connectivity.DestinationServiceCommand.getAccessToken(DestinationServiceCommand.java:111)","tat com.sap.cloud.sdk.cloudplatform.connectivity.DestinationServiceCommand.run(DestinationServiceCommand.java:124)","tat com.sap.cloud.sdk.cloudplatform.connectivity.DestinationServiceCommand.run(DestinationServiceCommand.java:28)","tat com.netflix.hystrix.HystrixCommand$2.call(HystrixCommand.java:302)","tat com.n 如果要构建应由其他应用程序使用的重用服务,请选择服务计划“代理”。“,” tat com.sap.cloud.sdk.cloudplatform.connectivity.TokenRequest.executeTokenRequest(TokenRequest.java:128)“ “ tat com.sap.cloud.sdk.cloudplatform.connectivity.TokenRequest.requestTokenWithClientCredentialsGrant(TokenRequest.java:385)”,“ tat com.sap.cloud.sdk.cloudplatform.connectivity.XsuaaService.requestAccessToken(XsuaaService.java:156) “,” tat com.sap.cloud.sdk.cloudplatform.connectivity.XsuaaService.getServiceToken(XsuaaService.java:216)“,” tat com.sap.cloud.sdk.cloudplatform.connectivity.DestinationServiceCommand.getAccessToken(DestinationServiceCommand.java: 111)“,” tat com.sap.cloud.sdk.cloudplatform.connectivity.DestinationServiceCommand.run(DestinationServiceCommand.java:124)“,” tat com.sap.cloud.sdk.cloudplatform.connectivity.DestinationServiceCommand.run(DestinationServiceCommand。 java:28)“,” tat com.netflix.hystrix.HystrixCommand $ 2.call(HystrixCommand.java:302)“,” tat com.n etflix.hystrix.HystrixCommand$2.call(HystrixCommand.java:298)","tat rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:46)","tat rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35)","tat rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)","tat rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)","tat rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)","tat rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)","tat rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)","tat rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)","tat rx.Observable.unsafeSubscribe(Observable.java:10327)","tat rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:51)","tat rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35)","tat rx.Observable.unsafeSubscribe(Observable.java:10327)","tat rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach etflix.hystrix.HystrixCommand $ 2.call(HystrixCommand.java:298)“,” tat rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:46)“,” tat rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer .java:35)“,” tat rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)“,” tat rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)“,” tat rx .internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)“,” tat rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)“,” tat rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift .java:48)“,” tat rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)“,” tat rx.Observable.unsafeSubscribe(Observable.java:10327)“,” tat rx.internal.operators .OnSubscribeDefer.call(OnSubscribeDefer.java:51)“,” tat rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35)“,” tat rx.Observable.unsafeSubscribe(Observable.java:10327)“,” tat rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach .java:41)","tat rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:30)","tat rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)","tat rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)","tat rx.Observable.unsafeSubscribe(Observable.java:10327)","tat rx.internal.operators.OperatorSubscribeOn$SubscribeOnSubscriber.call(OperatorSubscribeOn.java:100)","tat com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction$1.call(HystrixContexSchedulerAction.java:56)","tat com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction$1.call(HystrixContexSchedulerAction.java:47)","tat com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction.call(HystrixContexSchedulerAction.java:69)","tat rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55)","tat java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)","tat java.util.concurrent.FutureTask.run(FutureTask.java:266)","tat java.util.conc .java:41)“,” tat rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:30)“,” tat rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)“,” tat rx .internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)“,” tat rx.Observable.unsafeSubscribe(Observable.java:10327)“,” tat rx.internal.operators.OperatorSubscribeOn $ SubscribeOnSubscriber.call(OperatorSubscribeOn.java :100)“,” tat com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction $ 1.call(HystrixContexSchedulerAction.java:56)“,” tat com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction $ 1.call(yy :47)“,” tat com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction.call(HystrixContexSchedulerAction.java:69)“,” tat rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55)“,” tat java.util.concurrent.Executors $ RunnableAdapter.call(Executors.java:511)“,” tat java.util.concurrent.FutureTask.run(FutureTask.java:266)“,” tat java.util.conc urrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)","tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)","tat java.lang.Thread.run(Thread.java:836)"] } 2019-04-09T11:25:03.754+0000 [RTR/5] OUT connectivity-test.cfapps.eu10.hana.ondemand.com - [2019-04-09T11:25:01.668+0000] "GET /odata/UserDetails HTTP/1.1" 500 0 1257 "https://.authentication.eu10.hana.ondemand.com/login" "Mozilla/5.0 (Windows NT 6.1; urrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)“,”达java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:624)“,”达java.lang.Thread.run(Thread.java: 836)“]} 2019-04-09T11:25:03.754 + 0000 [RTR / 5] OUT Connectivity-test.cfapps.eu10.hana.ondemand.com-[2019-04-09T11:25:01.668 + 0000]” GET / odata / UserDetails HTTP / 1.1“ 500 0 1257” https://.authentication.eu10.hana.ondemand.com/login“” Mozilla / 5.0(Windows NT 6.1; Win64; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36" "-" "10.0.75.11:61046" x_forwarded_for:"-" x_forwarded_proto:"https" vcap_request_id:"eab68130-bfff-4cf2-733c-da051adfb1db" response_time:2.085981657 app_id:"212c1a7d-c897-4834-8f7c-6e2a3d6bfed3" app_index:"0" x_correlationid:"8e2d22b0-b4c7-4d20-5461-600aea37b2d2" x_b3_traceid:"7c4752638ec93577" x_b3_spanid:"7c4752638ec93577" x_b3_parentspanid:"-" b3:"7c4752638ec93577-7c4752638ec93577" x64)AppleWebKit / 537.36(KHTML,例如Gecko)Chrome / 73.0.3683.86 Safari / 537.36“”-“” 10.0.75.11:61046“ x_forwarded_for:”-“ x_forwarded_proto:” https“ vcap_request_id:” eab68130-bfff-4cf2-733c -da051adfb1db “response_time:2.085981657 APP_ID: ”212c1a7d-c897-4834-8f7c-6e2a3d6bfed3“ app_index: ”0“ x_correlationid: ”8e2d22b0-b4c7-4d20-5461-600aea37b2d2“ x_b3_traceid: ”7c4752638ec93577“ x_b3_spanid: ”7c4752638ec93577“ x_b3_parentspanid:” -“ b3:” 7c4752638ec93577-7c4752638ec93577“

Please help. 请帮忙。

Thanks, Siddharth 谢谢,悉达思

    if (TenantAccessor.getCurrentTenant().getTenantId().equals("<Subscriber tenet id>"))
            {
                final ErpConfigContext configContext = new ErpConfigContext("TEST_dest");

    else

    {
     < call provider destination using the above code with the destination belonging to Provider account >
    }

Have you implemented the subscriber callback services in your application as described here? 您是否按照此处所述在应用程序中实现了订户回调服务? https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/ff540477f5404e3da2a8ce23dcee602a.html https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/zh-CN/ff540477f5404e3da2a8ce23dcee602a.html

The more important one is the getDependencies callback (Procedure step 2). 更为重要的是getDependencies回调(过程步骤2)。 I know it says optional, but when using services like destination it is necessary. 我知道它说是可选的,但是当使用目的地等服务时,这是必需的。 It's needed so that during subscription, the SaaS Provisioning service knows to configure the destination service to authorize the subscriber account. 需要这样,以便在订阅期间,SaaS Provisioning服务知道配置目标服务以授权订阅者帐户。

Also, if this was not implemented before: After implementing and re-deploying the application, the subscription process needs to be re-done for the necessary configuration to take effect. 另外,如果之前未实现:在实现和重新部署应用程序之后,需要重新完成订阅过程,以使必要的配置生效。

To achieve this, you need to return the xsappname of your destination service as dependency in getDependecies callback(like below) 为此,您需要返回目标服务的xsappname作为getDependecies回调中的依赖项(如下所示)

@GetMapping(value = "/callback/v1.0/dependencies")
        public List<DependantServiceDto> callbackGet() {
            String logMessage = "callback service successfully called with RequestMethod = GET for tenant ";
            //logger.info(logMessage);
            List<DependantServiceDto> dependenciesList = new ArrayList<>();
            JSONObject vcap;
            String destinationXsAppName = "";
            try {
                vcap = new JSONObject(System.getenv("VCAP_SERVICES"));
                JSONArray arr = vcap.getJSONArray("destination");
                JSONObject credentials = arr.getJSONObject(0).getJSONObject("credentials");
                destinationXsAppName = credentials.getString("xsappname");
                if(!destinationXsAppName.isEmpty()){
                    dependenciesList.add(new DependantServiceDto(destinationXsAppName));
                }
            } catch (JSONException e) {
                e.printStackTrace();
            }

            return dependenciesList;
        }

Remember to do the subscription again if you have already done. 如果已经完成,请记住再次进行订阅。

Once you are done, you can generate the Bearer taken using subscriber subdomain and credentials(client id and secret) from the destination service. 完成后,您可以使用目标服务的订阅者子域和凭据(客户端ID和密码)生成承载。

https://subacriber-subdomain.authentication.sap.hana.ondemand.com/oauth/token?grant_type=client_credentials&response_type=token https://subacriber-subdomain.authentication.sap.hana.ondemand.com/oauth/token?grant_type=client_credentials&response_type=token

Pass the Bearer token to destination service API to read the subscriber account destinations. 将Bearer令牌传递给目标服务API以读取订户帐户目标。

https://destination-configuration.cfapps.sap.hana.ondemand.com/destination-configuration/v1/destinations/destinationName https://destination-configuration.cfapps.sap.hana.ondemand.com/destination-configuration/v1/destinations/destinationName

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

相关问题 在Java EE中为SAP Cloud Platform使用目标 - Using destinations in Java EE for SAP Cloud Platform 无法获取提供者服务实例的目的地 - Failed to get destinations of provider service instance 谷歌云平台中的发布/订阅 - pub/sub in google cloud platform 使用多租户 SAP Cloud Platform 应用程序时出错 - Error while working with Multi Tenant SAP Cloud Platform application 将 SAP Cloud Platform 连接到 Office 365 API 时对等方未通过身份验证的异常 - Peer not authenticated exception when connecting SAP Cloud Platform to Office 365 API SAP Cloud SDK - 访问身份验证令牌目标错误:无法读取身份验证令牌 - SAP Cloud SDK - Accessing Auth Token Destination Error: Failed to read authentication token Google Cloud Platform pub / sub Publisher,如何提供默认应用程序凭据以外的凭据 - Google Cloud Platform pub/sub Publisher, how to supply credentials other than default application credentials Hazelcast Pub-Sub,订阅者未收到消息 - Hazelcast Pub-Sub, subscriber not receiving messages SAP Cloud Foundry中的远程调试 - Remote Debugging in SAP Cloud Foundry 在欢乐定制webservice中获取目的地响应 - Get destinations response within mirth custom webservice
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM