def _get_wsdl_loc(protocol, host_name): """Return default WSDL file location hosted at the server. :param protocol: http or https :param host_name: ESX/VC server host name :return: Default WSDL file location hosted at the server """ return vim_util.get_soap_url(protocol, host_name) + '/vimService.wsdl'
def __init__(self, protocol='https', host='localhost', wsdl_loc=None): """Create communication interfaces for initiating SOAP transactions. :param protocol: http or https :param host: Server IPAddress[:port] or Hostname[:port] """ self._protocol = protocol self._host_name = host if not wsdl_loc: wsdl_loc = Vim._get_wsdl_loc(protocol, host) soap_url = vim_util.get_soap_url(protocol, host) self._client = suds.client.Client(wsdl_loc, location=soap_url, plugins=[VIMMessagePlugin()]) self._service_content = self.RetrieveServiceContent('ServiceInstance')
def __init__(self, vimSession, pbm_wsdl, protocol='https', host='localhost'): """Constructs a PBM client object. :param vimSession: an authenticated api.VMwareAPISession object :param pbm_wsdl: URL path to where pbmService.wsdl file is located. :param protocol: http or https :param host: Server IPAddress[:port] or Hostname[:port] """ self._vimSession = vimSession self._url = vim_util.get_soap_url(protocol, host, 'pbm') # create the pbm client self._client = suds.client.Client(pbm_wsdl, location=self._url) PBMClient._copy_client_cookie(self._vimSession, self._client) # Get the PBM service content si_moref = vim_module.get_moref(SERVICE_INSTANCE, SERVICE_TYPE) self._sc = self._client.service.PbmRetrieveServiceContent(si_moref)