Error while catching machine poweroff event via webservice

Discussion about using the VirtualBox API, Tutorials, Samples.

Error while catching machine poweroff event via webservice

Postby Ch00k » 10. Oct 2013, 17:21

I am trying to catch the event of machine's poweroff (when I select Close -> Power Off in the menu). Instead of the actual event i get an error from the webservice: "(SOAP-ENV:Client) VirtualBox error: (0x800706BE)". The steps I take are the following:
1. Start the machine from GUI
2. Login to webservice, find this machine, lock it with 'Shared' lock type
3. Create a listener from Console's event source, listen for 'All' events, register listener
4. In a loop run getEvent
After i poweroff the machine the getEvent call returns the above error.
I don't know if it's relevant but here is the code I use (Ruby). It is based on the custom object-oriented SOAP API wrapper I wrote:
Code: Select all   Expand viewCollapse view
web_session =
virtual_box = web_session.logon(:username => 'user', :password => 'password')
session = web_session.get_session_object
virtual_box.find_machine(:name_or_id => 'MACHINE1').lock_machine(:session => session, :lock_type => 'Shared')
event_source = session.console.event_source
listener = event_source.create_listener
event_source.register_listener(:listener => listener, :interesting => ['Any'])
while true
  # the error goes from here
  ev = event_source.get_event(:listener => listener)
  sleep 1

The XML I get in the response from vboxwebsrv is the following:
Code: Select all   Expand viewCollapse view
<SOAP-ENV:Envelope xmlns:SOAP-ENV="" xmlns:SOAP-ENC="" xmlns:xsi="" xmlns:xsd="" xmlns:vbox="">
      <faultstring>VirtualBox error:  (0x800706BE)</faultstring>

The thing here is that I get the error only on poweroff, the other console events like snaphots, clipboard, drag/drop are catched fine.
So where can I go from here? Maybe some debugging info I need to enable somewhere to see the root cause? I understand the info I provided might not be enough so I'll be glad to provide any additional info needed.
Posts: 3
Joined: 1. Oct 2013, 07:56

Re: Error while catching machine poweroff event via webservi

Postby noteirak » 13. Oct 2013, 18:03

The Event source is not valid anywhere, since the VM is powered off and all its associated objects are deleted.
You would get the powered off event from the Virtualbox object directly.
Hyperbox - Virtual Infrastructure Manager -
Manage your VirtualBox infrastructure the free way!
Site Moderator
Posts: 5197
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7

Return to The VirtualBox API

Who is online

Users browsing this forum: Google [Bot] and 3 guests