VMware {code} Community
blackride
Contributor
Contributor

SDK WebService Question

All, When I type in https:///sdk

and you must configure the client appropriately. "

Reply
0 Kudos
9 Replies
blackride
Contributor
Contributor

Ok, now I can get directly to the following

(

http://localhost:8086/SDK/vim.wsdl

http://localhost:8086/SDK/vimService.wsdl

)

wsdl files which return XML but I still can not get to: https://localhost/sdk

Reply
0 Kudos
anykey
Enthusiast
Enthusiast

You can never use a webbrowser to go to https://localhost/sdk as on that address not a html webserver is listening, but the VMware webservice is. The webservice only speaks SOAP (xml) and that is what you with your software have to speak to it.

Reply
0 Kudos
blackride
Contributor
Contributor

This is the code I am using and it just hangs and eventually times out. Is there any way else to confirm that the webservice is actually working? Thanks!

string username = "username";

string password = "pw";

System.Net.ServicePointManager.CertificatePolicy = new CertPolicy();

ManagedObjectReference _svcRef = new ManagedObjectReference();

_svcRef.type = "ServiceInstance";

_svcRef.Value = "ServiceInstance";

VimService _service = new VimService();

_service.Url = "https://servername/sdk";

_service.CookieContainer = new System.Net.CookieContainer();

ServiceContent _sic = service.RetrieveServiceContent(svcRef);

service.Login(sic.sessionManager, username, password, null);;

Reply
0 Kudos
tos2k
Expert
Expert

this is what I am using:

try

{

service.Login(sic.sessionManager, username, password, null);

return true;

}

catch

{

return false;

}

HTH, Tos2k

Message was edited by:

tos2k

Reply
0 Kudos
blackride
Contributor
Contributor

This is what I am gettingL

"Unable to automatically step into the server. Connecting to machine serverxx failed. Remote debugger not running on remote machine....etc etc"

Reply
0 Kudos
tos2k
Expert
Expert

You may run into troubles when running Debug mode against the Virtual Center webservice. Mor details here:

http://geekswithblogs.net/ranganh/archive/2006/01/20/66495.aspx

have fun!

tos2k

Reply
0 Kudos
blackride
Contributor
Contributor

ok, I am getting further now....Could someone take a look at this and let me know what I am doing rong though? It appears I am connecting but it is retruning NULL for the Managed Object. I am a little confused how that works at this point. Thanks again everyone!

static void Main(string[] args)

{

// Ignore SSL Errors

ServicePointManager.CertificatePolicy = new AcceptAllCertificatePolicy();

string username = "username";

string password = "pw";

//System.Net.ServicePointManager.CertificatePolicy = new CertPolicy();

VMSVC.ManagedObjectReference _svcRef = new VMSVC.ManagedObjectReference();

_svcRef.type = "ServiceInstance";

_svcRef.Value = "ServiceInstance";

VMSVC.VimService _service = new VMSVC.VimService();

_service.Url = "https://servername/sdk";

_service.CookieContainer = new System.Net.CookieContainer();

VMSVC.ServiceContent _sic = service.RetrieveServiceContent(svcRef);

try

{

service.Login(sic.sessionManager, username, password, null);

// Call retrieveServiceContent()

VMSVC.ManagedObjectReference ckck = service.FindByDnsName(sic.searchIndex,null,"servername.domain.com",true);

Console.WriteLine("");

}

catch (Exception ee)

{

Console.Write(ee.Message);

Message was edited by:

blackride

Reply
0 Kudos
blackride
Contributor
Contributor

Anyone have any ideas on my problem? Thanks!

Reply
0 Kudos
jrackliffe
Hot Shot
Hot Shot

Can you even get the root managed object?

/mob

Click "content"

Click "searchIndex"

Click "FindByDnsName"

Fill in your dnsName and if it's a VM or Host \[T/F] and hit Invoke

If you get a return in MOB you should geta return in the SDK.

J

Reply
0 Kudos