Use the session cookie from the vCenter Server session to establish the Storage Policy session. The session cookie represents the authenticated vCenter Server session, which is based on the SSO token.

The following code fragments establish connections both with the vCenter Server and the Storage Policy Server. These examples are based on the BasicConnection sample, which is located in the Storage Policy SDK connection sample directory.

SDK/spbm/java/JAXWS/samples/com/vmware/spbm/connection/BasicConnection.java

The BasicConnection sample uses an instance of the LoginByTokenSample class. See vCenter LoginByToken Example. The LoginByToken example saves the HTTP cookie produced during the intial connection sequence and then restores the cookie after the vCenter Server connection has been established. Although the LoginByToken example creates a vCenter Server connection, the BasicConnection sample establishes its own connection with the vCenter Server. A different implementation might integrate those capabilities to reduce the number of vCenter Server connections.