Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accessing virtualbox webservice

I want to access VirtualBox webservice using c#. Firstly I created a service proxy using wsdl.exe and vboxwebService.wsdl file. ' Assuming that VirtualBox webservice is located in: http://localhost:18083/ how can I access it using c#? I am doing something like this:

EndpointAddress endpoint = new EndpointAddress("http://localhost:18083/");
BasicHttpBinding binding = new BasicHttpBinding();
vboxPortTypeClient client = new vboxPortTypeClient(binding,endpoint);

and this works fine (I think):

But how then I then can get for instance version of virtualbox? I don't know how to use the following method:

string test = string.Empty;
client.IVirtualBox_getVersion(test);
like image 618
niao Avatar asked Aug 05 '11 20:08

niao


2 Answers

I've managed to do what I was expecting First of all I generated a new proxy class from two wsdl files

wsdl vboxService.wsdl vboxweb.wsdl

wsdl.exe then generated a proxy class named vboxService

then the following code does what I want:

vboxService service = new vboxService();
string oVirtualBox = service.IWebsessionManager_logon("", "");
service.IVirtualBox_Version(oVirtualBox);

Please note that for simplicity I disabled authentication for now - this is why I pass empty strings to IWebessionManager_logon method

like image 193
niao Avatar answered Sep 24 '22 00:09

niao


To those who ended up here from google with very little knowledge like me, vboxService.wsdl and vboxweb.wsdl are provided with the Virtualbox SDK. Just download it and extract the files, you'll find them under sdk/bindings/webservice.

like image 23
johnildergleidisson Avatar answered Sep 25 '22 00:09

johnildergleidisson