To access a
vSphere
Automation
service, you must have a valid session connection. The sequence for accessing a
vSphere
Automation
service includes creating a protocol connection object and using it to create
the service stub.
Prerequisites
Establish a connection to the
vSphere
Automation
Endpoint URL. For more information about the authentication mechanisms that you
can use, see
Authentication Mechanisms.
Procedure
-
Create a protocol
factory object.
-
Create a protocol
connection object to access an API provider.
The
vSphere
Automation
API clients use
ApiProvider instances
to invoke operations on services running in the virtual environment. To invoke
an operation, you must specify the target service and operation, input
parameters, and execution context.
-
Create a
StubFactory object by
using the
ApiProvider instance.
-
Create a
StubConfiguration
instance and set the security context to be used for the service stub.
-
Create the stub for the
vSphere
Automation
service interface by calling the create method of the
StubFactory instance.
Pass the service class and the
StubConfiguration
instance as arguments.