.NET Example of Retrieving a Service Endpoint on a
vCenter Server
Instance

This example provides a common pattern for filtering Lookup Service registration data. This example is based on the code in the
LookupServiceHelper.cs
sample file.
This example uses the steps that are described in the Retrieve Service Endpoints on vCenter Server Instances procedure.
For a complete and up-to-date version of the sample code, see the vSphere Automation SDK .NET samples at GitHub.
... public LookupServiceRegistrationInfo[] LookupSingleServiceUrl(string prod, string sType, string proto, string eType, string nodeId) { // 1 - Create a filter criterion for service info. var filterServiceType = new LookupServiceRegistrationServiceType(); filterServiceType.product = prod; filterServiceType.type = sType; // 2 - Create a filter criterion for endpoint info. var filterEndpointType = new LookupServiceRegistrationEndpointType(); filterEndpointType.protocol = proto; filterEndpointType.type = eType; // 3 - Create the registration filter object. var filterCriteria = new LookupServiceRegistrationFilter(); filterCriteria.serviceType = filterServiceType; filterCriteria.endpointType = filterEndpointType; filterCriteria.nodeId = nodeId; // 4 - Retrieve specified service info with the List() method. return lsPort.List(serviceRegistration, filterCriteria); }