Page 1 of 1

VirtualBox API 7 web service backwards compatibility

Posted: 31. Jan 2023, 04:31
by rami
Hi.

When I compare vboxweb.wsdl between VirtualBoxSDK-6.1.42-155177 and VirtualBoxSDK-7.0.6-155176, I noticed some enum values have changed which seem like there would be some backwards compatibility issues.

For example, the MachineState enum has a new value: AbortedSaved.

However, it was not added to the end of the enum list (or explicitly set to a higher value than the previous/existing values).

So for example, when generating C# client code:

VirtualBox 6.1.42:

Code: Select all

    public enum MachineState
    {
        Null, // 0
        PoweredOff, // 1
        Saved, // 2
        Teleported, // 3
        Aborted, // 4
        Running, // 5
        Paused, // 6
        ...
    }

VirtualBox 7.0.6:

Code: Select all

    public enum MachineState
    {
        Null, // 0
        PoweredOff, // 1
        Saved, // 2
        Teleported, // 3
        Aborted, // 4
        AbortedSaved, // 5  <-- the new value
        Running, // 6 <-- this has changed
        Paused, // 7 <-- this has changed
        ...
    }
So the enum values of the old wsdl do not seem to be compatible with the enum values of the new wsdl.

This makes it harder to manage development environments with either VirtualBox 6.1.42 or 7.0.6 installed.

For example, if we have an older branch which uses the VirtualBox 6.1.42 SDK, and the new branch uses VirtualBox 7.0.6 SDK, it doesn't seem like we can work in both branches with VirtualBox 7 is installed.
Instead, it seems if we need to work with the older branch, we need to have VirtualBox 6 installed, and if we want to work with the newer branch, we need to have VirtualBox 7 installed.
Is that the expected behavior?

Any advice?

Thank you.

Re: VirtualBox API 7 web service backwards compatibility

Posted: 31. Jan 2023, 10:06
by noteirak
Hello Rami,
rami wrote: So the enum values of the old wsdl do not seem to be compatible with the enum values of the new wsdl.
That's correct, they are not. That's why those changes only happen in a new major release.
rami wrote: It seems if we need to work with the older branch, we need to have VirtualBox 6 installed, and if we want to work with the newer branch, we need to have VirtualBox 7 installed.
Is that the expected behavior?
Yes and that reflects on the system: it is not possible to have two different major versions of VirtualBox installed on one host.
rami wrote: Any advice?
My level is C# is very low so I can't give you a definitive answer but since C# is strongly aligned with Java, you may want to explore the equivalent area of Java's ClassLoaders.
For my Hyperbox project, I had to do exactly that: have different major versions of the SDK bundled in a single app. Using custom ClassLoader for each allowed to co-exist in the same runtime.
Another mechanism (if present in C#) would be to load a module/class on-demand and then eject it from memory. This is also usually done with some custom ClassLoader.

I don't know if this will solve it for you, or if it is possible to do something similar, but the limitation is intended, yes.

Re: VirtualBox API 7 web service backwards compatibility

Posted: 6. Feb 2023, 23:50
by EdLudwig
@noteirak, where I can I download your latest release of Hyperbox? None of the links in your posts work, and after doing some googling a round, I did find some pages on your site that work, but mostly even those links lead to nothing.

Re: VirtualBox API 7 web service backwards compatibility

Posted: 7. Feb 2023, 02:07
by scottgus1
EdLudwig wrote:where I can I download your latest release of Hyperbox?
Seems that going through Noteirak's signature link to the Github page, then to the Releases link, gets to downloadable files.

Re: VirtualBox API 7 web service backwards compatibility

Posted: 7. Feb 2023, 09:20
by noteirak
All the repos are here: https://github.com/hyperbox/ but I wouldn't start deep diving in the code, there are an aweful lot Java-specific things including left over from when I tried to use the XPCOM lib instead of WebService.

But have you tried to simply auto-detect what is installed locally and then calling the WS library? It is what I do in the rewrite I started and is much easier to deal with.
See https://github.com/hyperbox/server/blob ... .java#L139