Unable to perform a data collection on a vCloud Air OnDemand endpoint with vRealize Automation

Posted by

I recently signed up for the newly released vCloud Air OnDemand service and wanted to provision VMs to it using vRealize Automation (vRA).  I followed the instructions found on page 13 of the IaaS Configuration for vCloud Air and vCloud Director guide, but  the instructions didn’t match what I was seeing as there was no “vCloud Director API URL” link to select.  https://brianragazzi.wordpress.com/2014/08/21/adding-a-vcloud-air-endpoint-to-vcloud-automation-center/ shows what the doc describes.  I filed a service request with VMware and they said that vRA endpoints only works with vCloud Air subscription based plans and not the OnDemand plan.  They also said that the OnDemand plan should be compatible with vRA endpoints in the upcoming months.

When I performed a data collection on the vRA vCloud Air endpoint, it would fail with the error:

Workflow ‘vCloudEndpointDataCollection’ failed with the following exception: There is an error in XML document (1, 2).


They also said that they were having issues with the API that may have been what was preventing me from working through the instructions at Log In and Receive Access Token.  I’ll go ahead and post what I performed even though it didn’t work.  Maybe once the issue with the API gets resolved it will work or maybe it’s not related and I can update this post in the future.

The first thing we need to convert your login credentials into a Base64 encoded string.  The login credentials will be in the form of user@domain:password.  If you’re on a Linux system, you can convert this into a Base64 string by running:

$ echo ‘username@example.com:password’ | base64

You can also go to https://www.base64encode.org/ to perform the encoding.

Now we need to make a call to the login URL at https://iam.vchs.vmware.com/api/iam/login:

curl -I -H 'Accept: application/xml;version=5.7' \
        -H 'Content-Type: application/xml;version=5.7' \
        -H 'Authorization: Basic dXNlcm5hbWVAZXhhbXBsZS5jb206cGFzc3dvcmQK' \
        -X POST https://iam.vchs.vmware.com/api/iam/login

Make sure to use the -I parameter or you won’t be able to see the authorization token that is sent back.  You should get something back like this:

HTTP/1.1 201 Created
Date: Thu, 22 Jan 2015 02:42:10 GMT
Server: Apache-Coyote/1.1
vchs-authorization: eyJhbGciOiJSU……NU8FTtGIlMln5Q
Content-Type: application/xml; version=5.7
Content-Length: 165
Set-Cookie: ROUTEID=.186; path=/; Domain=.vmware.com
Connection: close

The long string after vchs-authorization is our token.  Let’s go ahead and assign it to a variable since it’s so long and you need to send it in each subsequent request.

$ token=’eyJhbGciOiJSU……NU8FTtGIlMln5Q’

Now we will follow the example and list out our current service plans:

curl -I -H 'Accept: application/xml;version=5.7' \
        -H "Authorization: Bearer $token" \

Note that now we have a new header with our token.  I received the following response:

HTTP/1.1 302 Found
Date: Thu, 22 Jan 2015 03:37:45 GMT
Server: Apache/2.2.15 (CentOS)
Location: https://us-california-1-3.vchs.vmware.com/api/sc/plans
Connection: close
Content-Type: text/html; charset=iso-8859-1

302 is a temporary redirect and is redirecting to https://us-california-1-3.vchs.vmware.com/api/sc/plans.  So I changed my request to:

curl -I -H 'Accept: application/xml;version=5.7' \
        -H "Authorization: Bearer $token" \

and received:

HTTP/1.1 405 Method Not Allowed
Date: Thu, 22 Jan 2015 03:44:22 GMT
Server: Apache-Coyote/1.1
X-TraceId: 04abda8b-1821-441c-8dd6-77d2159a9e98-54bd7a33-15413
X-TraceUrl: /insight/services/traces/04abda8b-1821-441c-8dd6-77d2159a9e98-54bd7a33-15413?type=json
X-insight-endpoint-name: default
X-insight-application-name: localhost|ROOT
X-insight-server-name: 04abda8b-1821-441c-8dd6-77d2159a9e98
X-insight-source: HTTP
Content-Type: text/plain;charset=UTF-8
Content-Length: 66
Via: 1.1 us-california-1-3.vchs.vmware.com
Vary: Accept-Encoding

Here is where I stopped as I didn’t want to put more effort into it if the API service is having issues.  This is the first time I’ve looked at the vCloud Air API so maybe I’m missing something.  I’ll update this post when I have a solution or if someone knows the solution, please leave it in the comments.  Thanks.


  1. Hi Chris,

    I’m facing the same error. With a Gen 1 VPC it works fine but with a Gen 2 (OnDemand) VPC it fails with the same error. I tried something similar to you around the API but I didn’t success.

    Did you get how to fix the error?


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s