VMware Cloud Community
lizjohn
Contributor
Contributor

How to programmatically get the custom https port of vcenter server. This port is needed for authetication to vcenter using web service url

Hello

My windows server has a vcenter server installation that does not use default https port (443). The https port is customized to 1443. So I believe I will need to specify 1443 as port in my service url when I need to retrieve my service content.

ManagedObjectReference serviceInstance = new ManagedObjectReference();

serviceInstance.setType("ServiceInstance");

serviceInstance.setValue("ServiceInstance");

serviceUrl = "https://"+vCenterServerAddress+":"+"1443"+"/sdk/vimService";

Map<String, Object> reqContext = ((BindingProvider) _vimPort).getRequestContext();

reqContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, serviceUrl);

reqContext.put(BindingProvider.SESSION_MAINTAIN_PROPERTY, true);

serviceContent = _vimPort.retrieveServiceContent(serviceInstance);

_vimPort.login(serviceContent.getSessionManager(), <user id>, <password>, null);

When I check the registry this port maps to the HttpsProxyPort. Is that the correct key which stores the web service port for a vcenter server.

Is there a way I can programatically get that web service port? I believe cannot use the vsphere api to get that port as the port is needed much before that to construct the service url

Thanks

Elizabeth

0 Kudos
0 Replies