webtest.cpp revision 3cc7eed0edc680bfdc43d9632ef447a6d4041c61
/*
* webtest.cpp:
* demo webservice client in C++. This mimics some of the
* functionality of VBoxManage for testing purposes.
*
* Copyright (C) 2006-2007 Sun Microsystems, Inc.
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 USA or visit http://www.sun.com if you need
* additional information or have any questions.
*/
// gSOAP headers (must come after vbox includes because it checks for conflicting defs)
#include "soapStub.h"
// include generated namespaces table
#include "vboxwebsrv.nsmap"
#include <iostream>
#include <sstream>
#include <string>
/**
*
* @param argc
* @param argv[]
* @return
*/
{
if (argc < 2)
{
"webtest: VirtualBox webservice testcase.\n"
"Usage:\n"
" - IWebsessionManager:\n"
" - webtest logon <user> <pass>: IWebsessionManage::logon().\n"
" - webtest getsession <vboxref>: IWebsessionManage::getSessionObject().\n"
" - IVirtualBox:\n"
" - webtest version <vboxref>: IVirtualBox::getVersion().\n"
" - webtest gethost <vboxref>: IVirtualBox::getHost().\n"
" - webtest getmachines <vboxref>: IVirtualBox::getMachines().\n"
" - webtest createmachine <vboxref> <baseFolder> <name>: IVirtualBox::createMachine().\n"
" - webtest registermachine <vboxref> <machineref>: IVirtualBox::registerMachine().\n"
" - IHost:\n"
" - webtest getdvddrives <hostref>: IHost::getDVDDrives.\n"
" - IHostDVDDrive:\n"
" - webtest getdvdname <dvdref>: IHostDVDDrive::getname.\n"
" - IMachine:\n"
" - webtest getname <machineref>: IMachine::getName().\n"
" - webtest getid <machineref>: IMachine::getId().\n"
" - webtest getostype <machineref>: IMachine::getGuestOSType().\n"
" - webtest savesettings <machineref>: IMachine::saveSettings().\n"
" - All managed object references:\n"
" - webtest getif <ref>: report interface of object.\n"
" - webtest release <ref>: IUnknown::Release().\n";
exit(1);
}
const char *pcszArgEndpoint = "localhost:18083";
int soaprc = 2;
{
if (argc < 4)
else
{
NULL,
&req,
&resp)))
}
}
{
if (argc < 3)
else
{
NULL,
&req,
&resp)))
}
}
{
if (argc < 3)
else
{
NULL,
&req,
&resp)))
}
}
{
if (argc < 3)
else
{
NULL,
&req,
&resp)))
{
}
}
}
{
if (argc < 3)
else
{
NULL,
&req,
&resp)))
{
unsigned int i,
for (i = 0;
i < c;
++i)
{
}
}
}
}
{
if (argc < 5)
else
{
std::cout << "createmachine: baseFolder = \"" << req.baseFolder << "\", name = \"" << req.name << "\"\n";
NULL,
&req,
&resp)))
}
}
{
if (argc < 4)
else
{
NULL,
&req,
&resp)))
}
}
{
if (argc < 3)
else
{
NULL,
&req,
&resp)))
{
unsigned int i,
for(i = 0;
i < c;
++i)
{
}
}
}
}
{
if (argc < 3)
else
{
NULL,
&req,
&resp)))
}
}
{
if (argc < 3)
else
{
NULL,
&req,
&resp)))
}
}
{
if (argc < 3)
else
{
NULL,
&req,
&resp)))
}
}
{
if (argc < 3)
else
{
NULL,
&req,
&resp)))
}
}
{
if (argc < 3)
else
{
NULL,
&req,
&resp)))
}
}
{
if (argc < 3)
else
{
NULL,
&req,
&resp)))
}
}
else
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";
}
}
else
{
}
}
return soaprc;
}