Java Example of Retrieving a vSphere Automation Endpoint on a vCenter Server Instance

This example is based on the in the LookupServiceHelper.java sample file.

Note: For a complete and up-to-date version of the Java sample code, see the vsphere-automation-sdk-java VMware repository at GitHub.
...

//1 - Determine management node ID.
String targetNodeId = getMgmtNodeId(targetNodeFqdn);

//2 - List filtered registration info.
List<LookupServiceRegistrationInfo> results =
                  lookupSingleServiceUrl(“com.vmware.cis”,
                                         “cs.vapi”,
                                         “vapi.json.https.public”,
                                         “com.vmware.vapi.endpoint”,
                                         targetNodeId);

//3 - Extract endpoint URL from registration info.
LookupServiceRegistrationInfo registrationInfo = results.get(0);
LookupServiceRegistrationEndpoint serviceEndpoint = registrationInfo.getServiceEndpoints().get(0);
String ssoUrl = serviceEndpoint.getUrl();

...