VirtualBox

Opened 8 years ago

Closed 8 years ago

#15033 closed defect (invalid)

SDK class IVirtualBox_createMachine_Dec requiring id and forceOverwrite

Reported by: Alberto Geniola Owned by:
Component: webservices Version: VirtualBox 5.0.12
Keywords: sdk CreateMachine vboxwebsrv Cc:
Guest type: other Host type: Windows

Description

Hi everyone,

After spending some time configuring the SDK to use the webservice binding, I've discovered a problem into the VirtualBox_services_types.py file. According to the official documentation of SDK (http://download.virtualbox.org/virtualbox/SDKRef.pdf), the method IVirtualBox::createMachine has the following signature:

IMachine IVirtualBox::createMachine(
[in] wstring settingsFile,
[in] wstring name,
[in] wstring groups[],
[in] wstring osTypeId,
[in] wstring flags)

However, looking at sdk/bindings/webservice/python/lib/VirtualBox_types.py, at lines 1951 and 1952, we observe the following:

            TClist = [
                ZSI.TC.String(pname="_this", aname="__this", minOccurs=1, maxOccurs=1, nillable=False, typed=False, encoded=kw.get("encoded")),
                ZSI.TC.String(pname="settingsFile", aname="_settingsFile", minOccurs=1, maxOccurs=1, nillable=False, typed=False, encoded=kw.get("encoded")),
                ZSI.TC.String(pname="name", aname="_name", minOccurs=1, maxOccurs=1, nillable=False, typed=False, encoded=kw.get("encoded")),
                ZSI.TC.String(pname="osTypeId", aname="_osTypeId", minOccurs=1, maxOccurs=1, nillable=False, typed=False, encoded=kw.get("encoded")),
                ZSI.TC.String(pname="id", aname="_id", minOccurs=1, maxOccurs=1, nillable=False, typed=False, encoded=kw.get("encoded")),
                ZSI.TC.Boolean(pname="forceOverwrite", aname="_forceOverwrite", minOccurs=1, maxOccurs=1, nillable=False, typed=False, encoded=kw.get("encoded"))]

As you can see, the last two quoted instructions are inconsistent. They require the SOAP request to be built with two old parameters (_forceOverwrite and _id) not being set from the caller. This causes the following exceptions:

Traceback (most recent call last):
  File "C:\Program Files (x86)\JetBrains\PyCharm 4.0.5\helpers\pydev\pydevd.py", line 2217, in <module>
    globals = debugger.run(setup['file'], None, None)
  File "C:\Program Files (x86)\JetBrains\PyCharm 4.0.5\helpers\pydev\pydevd.py", line 1643, in run
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "C:/Users/Webking/Dropbox/HostController1.1/testvbox.py", line 7, in <module>
    vbox.create()
  File "C:/Users/Webking/Dropbox/HostController1.1\managers\machine_manager.py", line 111, in create
    _arg_flags='forceOverwrite=0')
  File "C:\Python27\lib\site-packages\vboxapi\VirtualBox_wrappers.py", line 1070, in createMachine
    val=self.mgr.getPort().IVirtualBox_createMachine(req)
  File "C:\Python27\lib\site-packages\vboxapi\VirtualBox_client.py", line 789, in IVirtualBox_createMachine
    self.binding.Send(None, None, request, soapaction="", **kw)
  File "build\bdist.win32\egg\ZSI\client.py", line 224, in Send
  File "build\bdist.win32\egg\ZSI\writer.py", line 117, in serialize
  File "build\bdist.win32\egg\ZSI\TC.py", line 605, in serialize
  File "build\bdist.win32\egg\ZSI\TCcompound.py", line 273, in serialize
  File "build\bdist.win32\egg\ZSI\TCcompound.py", line 435, in cb
ZSI.EvaluateException: Got None for nillable(False), minOccurs(1) element (None,id), <ns1:IVirtualBox_createMachine xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ZSI="http://www.zolera.com/schemas/ZSI/" xmlns:ns1="http://www.virtualbox.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><_this>67c825f80534f203-0000000000000001</_this><settingsFile></settingsFile><name>def76309-2492-42f5-a8d1-b990b56d8d3d</name><osTypeId>Windows7</osTypeId></ns1:IVirtualBox_createMachine>
[Element trace: /SOAP-ENV:Body]

Simply commenting out those two lines solves the problem.

Change History (2)

comment:1 by Alberto Geniola, 8 years ago

I found the problem.

The SDK bundle available as download from Virtualbox website contains correct definitions of wsdl but python libs have not been update.

To fix it, just execute the following code from cmd:

> wsdl2py -b --file vboxweb.wsdl
> wsdl2py -b --file vboxwebService.wsdl

then copy the two generated python files (VirtualBox_services.py and VirtualBox_services_types.py) into the libs folder of your python installation (mine is C:\Python27\Lib\site-packages\vboxapi).

This fixes this problem on windows.

I encourage Oracle to update the SDK bundle to fix this annoying problem.

comment:2 by Klaus Espenlaub, 8 years ago

Resolution: invalid
Status: newclosed

Something doesn't add up. Looks to me like you are somehow using an outdated SDK install in python (which corresponds to the API version 4.1!), trying to make it talk to the current API. What you describe is a manual way to correct this by overwriting some outdated files. Neither the SDK nor the VirtualBox base package itself can possibly contain the outdated files, they must be from somewhere else.

Note: See TracTickets for help on using tickets.

© 2023 Oracle
ContactPrivacy policyTerms of Use