Download Oracle VM VirtualBox Programming Guide and
Transcript
Contents 1 Introduction 1.1 Modularity: the building blocks of VirtualBox . . . . . . . . . . . . . 1.2 Two guises of the same “Main API”: the web service or COM/XPCOM 1.3 About web services in general . . . . . . . . . . . . . . . . . . . . . . 1.4 Running the web service . . . . . . . . . . . . . . . . . . . . . . . . . 1.4.1 Command line options of vboxwebsrv . . . . . . . . . . . . . 1.4.2 Authenticating at web service logon . . . . . . . . . . . . . . 1.4.3 Solaris host: starting the web service via SMF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 13 14 15 16 16 17 17 2 The object-oriented web service (OOWS) 2.1 The object-oriented web service for JAX-WS . . . . . . . . . . . . 2.1.1 Preparations . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.2 Getting started: running the sample code . . . . . . . . . 2.1.3 Logging on to the web service . . . . . . . . . . . . . . . 2.1.4 Obtaining basic machine information. Reading attributes 2.1.5 Changing machine settings. Sessions . . . . . . . . . . . 2.1.6 Starting machines . . . . . . . . . . . . . . . . . . . . . . 2.1.7 Object management . . . . . . . . . . . . . . . . . . . . . 2.2 The object-oriented web service for Python . . . . . . . . . . . . . 2.3 The object-oriented web service for PHP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 18 18 18 19 19 20 20 21 21 22 3 Using the raw web service with any language 3.1 Raw web service example for Java with Axis . . . . . . 3.2 Raw web service example for Perl . . . . . . . . . . . . 3.3 Programming considerations for the raw web service . 3.3.1 Fundamental conventions . . . . . . . . . . . 3.3.2 Example: A typical web service client session . 3.3.3 Managed object references . . . . . . . . . . . 3.3.4 Some more detail about web service operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 23 24 24 24 25 26 27 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Using the Main API documentation to write web service clients 5 The VirtualBox COM/XPCOM API 5.1 Python COM API . . . . . . . . . . . . . . . . . . . . . . . . 5.2 Common Python bindings layer . . . . . . . . . . . . . . . . 5.3 C++ COM API . . . . . . . . . . . . . . . . . . . . . . . . . 5.4 Event queue processing . . . . . . . . . . . . . . . . . . . . . 5.5 Visual Basic and Visual Basic Script (VBS) on Windows hosts 5.6 C binding to XPCOM API . . . . . . . . . . . . . . . . . . . . 5.6.1 Getting started . . . . . . . . . . . . . . . . . . . . . 5.6.2 XPCOM initialization . . . . . . . . . . . . . . . . . 5.6.3 XPCOM method invocation . . . . . . . . . . . . . . 5.6.4 XPCOM attribute access . . . . . . . . . . . . . . . . 5.6.5 String handling . . . . . . . . . . . . . . . . . . . . 5.6.6 XPCOM uninitialization . . . . . . . . . . . . . . . . 5.6.7 Compiling and linking . . . . . . . . . . . . . . . . 2 29 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 30 30 31 32 33 33 33 34 34 35 35 36 36