webtest.cpp revision f71804b40936663bf3cba489497c7b779e6f1f0a
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * demo webservice client in C++. This mimics some of the
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * functionality of VBoxManage for testing purposes.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Copyright (C) 2006-2010 Oracle Corporation
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * available from http://www.virtualbox.org. This file is free software;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * you can redistribute it and/or modify it under the terms of the GNU
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * General Public License (GPL) as published by the Free Software
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync// gSOAP headers (must come after vbox includes because it checks for conflicting defs)
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync// include generated namespaces table
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#include "vboxwebsrv.nsmap"
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * @param argc
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * @param argv[]
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync soap_init(&soap); // initialize runtime environment (only once)
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync "webtest: VirtualBox webservice testcase.\n"
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync " - IWebsessionManager:\n"
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync " - webtest logon <user> <pass>: IWebsessionManager::logon().\n"
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync " - webtest getsession <vboxref>: IWebsessionManager::getSessionObject().\n"
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync " - webtest logoff <vboxref>: IWebsessionManager::logoff().\n"
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync " - IVirtualBox:\n"
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync " - webtest version <vboxref>: IVirtualBox::getVersion().\n"
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync " - webtest gethost <vboxref>: IVirtualBox::getHost().\n"
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync " - webtest getmachines <vboxref>: IVirtualBox::getMachines().\n"
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync " - webtest createmachine <vboxref> <baseFolder> <name>: IVirtualBox::createMachine().\n"
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync " - webtest registermachine <vboxref> <machineref>: IVirtualBox::registerMachine().\n"
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync " - IHost:\n"
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync " - webtest getdvddrives <hostref>: IHost::getDVDDrives.\n"
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync " - IHostDVDDrive:\n"
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync " - webtest getdvdname <dvdref>: IHostDVDDrive::getname.\n"
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync " - IMachine:\n"
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync " - webtest getname <machineref>: IMachine::getName().\n"
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync " - webtest getid <machineref>: IMachine::getId().\n"
NULL,
&req,
&resp)))
NULL,
&req,
&resp)))
NULL,
&req,
&resp)))
NULL,
&req,
&resp)))
NULL,
&req,
&resp)))
NULL,
&req,
&resp)))
for (size_t i = 0;
std::cout << "createmachine: baseFolder = \"" << req.baseFolder << "\", name = \"" << req.name << "\"\n";
NULL,
&req,
&resp)))
NULL,
&req,
&resp)))
NULL,
&req,
&resp)))
for (size_t i = 0;
NULL,
&req,
&resp)))
NULL,
&req,
&resp)))
NULL,
&req,
&resp)))
NULL,
&req,
&resp)))
NULL,
&req,
&resp)))
if (soaprc)
std::cout << "Bad object ID: " << soap.fault->detail->vbox__InvalidObjectFault->badObjectID << "\n";
std::cout << "Result code: 0x" << std::hex << soap.fault->detail->vbox__RuntimeFault->resultCode << "\n";
std::cout << "Component: " << std::hex << soap.fault->detail->vbox__RuntimeFault->component << "\n";
std::cout << "Interface ID: " << std::hex << soap.fault->detail->vbox__RuntimeFault->interfaceID << "\n";
return soaprc;