Python Example of Connecting to the Lookup Service and Retrieving a Service Registration Object

The example is based on the code from the
lookup_service_helper.py
sample file.
This example uses the steps that are described in the Connect to the Lookup Service and Retrieve the Service Registration Object procedure.
For a complete and up-to-date version of the sample code, see the vSphere Automation SDK Python samples at GitHub.
... # 1 - Create SOAP client object to communicate with the Lookup Service. my_ls_stub = Client(url=wsdl_url, location=ls_url) # 2 - Configure service & port type for client transaction. my_ls_stub.set_options(service='LsService', port='LsPort') # 3 - Manufacture a managed object reference. managed_object_ref = \ my_ls_stub.factory.create('ns0:ManagedObjectReference') managed_object_ref._type = 'LookupServiceInstance' managed_object_ref.value = 'ServiceInstance' # 4 - Retrieve the ServiceContent object. ls_service_content = \ my_ls_stub.service.RetrieveServiceContent(managed_object_ref) # 5 - Retrieve the service registration object. service_registration = ls_service_content.serviceRegistration