[vbox-dev] xsl for generating webservice files

James Lucas jimmy at secsme.org.au
Fri Jan 23 04:34:27 GMT 2009


Now that the webservice xls files have been exported to OSE i've created 
a xls stylesheet to generate a native PHP library to communicate with 
the VBox webservice in a OO way. Is this something that VirtualBox would 
be likely to add to the SDK? If so i'll post the code.

Cheers,
    James

An example of what the code looks like in PHP:

<?php
require_once('./vboxServiceWrappers.php');

//Connect to webservice
$connection = new vboxService("vboxwebService.wsdl");

//Logon to webservice
$session = new IWebsessionManager(null,$connection);
$IVirtualBox_session = $session->logon("username","password");

//Get host details
$host = $IVirtualBox_session->host;
echo 'Host cpus:' . $host->processorCount . ' memory:' . 
$host->memorySize . "MB\n";

//Get version details
$version = $IVirtualBox_session->version;
echo 'Virtual Box Version: ' . $version . "\n";

//Get a list of machines and output simple details
$machines = $IVirtualBox_session->machines2;

foreach($machines as $machine)
{
  $mObjRef = new IManagedObjectRef($machine->getRef(),$connection);
  $if = $mObjRef->getInterfaceName();
  $name = $machine->name;
  $uuid = $machine->id;
  $settings = $machine->settingsFilePath;
  $powerstate = $machine->state;

  echo "machine $if uuid:$uuid name:$name settings:$settings VMstate:" . 
$powerstate->__toString() . "\n";
}

//Remember to close the session
$session->logoff($IVirtualBox_session->getRef());

--
UTS CRICOS Provider Code:  00099F
DISCLAIMER: This email message and any accompanying attachments may contain
confidential information.  If you are not the intended recipient, do not
read, use, disseminate, distribute or copy this message or attachments.  If
you have received this message in error, please notify the sender
immediately and delete this message. Any views expressed in this message
are those of the individual sender, except where the sender expressly, and
with authority, states them to be the views the University of Technology,
Sydney. Before opening any attachments, please check them for viruses and
defects.




More information about the vbox-dev mailing list