VMware {code} Community
Stone_Wu
Contributor
Contributor

Login Issue - The given header was not found

Hi I'm new to .net sdk vCloud, i'm trying to create a webservice to connect to vCloud via API.

I downloaded code example on GitHub - rdbwebster/vcdapisamples: Vmware VCD .Net C# API examples

 

Tried a very simple code below :

 

vCloudClient client = new vCloudClient("{param1}", com.vmware.vcloud.sdk.constants.Version.V5_5);

client.Login({param2}, {param3});

 

The data that i put it into above parameters are as per https://dl.dropboxusercontent.com/u/20066282/vCloud%20Q%26A.png

After i run the code it got me error "The given header was not found".

I'm not sure if the code are suppose to put in "Accept" in header with value as "application/*+xml;version=1.5" to make sure i can login

or the parameter that i put in are wrong, please help !!

 

The detail of my exception message are :

{com.vmware.vcloud.sdk.utility.VCloudRuntimeException: The given header was not found. ---> System.InvalidOperationException: The given header was not found.

   at System.Net.Http.Headers.HttpHeaders.GetValues(String name)

   at com.vmware.vcloud.sdk.utility.RestUtil.Login(vCloudClient client, String url, HttpRequestHeaders authHeader)

   --- End of inner exception stack trace ---

   at com.vmware.vcloud.sdk.vCloudClient.Login(String userName, String password)

   at Com.Vmware.Vcloud.Sdk.Samples.ListAllvApps.Main(String[] args) in d:\Downloads\Binary\VMware-vCloudDirector-.NetSDK-5.5.0\Samples\ListAllvApps\ListAllvApps.cs:line 90}

Reply
0 Kudos
2 Replies
mkazimir
Contributor
Contributor

the accept header needs to be application/*+xml;version=5.6 or application/*+xml;version=5.7

probably that is the reason why you cannot login.


Cheers,

Milos

Reply
0 Kudos
Stone_Wu
Contributor
Contributor

hi Milos,

Do u know how do i includes accept header on vCloudClient object in my C# code above? Please advice

Thanks,Stone

Reply
0 Kudos