Quantcast
Channel: VMware Communities : All Content - vRealize Operations Manager
Viewing all articles
Browse latest Browse all 5485

How to use vcTokenAuth in vROps adapter?

$
0
0

I’m using vROps Java Client Bindings to create Java client capable of consuming vROps REST API.

My source code to create the client:

 

            Client client = ClientConfig.builder()

                        .serverUrl("https://10.172.181.231/suite-api/")

                        //.vcTokenAuth(token)  

                        .basicAuth("admin", "password")

                        .build()

                        .newClient();

           

     

            ApplicationVersion version = client.apiVersionsClient().getCurrentVersion();

 

It works with basicAuth, which uses vROps user credentials.

 

I would like to switch to vcTokenAuth method, which is very briefly described under /suite-api/docs/java/com/vmware/ops/api/client/Client.ClientConfig.Builder.html#vcTokenAuth(java.lang.String)

Token is acquired with vimPortType.acquireCloneTicket() method from Web Services SDK.

Simply switching to .vcTokenAuth instead of .basicAuth doesn’t work. For token I’m using cloneTicket acquired from vCenter Server.

It generates following warning message and stack trace:

 

478  [main] WARN  org.springframework.web.client.RestTemplate  - GET request for "https://10.172.181.231/suite-api/api/versions/current?_no_links=true" resulted in 500 (Internal Server Error); invoking error handler

Exception in thread "main" com.vmware.ops.api.client.exceptions.ServerException: Internal Server error, cause unknown.

      at com.vmware.ops.api.client.internal.DefaultClient.handleError(DefaultClient.java:262)

      at org.springframework.web.client.RestTemplate.handleResponseError(RestTemplate.java:607)

      at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:565)

      at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:536)

      at org.springframework.web.client.RestTemplate.getForEntity(RestTemplate.java:269)

      at com.vmware.ops.api.client.internal.RestClientProxy.invoke(RestClientProxy.java:149)

      at com.vmware.ops.api.client.internal.DefaultClient$InvocationHandlerWrapper.invoke(DefaultClient.java:228)

      at com.sun.proxy.$Proxy40.getCurrentVersion(Unknown Source)

      at vcTokenAuth.Main.main(Main.java:34)

 

My question is what are the steps to successfully use vcTokenAuth mechanism? Are there any prerequisites that need to be fulfilled before using it? Where do I get the token from, because I’m not entirely sure I’m getting the correct one? The documentation isn’t very precise about that.


Viewing all articles
Browse latest Browse all 5485

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>