VMware vCenter vCenter Lab Manager 2.5 User guide

Type
User guide
SOAP API Guide
Lab Manager 2.5
VMware, Inc.
3401 Hillview Ave.
Palo Alto, CA 94304
www.vmware.com
2 VMware, Inc.
VMware Lab Manager SOAP API Guide
You can find the most up-to-date technical documentation on our Web site at
http://www.vmware.com/support/
The VMware Web site also provides the latest product updates.
If you have comments about this documentation, submit your feedback to:
© 2007 VMware, Inc. All rights reserved. Protected by one or more of U.S. Patent Nos. 6,397,242,
6,496,847, 6,704,925, 6,711,672, 6,725,289, 6,735,601, 6,785,886, 6,789,156, 6,795,966, 6,880,022,
6,944,699, 6,961,806, 6,961,941, 7,069,413, 7,082,598, 7,089,377, 7,111,086, 7,111,145, 7,117,481,
7,149,843, 7,155,558, 7,222,221, 7,260,815, 7,260,820, 7,269,683, 7,275,136, 7,277,998, 7,277,999,
7,278,030, 7,281,102, and 7,290,253; patents pending.
VMware, the VMware “boxes” logo and design, Virtual SMP and VMotion are registered trademarks or
trademarks of VMware, Inc. in the United States and/or other jurisdictions. All other marks and names
mentioned herein may be trademarks of their respective companies.
VMware Lab Manager SOAP API Guide
Revision: 20070709
Item: VLM-ENG-Q207-360
VMware, Inc. 3
Contents
AboutThisBook 7
1 IntroducingVMwareLab ManagerSOAPAPI 11
IntegratingLab ManagerwithAutomatedTestingTools 12
SupportedOperations 12
Lab ManagerDataObjects 12
StandardsComplianceandCompatibleDevelopmentPlatforms 13
Security 13
UserAuthentication 13
2 GettingStartedwiththeLab ManagerSOAPAPI 15
Requirements 16
ObtainingandImportingtheWSDL 16
Importingthe WSDLFileintoYourDevelopmentPlatform 16
InstructionsforUsingMicrosoftVisualStudiowithLab ManagerWSDL 17
SimpleandAdvancedCodeSamples 18
SimpleC#ConsoleApplication 19
AdvancedSample:IntegratingLab ManagerandQualityCenter 21
3 Lab ManagerAPIDataTypes 27
PrimitiveXMLDataTypes 28
Lab ManagerDataTypes 28
AuthenticationHeader 29
SupportedAPICalls 29
Fields 29
SampleUsage:C# 29
Configuration 30
Machine 30
VMware Lab Manager SOAP API Guide
4 VMware, Inc.
4 Lab ManagerAPIMethodReference 33
ConfigurationCapture 35
Syntax 35
Arguments 35
Response 35
SampleCode:C# 35
ConfigurationCheckout 36
Syntax 36
Arguments 36
Response 36
SampleCode:C# 37
ConfigurationClone 38
Syntax 38
Arguments 38
Response 38
SampleCode:C# 38
ConfigurationDelete 39
Syntax 39
Arguments 39
Response 39
SampleCode:C# 39
ConfigurationDeploy 40
Syntax 40
Arguments 40
Response 40
SampleCode:C# 41
ConfigurationPerformAction 41
Syntax 42
Arguments 42
Response 42
SampleCode:C# 42
ConfigurationSetPublicPrivate 43
Syntax 43
Arguments 43
Response 43
SampleCode:C# 43
ConfigurationUndeploy 44
Syntax 44
Arguments 44
Response 44
SampleCode:C# 44
VMware, Inc. 5
Contents
GetConfiguration 45
Syntax 45
Response 46
SampleCode:C# 46
GetConfigurationByName 47
Syntax 47
Arguments 47
Response 47
SampleCode:C# 47
GetMachine 48
Syntax 48
Arguments 48
Response 49
SampleCode:C# 49
GetMachineByName 50
Syntax 50
Arguments 50
Response 50
SampleCode:C# 50
GetSingleConfigurationByName 51
Syntax 51
Arguments 51
Response 51
SampleCode:C# 51
ListConfigurations 52
Syntax 52
Arguments 52
Response 53
SampleCode:C# 53
ListMachines 54
Syntax 54
Arguments 54
Response 54
SampleCode:C# 54
VMware Lab Manager SOAP API Guide
6 VMware, Inc.
LiveLink 55
Syntax 55
Arguments 55
Response 56
SampleCode:C# 56
MachinePerformAction 57
Syntax 57
Arguments 57
Response 57
SampleCode:C# 57
Index 59
VMware, Inc. 7
UsetheVMwareLab ManagerSOAPAPIGuidetodevelopapplicationsthatleverage
Lab ManagerWebservicedata,automatetasks,orintegrateLab Managerwithother
softwaretestingtools.
Intended Audience
ThisguideisintendedfordeveloperswhowanttoleverageLab Managerdatafor
customizedtestingsolutions,orintegrateLab Managerandothersoftwaretestingtools
intheirenvironment.Forexample,usingtheLab ManagerSOAPAPIletsyouintegrate
Lab Managerwithautomatedsoftwaretestingtools,suchasMercuryQualityCenter.
Thisguideassumes
youhavesomefamiliaritywith:
Virtualmachinetechnology
Distributed,multitieredsystemsconcepts
Developmentandtestingpractices
WindowsorLinuxoperatingsystems
WebServices,SOAP,andXML
Document Feedback
VMwarewelcomesyoursuggestionsforimprovingourdocumentation.Ifyouhave
comments,sendyourfeedbackto:
About This Book
VMware Lab Manager SOAP API Guide
8 VMware, Inc.
Conventions
Table 1illustratesthetypographicconventionsusedinthismanual.
Technical Support and Education Resources
Thefollowingsectionsdescribethetechnicalsupportresourcesavailabletoyou.
Self-Service Support
UsetheVMwareTechnologyNetwork(VMTN)forselfhelptoolsandtechnical
information:
Productinformationhttp://www.vmware.com/products/
Technologyinformationhttp://www.vmware.com/communities/content/
Documentationhttp://www.vmware.com/support/pubs
VMTNKnowledgeBasehttp://www.vmware.com/support/kb
Discussionforumshttp://www.vmware.com/community
Usergroupshttp://www.vmware.com/vcommunity/usergroups.html
FormoreinformationabouttheVMwareTechnologyNetwork,goto:
http://www.vmtn.net
Table 1. Conventions Used in This Manual
Style Elements
Blue(onlineonly) Links,crossreferences,andemailaddresses
Blackboldface Userinterfaceelementssuchasbuttonnamesandmenuitems
Monospace Commands,filenames,directories,andpaths
Monospace bold Userinput
Italic Documenttitles,glossary terms,andoccasionalemphasis
<Name> Variableandparameternames
VMware, Inc. 9
About This Book
Online and Telephone Support
Useonlinesupporttosubmittechnicalsupportrequests,viewyourproductand
contractinformation,andregisteryourproducts.Goto
http://www.vmware.com/support
Customerswithappropriatesupportcontractsshouldusetelephonesupportforthe
fastestresponseonpriority1issues.Goto
http://www.vmware.com/support/phone_support.html
Support Offerings
FindouthowVMwaresupportofferingscanhelpmeetyourbusinessneeds.Goto:
http://www.vmware.com/support/services
VMware Education Services
VMwarecoursesofferextensivehandsonlabs,casestudyexamples,andcourse
materialsdesignedtobeusedasonthejobreferencetools.Formoreinformationabout
VMwareEducationServices,gotohttp://mylearn1.vmware.com/mgrreg/index.cfm
VMware Lab Manager SOAP API Guide
10 VMware, Inc.
VMware, Inc. 11
1
TheLab ManagerWebserviceSOAPAPIprovidesprogrammaticaccesstothe
Lab Managersystem.Byusingthesecureapplicationprogramminginterface(API),
youcanconnecttoLab ManagerServertoautomateorperformvariousoperations.
TheLab ManagerWebserviceSOAPAPIusesXMLbasedtechnologies,including
SimpleObjectAccessProtocol(SOAP)asthe
communicationprotocolandWeb
ServicesDescriptionLanguage(WSDL)astheinterfacedescriptionlanguage.The
Lab ManagerWSDLfiledetailstheavailablemethodsoftheservice(called
“operations”inWebServicesvernacular)andparametertypes,aswellastheSOAP
endpointfortheservice.
Thischaptercoversthesetopics:
“IntegratingLab ManagerwithAutomatedTestingTools”onpage 12
“SupportedOperations”onpage 12
“Lab ManagerDataObjects”onpage 12
“StandardsComplianceandCompatibleDevelopmentPlatforms”onpage 13
“Security”onpage 13
Introducing VMware
Lab Manager SOAP API
1
VMware Lab Manager SOAP API Guide
12 VMware, Inc.
Integrating Lab Manager with Automated Testing Tools
TheLab ManagerWebserviceSOAPAPIallowsyoutoleverageLab Managerdata
usingthelanguageandplatformofyourchoice.TheexamplesinthisguideusetheC#
programminglanguageandtheMicrosoft.NETframework,butotherprogramming
languagesanddevelopmentenvironmentsarealsosupported.Ifyouareusinga
language
otherthanC#,seethedocumentationonyourdevelopmentenvironmentfor
comparableinformationaboutdevelopingWebserviceapplications.
InadditiontoextendingorcustomizingLab ManagerbyusingtheSOAPAPI,youcan
alsointegrateLab Managerwithautomatedtestingsystems.Youcanseeanexampleof
thisintegrationinAdvancedSample:Integrating
Lab ManagerandQualityCenter
onpage 21.
FormoreinformationaboutLab Managersolutions,developerresources,and
communityresources,gotohttp://www.vmware.com.
Supported Operations
UsingyourpreferredWebenableddevelopmentenvironment,youcanconstructWeb
serviceclientapplicationsusingstandardWebserviceprotocolstoprogrammatically:
Queryforvirtualmachineandconfigurationinformation.
Performactionsonmachinesandconfigurations.
Capture,checkout,clone,delete,anddeployconfigurations.
CreateaLiveLinkconfigurationURLyoucanemailtootherteammembers.
FordetailedinformationaboutsupportedWebserviceoperations,see“Lab Manager
APIMethodReference”onpage 33.
Lab Manager Data Objects
TheLab ManagerWebserviceSOAPAPIinteractswiththedatainyourorganization
usingobjects,whichareprogrammaticrepresentationsoftheLab Managerdata.Object
propertiesrepresentfieldsinthosedataentities.Forexample,aLab Manager
configurationisrepresentedbyaConfigurationobject,whichhasfieldsthatrepresent
theconfigurationname,configuration
numericidentifier,deploymentstatus,shared
state,andmore.
Thisdocumentdescribeshowtoperformoperationssuchasquery,clone,capture,and
deployonLab ManagerdatausingtheLab Managerdataobjects.Fordetailed
information,see“Lab ManagerAPIDataTypesonpage 27.
VMware, Inc. 13
Chapter 1 Introducing VMware Lab Manager SOAP API
Standards Compliance and Compatible Development
Platforms
TheLab ManagerWebServiceSOAPAPIcomplieswithSOAP1.1,WSDL1.1,and
otherstandardsidentifiedintheWSIBasicProfileVersion1.1.TheLab M anagerWeb
ServiceSOAPAPIworkswithcurrentSOAPdevelopmentenvironmentsthatadhere
totheBasicProfileVersion1.1standards.Theexamplesinthisdocumentuse
the
MicrosoftVisualStudio.NET2003developmentenvironmentandtheC#
programminglanguage.
IfyouareusingVisualStudiofor.NETdevelopment,VMwarerecommendsthatyou
useVisualStudio2003orhigher.
Security
ClientapplicationsthataccesstheLab Managerdatainyourorganizationaresubject
tothesamesecurityprotectionsthatareusedintheLab ManagerWebconsole.
Lab ManagerexposesallSOAPAPImethodsusingSSL.
WhenaccessingtheSOAPAPIwiththeWebserviceURL,youmightseeanSSL
certificatewarning.Accept
thecertificatetousetheAPIorreplacethecertificatewitha
validsignedcertificate.
User Authentication
Clientapplicationsmustprovidevalidcredentials—aLab Manageruseraccountand
password—witheachLab ManagerWebservicemethodcall.Theuseraccountmust
haveAdministratorprivilegesontheLab ManagerServer.TheLab ManagerServer
authenticatesthesecredentials.
N
OTEImplementationdifferencesincertaindevelopmentplatformsmightprevent
accesstosomeorallofthefeaturesintheLab ManagerWebserviceSOAPAPI.
VMware Lab Manager SOAP API Guide
14 VMware, Inc.
VMware, Inc. 15
2
YoucanreviewintroductoryinformationaboutusingtheLab ManagerWebservice
SOAPAPItodevelopanXMLWebserviceclient.AnXMLWebserviceclientisany
componentorapplicationthatreferencesandusesanXMLWebservice.Thisdoesnot
needtoinvolveaclientbasedapplication.Inmanycases,
XMLWebserviceclients
mightbeotherWebapplications,suchasWebFormsorevenotherXMLWebservices.
Thischaptercoversthesetopics:
“Requirements”onpage 16
“ObtainingandImportingtheWSDL”onpage 16
“SimpleandAdvancedCodeSamples”onpage 18
Getting Started with the
Lab Manager SOAP API
2
VMware Lab Manager SOAP API Guide
16 VMware, Inc.
Requirements
TheinstructionsinthischapterassumethataninstanceofLab Managerisinstalled,
configured,andrunningonyournetwork.Beforeyoucanstartdevelopingan
application,reviewtheserequirements:
YoumustknowtheaddressoftheLab Managerserverinstance,startingwithits
fullyqualifiedhostnameorIPaddress.
Forexample,https://hostname.company.com/LabManager.
YoumusthaveanaccountwithLab ManagerAdministratorprivilegesonthe
targetLab Managerserver.
IfyouarenotanAdministrator,haveyourLab ManagerAdministratorsetyouup
withaLab Manageraccount.
AssumingyouhaveanappropriateaccountontheLab ManagerServer,youcan
continuewith“ObtainingandImportingtheWSDL.”
Obtaining and Importing the WSDL
AswithanystandardsbasedSOAPAPIimplementation,theLab ManagerAPI
definitionisavailableontheWebserviceasanXMLformattedWSDLfile.
ToobtaintheWSDL,launchInternetExplorer5.5orhigherandnavigatetothisURL
foryourLab ManagerServer:
https://<hostname>/LabManager/SOAP/LabManager.asmx?WSDL
TheWSDLdefinesalltheLab ManagerAPIcallsandobjects.
FormoreinformationonWSDL,see:
http://www.w3.org/TR/wsdl
Importing the WSDL File into Your Development Platform
AfteryouobtaintheWSDL,importitintoyourdevelopmentenvironmentand
generatethenecessaryobjectsforuseinbuildingclientWebserviceapplications.The
processdependsonyourdevelopmentenvironment,programminglanguage,and
associatedtools.Forexample,theMicrosoftVisualStudiodevelopmentenvironment
handlesthetasksautomatically.
Thenextsection
providesanexampleofobtainingtheWSDLandimportingitinthe
MicrosoftVisualStudio2003.Forinstructionsaboutotherdevelopmentplatforms,see
theproductdocumentationforyourplatform.
VMware, Inc. 17
Chapter 2 Getting Started with the Lab Manager SOAP API
Instructions for Using Microsoft Visual Studio with
Lab Manager WSDL
MicrosoftVisualStudioprogramminglanguagesaccesstheLab ManagerWebservice
APIthroughobjectsthatserveasproxiesfortheirserversidecounterparts.
WhenaccessingXMLWebservicesinmanagedcode,aproxyclassandthe.NET
Frameworkhandlealloftheinfrastructurecoding.
BeforeyoucanusetheLab ManagerWebservice
APIwithVisualStudio,youmustfirst
generatetheproxyclassobjectfromtheWSDLfile.
VisualStudioprovidesawizard(“AddaWebReference”)toconnecttoaWebservice
andgeneratethenecessaryartifacts.YoucanaddaWebreferencetoanexisting
applicationorcreateanewapplication
inVisualStudio.
TheinstructionsbelowarespecifictoMicrosoftVisualStudio2003.
To add a Web reference
1FromtheWindowsStartmenu,launchMicrosoftVisualStudio.NET2003.
TheVisualStudioenvironmentopens.
2 SelectNewProjecttocreateanewproject,orselectOpentoopenanexisting
project.
3InVisualStudio,chooseAddWeb
ReferencefromtheProjectmenu.
4IntheURLtextbox,typetheURLtoobtaintheservicedescriptionofthe
Lab ManagerWebservice:
https://<hostname>/LabManager/SOAP/LabManager.asmx
5ClickGo.
ThecertificateexchangebetweentheLab Managerserverandthedevelopment
environmentclientbegins.Asecurityalertdisplaysthedetailsofthecertificate
sentfromtheserver.
6ClickYestoproceed.
N
OTEThesecurityalertmessagesaregeneratedwhentheLab Managerserveruses
thedefault,selfsignedcertificates.Youcanreplacethesecertificatesonthe
Lab ManagerserverwithcertificatespurchasedfromVerisign,Thawte,andother
certificateauthorities.
VMware Lab Manager SOAP API Guide
18 VMware, Inc.
AnalertfromtheVisualStudioenvironmentmightappear.ClickYestoproceed.
TheMicrosoftVisualStudioenvironmentconnectstotheWebserviceendpoint
anddisplaystheoperationsdescribedintheLab ManagerWebserviceWSDL.
7 SelectthetextintheWebreferencenametextboxandrenametheWebreference
to
LabManagerSoap,thenamespaceusedforthisWebreference.
“LabManagerSoap”isoneword,withoutspaces.
8ClickAddReferencetocompletetheprocess.
Acertificatewarningmessagemightappear.ClickYes.
9ClickYesagaintoproceed.
Formoreinformation,seethe“A d d i n g andRemovingWebReferences”topicin
theVisualStudiodocumentation.
VisualStudioretrieves
theservicedescriptionandgeneratesaproxyclass
(LabManagerSoap)thatservesasaninterfacetotheLab ManagerWebservicefrom
yourapplication.Attheendoftheprocess,theclassgetsaddedtotheWebReferences
folderoftheproject.(ClickSolutionExplorertoseeLabManagerSoaplistedintheWeb
References
folder.)
Withthisbasicsetuptaskcompleted,youcanbuildclientapplicationsthatusethe
Lab ManagerWebServiceSOAPAPI.ThefastestwaytobecomefamiliarwiththeAPI
isbywalkingthroughthecodesamplelistedinthenextsection.
Simple and Advanced Code Samples
Thissectioncontainstwocodesamples—onesimpleandonemorecomplex—written
inC#usingtheMicrosoftVisualStudio2003IDE.
AssumingthatyouhaveaLab Managerinstancerunning,yourprogramming
environmentissetup,andyouhavetheappropriatepermissionsontheLab Manager
server(see“Requirements”onpage 16),youcantest
basicAPIprogramming
connectivitybetweenyourdevelopmentworkstationandyourLab ManagerWeb
servicebyusingthe“SimpleC#ConsoleApplication.Copythecodelistingdisplayed
inthenextsection,andpasteitintoyourMicrosoftVisualStudio2003environment.
N
OTEVMwareassumesyouarefamiliarwithbasicprogrammingconceptsand
alreadyhaveaprogrammingdevelopmentenvironmentsetuponyourcomputer.If
youareusingaprogramminglanguageotherthanC#andaWebservicesdevelopment
environmentotherthanMicrosoftVisualStudio2003,seetheappropriate
documentationformoreinformation.
VMware, Inc. 19
Chapter 2 Getting Started with the Lab Manager SOAP API
Thecodeperformsseveralsimpletasks.Thefirsttwotasks(bindingtotheWebservice
andprovidingcredentials)aretypicallyrequiredofanyapplicationthatmakescallsto
aLab ManagerWebservice:
BindstotheLab ManagerWebServiceSOAPAPI.
SetsuptheusernameandpasswordformakingaSOAPcall.
SetsuptheServicePointManagercertificatepolicytoaccepttheSSLcertificate.You
mustsetupthecertificatepolicytoacceptallcertificatestoconnecttotheAPI.
Makesacalltogetaconfigurationobjectbasedonname.
Displaysallconfigurationfieldsintheconsole.
Simple C# Console Application
using System;
using System.Net;
namespace LMConsoleApplication1
{
class Class1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
try
{
//
//** Bind to the Lab Manager SOAP API Web Service
//
LabManagerSoap.VMwareLabManagerSOAPinterface binding =
new LabManagerSoap.VMwareLabManagerSOAPinterface();
//
//** Enter the URL for your system here
//
binding.Url
="https://10.6.1.248/LabManager/SOAP/LabManag
er.asmx;
binding.Timeout = 10 * 60 * 1000; // 10 minutes
ServicePointManager.CertificatePolicy = new
CertificateAccepter();
//**
//** Allocate AuthenticationHeader object to hold caller’s
//** username and password
VMware Lab Manager SOAP API Guide
20 VMware, Inc.
//**
binding.AuthenticationHeaderValue = new
LabManagerSoap.AuthenticationHeader();
//
//** Substitute a real user’s username and password here
//
binding.AuthenticationHeaderValue.username = "jaya";
binding.AuthenticationHeaderValue.password = "Lab Manager";
//**
//** Call GetSingleConfigurationByName()
//** Get default configuration that comes with Lab Manager
//** installation and write all property values to console
//**
LabManagerSoap.Configuration defCfg=
binding.GetSingleConfigurationByName("Sample 1");
//
//** Print out all configuration properties to the Console
//
Console.WriteLine("Name = " + defCfg.name);
Console.WriteLine("ID = " + defCfg.id.ToString());
Console.WriteLine("Description = "+ defCfg.description);
Console.WriteLine("isPublic = "+
defCfg.isPublic.ToString());
Console.WriteLine("isDeployed = "+
defCfg.isDeployed.ToString());
Console.WriteLine("fenceMode = "+
defCfg.fenceMode.ToString());
Console.WriteLine("type = " + defCfg.type.ToString());
Console.WriteLine("owner = " + defCfg.owner);
Console.WriteLine("dateCreated = " +
defCfg.dateCreated.ToString());
Console.ReadLine();
}
catch (Exception e)
{
Console.WriteLine("Error: " + e.Message);
Console.ReadLine();
}
} //** end Main
} //** end Class1
/// <summary>
/// This class is needed to automatically accept the SSL certificate
/// the Lab Manager sends on each API call.
/// </summary>
public class CertificateAccepter : System.Net.ICertificatePolicy
{
  • Page 1 1
  • Page 2 2
  • Page 3 3
  • Page 4 4
  • Page 5 5
  • Page 6 6
  • Page 7 7
  • Page 8 8
  • Page 9 9
  • Page 10 10
  • Page 11 11
  • Page 12 12
  • Page 13 13
  • Page 14 14
  • Page 15 15
  • Page 16 16
  • Page 17 17
  • Page 18 18
  • Page 19 19
  • Page 20 20
  • Page 21 21
  • Page 22 22
  • Page 23 23
  • Page 24 24
  • Page 25 25
  • Page 26 26
  • Page 27 27
  • Page 28 28
  • Page 29 29
  • Page 30 30
  • Page 31 31
  • Page 32 32
  • Page 33 33
  • Page 34 34
  • Page 35 35
  • Page 36 36
  • Page 37 37
  • Page 38 38
  • Page 39 39
  • Page 40 40
  • Page 41 41
  • Page 42 42
  • Page 43 43
  • Page 44 44
  • Page 45 45
  • Page 46 46
  • Page 47 47
  • Page 48 48
  • Page 49 49
  • Page 50 50
  • Page 51 51
  • Page 52 52
  • Page 53 53
  • Page 54 54
  • Page 55 55
  • Page 56 56
  • Page 57 57
  • Page 58 58
  • Page 59 59
  • Page 60 60

VMware vCenter vCenter Lab Manager 2.5 User guide

Type
User guide

Ask a question and I''ll find the answer in the document

Finding information in a document is now easier with AI