milestonexprotectwspython.xpwserviceregistrationservice
Module: xpwserviceregistrationservice.py
Revision History
Date | Version | Description |
---|---|---|
2023/07/11 | 1.0.0.0 | Initial Version. |
@export
class
XPWServiceRegistrationServiceThe Service Registration SOAP web service provides access to a dictionary of services available in a given installation.
It can be used to retrieve all installed services and their URLs. When multiple services of the same type are installed, it can be used as a round-robin access for load sharing.
The service also enables you to register your own services and thus make them available for lookup by other components in your integration or by other integrations wanting to utilize your service.
XPWServiceRegistrationService( loginInfo: milestonexprotectwspython.xpwlogininfo.XPWLoginInfo = None)
Initializes a new instance of the class.
Arguments:
- loginInfo (XPWLoginInfo): Login Information class that contains login token information. This class is returned
on a successful call to any of the LoginX methods from classes that inherit from
XPWWebServiceBase. This allows you to share the same Login Information (token, etc)
between service classes.
Specify null / None to not share Login Information; if doing so, then your first call must be to one of the Login methods (e.g. LoginBasicUser, LoginWindowsUser, etc).
Default is null / None.
Raises:
- XPWException: The method fails for any reason.
Retrieves a list of services available in a given installation.
Returns:
A collection of XPWService objects that contain available service details.
Raises:
- XPWWebServiceException: The XProtect Web-Services Server returned a failed response.
- XPWException: The method fails for any other reason.
Sample Code
# package imports.
from milestonexprotectwspython.xpwcollection import XPWCollection
from milestonexprotectwspython.xpwlogininfo import XPWLoginInfo
from milestonexprotectwspython.xpwservice import XPWService
from milestonexprotectwspython.xpwserviceregistrationservice import XPWServiceRegistrationService
# create service instance and set server prefixes for our environment.
svc:XPWServiceRegistrationService = XPWServiceRegistrationService()
svc.ManagementServerUrlPrefix = "https://mymanagementserver.example.com"
svc.IsSslVerifyEnabled = False
# authenticate using xprotect basic auth credentials.
loginInfo:XPWLoginInfo = svc.LoginBasicUser("xpsampleadmin", "MyPassword&1")
print("** Login Details:\n{0}\n".format(loginInfo))
# get services info.
items:XPWCollection = svc.GetServices()
print("** Services Summary:\n{0}\n".format(items))