on 2022 May 13 7:30 AM
Hi all,
we are developing a CAP Java multitenant application and have some problems with consuming dependent services: the destination service, the connectivity service and the html5-apps-repo service.
In Node.js the dependencies are coming on the fly:

In my CAP Java application I just get the root dependency for XSUAA:

In the documentation I saw that I need to react to the GET_DEPENDENY_EVENT
import com.sap.cloud.mt.subscription.json.ApplicationDependency;
@Value("${vcap.services.<my-service-instance>.credentials.xsappname}")
private String xsappname;
@On(event = MtSubscriptionService.EVENT_GET_DEPENDENCIES)
public void onGetDependencies(MtGetDependenciesEventContext context) {
ApplicationDependency dependency = new ApplicationDependency();
dependency.xsappname = xsappname;
List<ApplicationDependency> dependencies = new ArrayList<>();
dependencies.add(dependency);
context.setResult(dependencies);
}
When I do this, the subscription fails with the error:

There is only a value set for the xsappname and all the other attributes like appId and appName are null. In the code above I just set value for xsappname but I dont know how to pass the other attributes because the methods are deprecated:

So what is the correct way to fetch the dependencies?
Best regrads and many thanks,
Chris
Request clarification before answering.
Hi,
"capmt-datatrainhubtest-datatrain" doesn't look like a valid xsappname. Where did you get that from?
The xsappname that you need to return in the dependencies is the XSUAA OAuth2 Client of your service instance. In case of a destination service binding you can find the correct value in the "xsappname" property of the credentials.
Best regards,
Marc
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 18 | |
| 7 | |
| 6 | |
| 6 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.