簡體   English   中英

無法獲取訂戶子帳戶SAP Cloud Platform -CF的目的地

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

連接到訂閱服務器時出現錯誤將子帳戶目標連接到本地。 通過連接服務和S4 SDK api從提供商帳戶中的多租戶應用程序中在Cloud Foundry中創建一個系統。 相同的安排可以正常工作,目標連接指向另一個與提供者子帳戶連接的本地系統。

請參考SAP幫助,其中顯示了連接服務具有開箱即用的內置能力: https : //help.sap.com/viewer/cca91383641e40ffbe03bdc78f00f681/Cloud/en-US/9c0bdd0efc8640739c9d2fa5cfe56cbd.html

通過S4 SDK API從提供商子帳戶中運行的提供商SAAS應用程序訪問訂戶子帳戶目標時收到以下錯誤:

完整的堆棧跟蹤:

“ 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()引發異常[請求處理失敗; 嵌套的異常是com.sap.cloud.sdk.cloudplatform.connectivity.exception.DestinationAccessException:com.sap.cloud.sdk.cloudplatform.connectivity.exception.DestinationAccessException:無法獲取訂戶服務實例的目的地:無法獲取訪問令牌的實例目的地服務。 如果您的應用程序在Cloud Foundry上運行,請確保同時綁定到目標服務以及授權和信任管理(xsuaa)服務,並且您已正確保護了您的應用程序或將環境變量“ ALLOW_MOCKED_AUTH_HEADER”設置為true 。 請注意,具有用戶傳播的身份驗證類型(例如主體傳播或OAuth2 SAML承載流)要求您保護應用程序安全,並且在使用“ ALLOW_MOCKED_AUTH_HEADER”環境變量時將不起作用。 例如,如果您的應用程序未在Cloud Foundry上運行,則在部署到本地容器時,請考慮聲明“目的地”環境變量以配置目標。]根本原因“,” stacktrace“:[” com.sap.cloud。 sdk.cloudplatform.security.exception.TokenRequestDeniedException:無法獲取訪問令牌:XSUAA服務拒絕了HTTP狀態為401(未授權)的請求。 請確保將您的應用程序正確綁定到XSUAA服務實例。 請注意,如果您使用的服務計划不適合您的方案,也可能會發生此錯誤。 如果要在Cloud Foundry上構建SaaS應用程序,則在創建XSUAA實例時選擇服務計划“應用程序”。 如果要構建應由其他應用程序使用的重用服務,請選擇服務計划“代理”。“,” 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 .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)“,”達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; 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“

請幫忙。

謝謝,悉達思

    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 >
    }

您是否按照此處所述在應用程序中實現了訂戶回調服務? https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/zh-CN/ff540477f5404e3da2a8ce23dcee602a.html

更為重要的是getDependencies回調(過程步驟2)。 我知道它說是可選的,但是當使用目的地等服務時,這是必需的。 需要這樣,以便在訂閱期間,SaaS Provisioning服務知道配置目標服務以授權訂閱者帳戶。

另外,如果之前未實現:在實現和重新部署應用程序之后,需要重新完成訂閱過程,以使必要的配置生效。

為此,您需要返回目標服務的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;
        }

如果已經完成,請記住再次進行訂閱。

完成后,您可以使用目標服務的訂閱者子域和憑據(客戶端ID和密碼)生成承載。

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

將Bearer令牌傳遞給目標服務API以讀取訂戶帳戶目標。

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM