0% found this document useful (0 votes)
259 views34 pages

VS5 WSSDK Developer Setup Guide

This document supports the version of each product listed and supports all subsequent versions until the document is replaced by a new edition. VMware products are covered by one or more patents listed at VMware is a registered trademark or trademark of VMware, Inc. All other marks and names mentioned herein may be trademarks of their respective companies.

Uploaded by

Luo Tongbo
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
259 views34 pages

VS5 WSSDK Developer Setup Guide

This document supports the version of each product listed and supports all subsequent versions until the document is replaced by a new edition. VMware products are covered by one or more patents listed at VMware is a registered trademark or trademark of VMware, Inc. All other marks and names mentioned herein may be trademarks of their respective companies.

Uploaded by

Luo Tongbo
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Developers Setup Guide

VMware vSphere Web Services SDK 5.0

This document supports the version of each product listed and supports all subsequent versions until the document is replaced by a new edition. To check for more recent editions of this document, see [Link]

EN-000670-01

Developers Setup Guide

You can find the most up-to-date technical documentation on the VMware Web site at: [Link] The VMware Web site also provides the latest product updates. If you have comments about this documentation, submit your feedback to: docfeedback@[Link]

Copyright 20072011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at [Link] VMware is a registered trademark or trademark 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, Inc. 3401 Hillview Ave. Palo Alto, CA 94304 [Link]

VMware, Inc.

Contents

AboutThisBook

1 AboutthevSphereWebServicesSDK 7
KnowledgeRequiredforUsingthevSphereWebServicesSDK 7 ProgrammingLanguagesSupportedbythevSphereWebServicesSDK TypesofApplicationsThatYouCanBuildUsingThisSDK 8 vSphereWebServicesSDKPackageContents 9 SDKVersionsandVMwarevSphereProductCompatibility 10 8

2 SettingUpforJavaDevelopment 11
Requirements 11 SetupInstructionsforJavaDevelopment 11 SettingUpforDevelopmentUsingJAXWS 12 SettingUpforDevelopmentUsingApacheAxis 12 SettingEnvironmentVariablesforAxisDevelopment 13 BatchFilesandShellScriptsforBuildingandRunningSamples 15 ImportingServerCertificatesintotheJavaKeystore 15 GeneratingStubsandCompilingClasses 16 PrecompiledJAXWSSamples 17 PrecompiledAxisSamples 17 UsingtheIncludedBuildScripts 17 RunningtheSimpleClientSampleApplicationtoValidateSetup 18 RunningaSampleApplicationUsingtheProvidedScripts 18 TroubleshootingSetupIssues 20

3 SettingUpforMicrosoftC#Development 21
Requirements 21 EnvironmentVariableSettings 21 SetupInstructionsforC#Development 22 BuildingtheC#Samples 22 BuildingforaChosenVersionofVisualStudio 22 IteratingtheBuildforBothVimandVim25Namespaces 23 [Link](C#)VersionofSimpleClient 24 TroubleshootingSetupIssues 25

Appendix:vSphereServerCertificates

27

SecureClientServerCommunications 27 SimplifiedSecuritySetupforDevelopmentEnvironment 27 ObtainingServerCertificates 28 ObtainingCertificatesbyUsingthevSphereClient 28 ObtainingCertificatesbyConnectingDirectlytoServerSystems 29 ModifyingServerConfigurationstoSupportHTTP 29

Index 33

VMware, Inc.

Developers Setup Guide

VMware, Inc.

About This Book

Thisbook,theDevelopersSetupGuide,providesinformationaboutsettingupyourdevelopmentenvironment tousetheVMwarevSphereWebServicesSDK5.0. [Link] informationaboutusingthevSphereWebServicesSDKfordeveloperswhoareinterestedincreatingclient applicationsformanagingVMwarevSpherecomponentsavailableonVMwareESXiandVMwarevCenter Serversystems. ToviewthecurrentversionofthisbookaswellasallVMwareAPIandSDKdocumentation,goto [Link]

Revision History
[Link] [Link] 1summarizesthesignificantchangesineachversionofthisguide. Table 1. Revision History
Revision 17Nov2011 24Aug2011 13Jul2010 07May2009 Description CorrectedsetupinstructionsforC#stubs. UpdatedforvSphere5.0(includedinformationonusingJAXWSbindings). MinorupdatesforvSphere4.1(newWSDLfileconfiguration,examplesyntax). [Link] [Link] variable. InitialreleaseofDevelopersSetupGuideforVMwareInfrastructureSDK2.5.

29Nov2007

Intended Audience
ThisbookisintendedforanyonewhowantstodevelopapplicationsusingtheVMwarevSphereWebServices [Link] usingJavaorC#([Link])targetingVMwarevSphere.

VMware Technical Publications Glossary


[Link] oftermsastheyareusedinVMwaretechnicaldocumentationgoto[Link]

Document Feedback
[Link] docfeedback@[Link].

VMware, Inc.

Developers Setup Guide

Technical Support and Education Resources


[Link] ofotherVMwarebooks,goto[Link]

Online and Telephone Support


Touseonlinesupporttosubmittechnicalsupportrequests,viewyourproductandcontractinformation,and registeryourproducts,goto[Link]

Support Offerings
TofindouthowVMwaresupportofferingscanhelpmeetyourbusinessneeds,goto [Link]

VMware Professional Services


VMwareEducationServicescoursesofferextensivehandsonlabs,casestudyexamples,andcoursematerials [Link],intheclassroom,andlive [Link] andimplementationbestpractices,VMwareConsultingServicesprovides offeringsto helpyouassess,plan,build,[Link] educationclasses,certificationprograms,andconsultingservices,goto[Link]

VMware, Inc.

About the vSphere Web Services SDK

TheVMwarevSphereWebServicesSDKincludesallthecomponentsnecessarytoworkwiththe VMwarevSphereAPI,includingWSDLfiles,samplecode,[Link] vSphereWebServicesSDKfacilitatesdevelopmentofclientapplicationsthattargettheVMwarevSphereAPI. WiththevSphereWebServicesSDK,developerscancreateclientapplicationstomanage,monitor,and maintainVMwarevSpherecomponents,asdeployedonESX,ESXi,andVMwarevCenterServersystems. ThisDevelopersSetupGuideprovidesinformationaboutsettingupthedevelopmentenvironmentforusing [Link](usingtheC#programminglanguage)tocreatenewapplications,andinformation aboutrunningthesampleapplicationsincludedwiththevSphereWebServicesSDK. Thischapterincludesthesetopics: KnowledgeRequiredforUsingthevSphereWebServicesSDKonpage 7 ProgrammingLanguagesSupportedbythevSphereWebServicesSDKonpage 8 TypesofApplicationsThatYouCanBuildUsingThisSDKonpage 8 vSphereWebServicesSDKPackageContentsonpage 9 SDKVersionsandVMwarevSphereProductCompatibilityonpage 10

Knowledge Required for Using the vSphere Web Services SDK


DevelopingapplicationswiththevSphereWebServicesSDKrequiresexpertisewithJava,C#,oranother [Link]: Webservicestechnologyprovidesoperations(alsoknownasmethodsinthecontextofclient applications).UsingthevSphereWebServicesSDKandtheprogramminglanguageofyourchoice,you cancreateclientapplicationsthatinvoketheseoperationstoperformthefullrangeofserverside managementandmonitoringtasks. TheWebservicesAPIisdefinedinWSDL(WebServicesDescriptionLanguage)[Link] usedbyclientsideWebservicesutilitiestocreateproxycode(stubs)thatclientapplicationsuseto interactwiththeserver. [Link] [Link](SimpleObjectAccess Protocol)[Link] thedeveloper. CommunicationsbetweenclientandserveroccuroverHTTPorHTTPS(secureHTTP,whichusesSSLto encryptclientservercommunications).ThedefaultisHTTPS,butyoucanconfiguretheVMwarevSphere WebservertosupportHTTP.(SeeModifyingServerConfigurationstoSupportHTTPonpage 29.) YoushouldalsoknowaboutbasicESX,ESXi,[Link] Documentationpageat[Link]

VMware, Inc.

Developers Setup Guide

Programming Languages Supported by the vSphere Web Services SDK


BecausethevSphereAPIisbasedonWebservices,youcanuseanyprogrammingorscriptinglanguagethat providesutilitiesforgeneratingclientsidestubs(proxycode)[Link], VMwarerecommendsusingJavaorC#,[Link],the vSphereWebServicesSDKpackageincludessampleclientapplicationsdevelopedinbothJavaandC#. SeevSphereWebServicesSDKPackageContentsonpage 9foradditionalpackagingdetailsandforsome caveatsabouttheJavasamplesandforspecificversionrequirementsfortheJDK,theJavaAPIforXMLWeb Serviceslibraries,andtheApacheAxis1.4libraries. Table 1-1. Language and Tools Matrix for Client Application Development
Language/Tool Context Developmentenvironmentorframework Webservicesclientapplication developmenttoolset(SOAPtoolkit) Java J2SE6.0(aka,J2SE1.6J2SE1.6b22or subsequentversionrecommended) JAXWS2.1(JavaAPIforXMLWeb Services)orApacheAxis1.4 C# MicrosoftVisualStudio MicrosoftVisualC# [Link]

Developers,scripters,andadministratorsusingMicrosoftPowerShellorPerlcanusethevSphereAPIthrough [Link] [Link]

Types of Applications That You Can Build Using This SDK


ThetypesofapplicationsthatyoucandevelopusingthevSphereWebServicesSDKincludesystem administration,provisioning,andmonitoringapplicationsforVMwarevSpheresystems. TheVMwarevSphereClientapplicationandVMwarevSphereWebAccessaretwoexamplesofclient [Link] [Link],ESXi,and vCenterServersystems. WiththevSphereWebServicesSDK,youcancreateyourownclientapplicationsthatautomatemany administration,provisioning,ormonitoringtasksassociatedwithvirtualinfrastructuremanagementand [Link]: Create,configure,powercycle,orsuspendvirtualmachinesexplicitlyorbyusingprofilesortemplates tofacilitatefasterprovisioning. Create,configure,andmanagevirtualdevices,suchasvirtualCDDVDdrives,virtualnetworkinterface cards,virtualswitches,andothercomponents. Connect,powercycle,anddisconnectESXandESXihostsystems. Capturethestateofavirtualmachinetoasnapshotandrestorethestateofavirtualmachinefroma snapshot,suchasinabackupapplication. Gatherstatisticsabouthostsystemandvirtualmachineperformance. Manageeventsgeneratedbytheserver,suchasthoseemittedbyalarmssetforspecificthresholds. Movevirtualmachinesbetweenhostsautomatically. Manageloadbalancingandfailoverthroughthedistributedresourcescheduler(VMwareDRS)andhigh availability(VMwareHA)[Link]. [Link],someoftheoperationspertaintotheserviceasawhole,notspecifichosts [Link],loadbalancingcanbeaservicewideoperationratherthanperhostor pervirtualmachineoperation.

VMware, Inc.

Chapter 1 About the vSphere Web Services SDK

vSphere Web Services SDK Package Contents


ThevSphereWebServicesSDKisazipfilethatincludes: WSDLfilesthatdefinetheAPIavailableonaVMwarevSphereserver(ESX,ESXi,andvCenterServer) Webservice. Precompiledclientsidelibraries([Link],[Link])availablefortestpurposesthatweregenerated [Link] SDK\vsphere-ws\wsdl\vim25subdirectory. [Link] samplecodeincludescompiledandreadytorunJavaclassfilesandbothJavaandC#sourcecodefiles. (ForC#developers,theMicrosoftVisualStudioprojectfiles(.sln)havebeenincluded.) NOTETheprecompiledJavasamples([Link])havebeencompiledusingJDK1.6b22fromstubs generatedbytheJavaAPIforXMLWebServices(JAXWS)librariesinJ2SE6.0,andworkonlywiththese [Link],oradifferentclientsideweb serviceslibrary,youmustrebuildthesamples(usingthebuildscript). ThevSphereWebServicesSDKalsocontainsprecompiledJavasamplesthathavebeencompiledusing [Link] [Link],useJDK 1.5.0_08orlater.SeeKnowledge Basearticle2983901,PerformanceIssue(forVISDK2.0)withJDKVersionsPriortoJDK1.5.0_08,for details. Batchfilesandshellscripts([Link],[Link])thatautomatethebuildprocessforJavaandC#client applications,respectively. Batchfilesandshellscripts([Link],[Link])thatfacilitaterunningtheJavasamplesfromtheWindows commandprompt. APIreferencedocumentation(vSphereAPIReference)thatprovideslanguageneutraldescriptive information(objecttypedefinitions,properties,andmethodsignatures,forexample)abouttheVMware vSphereAPIandtheobjectmodel. Accesstotechnicalpublications,including: vSphereWebServicesSDKDevelopersSetupGuide(thisbook),whichhelpsyousetupyour developmentenvironmentandrunsampleapplicationsusingeitherJavaorC# vSphereWebServicesSDKProgrammingGuide,whichprovidesconceptualandprescriptive informationabouthowtodevelopclientapplicationsusingthevSphereWebServicesSDK. Completeinformationaboutsettinguptheenvironment,andaboutgenerating,compiling,andrunning applicationsisincludedinChapter 2,SettingUpforJavaDevelopment,onpage 11,andinChapter 3, SettingUpforMicrosoftC#Development,onpage 21.

VMware, Inc.

Developers Setup Guide

SDK Versions and VMware vSphere Product Compatibility


VMwarehasreleasedseveralSDKproductstosupportvariousversionsoftheVMwarevSphereproduct family.TheVMwarevSphereWebServicesSDK5.0canbeusedwithallversionsofVMwarevSphereservers anditspredecessor,VMwareinfrastructure,includingESXi5.0,ESX/ESXi4.1,ESX/ESXi4.0, vCenterServer5.0,vCenterServer4.1/4.0,ESXServer3.5/3i/3.0.x,VirtualCenterServer2.5/[Link] aresupportedbyusingtheappropriateWSDLfiles,asfollows: SDK\vsphere-ws\wsdl\vim25containsWSDLfilesforusewithESXi5.0,ESX/ESXi4.1,ESX/ESXi4.0, vCenterServer4.1/4.0,ESX3.5,andVirtualCenter2.5systems.AsofvSphere4.1,thevSphereAPIWSDL [Link] [Link] (vim25andvimdirectories)useatoplevelfilewiththesamename([Link]). SDK\vsphere-ws\wsdl\vimcontainsWSDLfilesforusewithESXServer3.0.1andVirtualCenter2.0. TheVMwarevSphereAPIisaWebservicethatrunsonVMwarevSphereservers,includingESX,ESXi,and [Link],thevCenterServerprovidesthe followingcapabilitieswhicharenotavailablethroughanESXorESXiwebservice: Collectinghistoricalperformancedata Optimizingresources(includingmanagingdistributedresources) EnablingmigrationfromonehostsystemtoanotherbyusingVMwareVMotion Providingdistributedresourcemanagement,includingrecovery,acrossallhostsystemsunderitscontrol. IfyouattempttoinvokeanoperationonanESXorESXisystemthatissupportedonlyonthevCenterServer, [Link],the ExtensionManagerAPIisavailableonlyonVirtualCenterServer2.5andsubsequentreleasesofvCenter [Link].

10

VMware, Inc.

Setting Up for Java Development

Thischapterincludesthesetopics: Requirementsonpage 11 SetupInstructionsforJavaDevelopmentonpage 11 RunningtheSimpleClientSampleApplicationtoValidateSetuponpage 18 TroubleshootingSetupIssuesonpage 20

Requirements
DevelopingJavaWebservicesclientapplicationsusingtheVMwarevSphereWebServicesSDKrequiresthe JavaSDKandaJavaWebservicesdevelopmenttoolset.VMwarerecommendsusingJava2,StandardEdition, version6.0(J2SE1.6.x),specificallyJDK1.6b22orlater. TheJavaWebservicesdevelopmenttoolsetmustbeaSOAP(SimpleObjectAccessProtocol)implementation [Link] webserviceslibraries: JavaAPIforXMLWebServices(JAXWS)version2.1.TheJAXWS2.1librariesareincludedwiththe JDK1.6. [Link] fromtheApacheWebservicesprojectsiteat[Link] NOTETheApacheAxis1.4librarieshaveaknownissuethatpreventsthemfromworkingwithJ2SE6.0 (JDK1.6).IfyouusetheAxis1.4libraries,youmustuseJ2SE5.0(JDK1.5_0_08).Supportforthe ApacheAxis1.4bindingsisdeprecatedinvSphere5.0. Youcanuseotherclientsidetoolsandlibraries,suchasIBMWebSphereandseveralopensource implementations,[Link],onlytheJAXWSandAxisclientlibraries weretestedwiththisDevelopersSetupGuide. Thesamplesarchive([Link])[Link] clientsideproxycode(stubclasses)[Link] usingJAXWSweregeneratedusingJDK1.6b22.SamplesgeneratedusingApacheAxis1.4weregenerated usingJDK1.5_0_08.

Setup Instructions for Java Development


Specificsetupinstructionsdependonwhetheryourdevelopmentworkstationalreadymeetssomeorallofthe requirements,whichclientsideWebservicelibraryyouplantouse,andwhetheryouplantousetheprovided [Link] [Link],whichisthedefaultserver configuration.

VMware, Inc.

11

Developers Setup Guide

Setting Up for Development Using JAX-WS


[Link] [Link] sameversionoftheJDK. To set up a development workstation to use Java and JAX-WS 1 CreateadirectoryfortheJDK(assumingthattheJDKisnotinstalled)andforthevSphereWebServices [Link],toavoidissueswithsomeoftheincludedSDK batchandscriptfiles. InstalltheJava2Platform,StandardEdition(J2SE)6.0.VMwarerecommendsusingJDK1.6b22orlater. YoucanobtaintheJ2SEfrom[Link] ObtaintheVMwarevSphereWebServicesSDKpackagefromtheVMwareWebsite [Link] Unpackthecomponentsintosubdirectoriescreatedinstep1above,usingtheprovidedinstallerif [Link]. UnpackwithUsefoldernamesselected,tomaintaintheorganizationalstructure. OnUNIXdevelopmentsystems,usetheunzipcommandwiththeamodifier,toensureproper [Link]:
unzip -a [Link]

2 3 4

[Link] ServerCertificatesintotheJavaKeystoreonpage [Link],youcanignore servercertificateverificationforanyofthesampleJavaapplicationsbypassingthe--ignorecert argumentatruntime. [Link] rootpathoftheJavaRuntimeEnvironment(JRE),suchasC:\jre1.6_0\jre. Addtheprecompiledsamplefiles([Link])toyoursystemCLASSPATH [Link],[Link],the JAVAHOMEenvironmentvariablemustbedefined. IfyouarenotusingJDK1.6b22,[Link]([Link],onLinux)togeneratestubsand compilethesamplefiles([Link]).Thebuildscriptsperformallnecessarytasksfor you,[Link] CompilingClassesonpage 16fordetails.

6 7

[Link] ApplicationtoValidateSetuponpage 18fordetails.

Setting Up for Development Using Apache Axis


ThesamplesgeneratedusingApacheAxis1.4librariesandcompiledusingJavaJDK1.5_0_08include [Link],[Link],[Link],[Link] stubsandrecompilingifyouareusingthesesameversionsoftheJDKandAxis.

12

VMware, Inc.

Chapter 2 Setting Up for Java Development

To set up a development workstation to use Java and Apache Axis 1 Createdirectoriesforeachofthecomponentsthatyouwanttoinstall(assumingthatneitherJDKnorAxis clientisinstalled). Donotusespacesinthedirectorynames,toavoidissueswithsomeoftheincludedSDKbatchandscript [Link] 21listssomerecommendednamingconventions. Table 2-1. Recommended Directory Structures
Windows SDK Apache Axis Java 2, Standard Edition (J2SE) c:\devprojects\visdk21 c:\apache\axis c:\java\jdk1.5.0_nn c:\java\jre1.5.0_nn Linux ~\apps\visdk ~\apps\apache\axis ~\apps\java\jdk1.5.0_nn ~\apps\java\jre1.5.0_nn

InstalltheJava2Platform,StandardEdition(J2SE)5.0.VMwarerecommendsusingJDK1.5_0_08dueto improvedperformance(forJavasockets).YoucanobtaintheJ2SEfrom [Link] ObtaintheApacheAxis1.4clientsideWebserviceslibrariesfromtheApacheWebservicesWebsiteat [Link] ObtaintheVMwarevSphereWebServicesSDKpackagefromVMwareWebsite [Link] Unpackthevariouscomponentsintosubdirectoriescreatedinstep1above,usingtheprovidedinstaller [Link] directoryyouspecify. UnpackwithUsefoldernamesselected,tomaintaintheorganizationalstructure. OnUNIXdevelopmentsystems,usetheunzipcommandwiththeamodifier,toensureproper [Link]:
unzip -a [Link]

3 4 5

6 7 8

[Link] ServerCertificatesintotheJavaKeystoreonpage 15fordetails. (Optional)ToignoreservercertificateverificationforanyofthesampleJavaapplications,youcanpass the--ignorecert argumentatruntimeinsteadofimportingservercertificates. ConfigureenvironmentsettingsasdetailedinSettingEnvironmentVariablesforAxisDevelopmenton page [Link]([Link],[Link]),you mustsetonlyAXISHOME,JAVAHOME,VMKEYSTORE,andWBEMHOME. [Link]([Link],onLinux)[Link],[Link], [Link],[Link],includingsetting [Link] 16fordetails. NOTEIfyouareusingAxis1.4andJDK1.5,[Link],[Link], [Link],[Link],[Link],setthe AXISHOME,JAVAHOME,VMKEYSTORE,[Link]([Link]).

10

[Link] ApplicationtoValidateSetuponpage 18fordetails.

Setting Environment Variables for Axis Development


Theenvironmentvariabledefinitionssetdependonwhetheryouwanttousetheprovidedscripts ([Link],[Link];[Link],[Link]).Tousetheprovidedscripts,youmustsetfourenvironment variables:AXISHOME,JAVAHOME,VMKEYSTORE,[Link] 22fordetails.
VMware, Inc. 13

Developers Setup Guide

Ifyoudonotwanttousethescripts,youmustsetCLASSPATHandPATHenvironmentvariablessothatthey [Link] workstation,[Link] 22listsenvironmentvariablenames,directories,andfilenamesthat [Link]. To set environment variables required by the build and run scripts 1 CreateenvironmentvariablesforAXISHOME,JAVAHOME,SDKHOME,VMKEYSTORE,and WBEMHOME,asdefinedinTable 22. ForMicrosoftWindowsdevelopmentworkstations,youmustsetSystem(ratherthanUser) environmentvariables. ForLinuxdevelopmentworkstations,youmustexportthevariablesinyouruserprofile. 2 3 TotheSystemCLASSPATH,addthecompletepathtoallAxisclientsidelibraryJARsandadditional librariesprovidedwiththeSDKspecifiedinTable 22. TotheSystemPATHenvironmentvariable,addthepathtotheAxisandJavaruntimebinaries,as specifiedinTable 22.

Table 2-2. Environment Variable Names and Required JAR and Other Files
Variable Name AXISHOME CLASSPATH Setting must Include... [Link]: C:\apache\axis1.4 [Link] specificJARfilestotheCLASSPATH(assumesthatyouhavesetupAXISHOME,JAVAHOME, andSDKHOME). %AXISHOME%\lib\[Link] %AXISHOME%\lib\[Link] %AXISHOME%\lib\[Link] %AXISHOME%\lib\[Link] %AXISHOME%\lib\[Link] %AXISHOME%\lib\[Link] %AXISHOME%\lib\[Link] %AXISHOME%\lib\[Link] %JAVAHOME%\lib\[Link] %SDKHOME%\samples\Axis\java\[Link] %SDKHOME%\samples\Axis\java\[Link] %SDKHOME%\samples\Axis\java\[Link] %SDKHOME%\samples\Axis\java\[Link] %SDKHOME%\samples\Axis\java\lib\[Link] %SDKHOME%\samples\Axis\java\lib\[Link] %SDKHOME%\samples\Axis\java\lib\[Link] JAVAHOME PATH PathtotheJavaruntime(JRE)[Link]: C:\jre1.5_0_08\jre [Link] theAXISHOMEandJAVAHOMEvariables,youmustadd: %AXISHOME%\bin %JAVAHOME%\bin SDKHOME [Link]: C:\devprojects\visdk21\SDK\vsphere-ws\

14

VMware, Inc.

Chapter 2 Setting Up for Java Development

Table 2-2. Environment Variable Names and Required JAR and Other Files
Variable Name VMKEYSTORE Setting must Include... [Link] [Link]: VMKEYSTORE=C:\VMware-Certs\[Link][Windows] VMKEYSTORE=/root/vmware-certs/[Link][Linux] IfyouusetheignorecertargumenttorunanyJavasamples([Link] [Link] script),[Link](youdo notneedtoimportthecertificateorcreatetheactualkeystore,though,ifyouusetheignorecert argument). WBEMHOME [Link](Web BasedEnterpriseManagement)Javaarchive([Link]). WBEMHOME=%SDKHOME%\java\Axis\

Batch Files and Shell Scripts for Building and Running Samples
ThevSphereWebServicesSDKincludesseveralbatchfilesforWindowsandshellscriptsforLinuxthat facilitatebuildingandrunningthesampleapplications. NOTEIfyouareusingtheJAXWS2.1librarieswithJDK1.6b22(ortheAxis1.4librarieswithJDK1.5_0_08), youdonotneedtorebuildthesamples. [Link],[Link] [Link],beawareofthedependenciesamongthem. Table 2-3. Batch Files and Shell Scripts for Java [..\Axis\java\ Subdirectory]
Filename [Link] [Link] Description Checksforenvironmentvariables(AXISHOME, JAVAHOME,VMKEYSTORE,andWBEMHOME)and setslocalclasspath([Link])usingthe [Link] existingJavafiles([Link]). Usage note Usethisscripttogenerateclientstubs andrebuildallsampleapplications. [Link] [Link],[Link], [Link],[Link]. Usethewflagtorecompilewithout regeneratingstubs. [Link] [Link] [Link] [Link] [Link] [Link]. Batchfilethatenablesrunninganyofthesample [Link] truststoreandinvokestheJavaruntimewiththenameof theapplicationpassedasaparameter. Removesanyexistingartifactspriortobuildingthe samples,deletingJavaclassfilesinthesamplespackages [Link]. [Link]. UsethisscripttorunanyJavasample applications.

[Link]

[Link] codefiles.

Importing Server-Certificates into the Java Keystore


Thisstepisrequiredonlyifbothofthefollowingconditionsapplytoyourenvironment. Thetargetserversusethedefaultprotocol,HTTPS. Youdonotplantousethe--ignorecertcommandlineargument. Alternatively,touseHTTP(ratherthanHTTPS)andavoidtheuseofcertificatesentirely,followtheprocedure detailedinModifyingServerConfigurationstoSupportHTTPonpage [Link],usingHTTPisnot recommendedforproductionenvironments. TheseinstructionsrequirethattheJAVAHOMEenvironmentvariableissetandthatitisaddedtothePATH [Link] C:\[Link] 28.

VMware, Inc.

15

Developers Setup Guide

To import certificates into a local Java keystore 1 2 OpentheWindowscommandpromptorLinuxshellcommand. CreatethedirectoryfortheJavacertificatestore. [Link],[Link],iscreatedduringtheprocessof importingthecertificates,insubsequentsteps. Table 2-4. Keystore Path
Operating System Windows Linux Path C:\VMware-Certs\[Link] ~/vmware-certs/[Link]

[Link],onWindowsusethefollowingdirectory:
cd vmware-certs\vmware

[Link]:
keytool -import -file certificate-filename -alias server-name -keystore [Link]

Forexample:
C:\VMware-Certs>keytool -import -file [Link] -alias sdkpubs01 -keystore [Link]

Apromptrequestingapasswordforthekeystoreappears:
Enter keystore password:

[Link] [Link]:
Owner: OID.1.2.840.113549.1.9.2="1183400896,564d7761726520496e632e", CN=[Link], EMAILADDRESS=ssl-certificates@[Link], OU=VMware ESX Server Certificate, O="VMware, Inc.", L=Palo Alto, ST=California, C=US Issuer: OID.1.2.840.113549.1.9.2="1183400896,564d7761726520496e632e", CN=[Link], EMAILADDRESS=ssl-certificates@[Link], OU=VMware ESX Server Certificate, O="VMware, Inc.", L=Palo Alto, ST=California, C=US Serial number: 0 Valid from: Mon Jul 02 [Link] PDT 2007 until: Mon Aug 31 [Link] PDT 2026 Certificate fingerprints: MD5: . . .[Link] SHA1: 4C:...78:B2

Attheendofthecertificateinformation,apromptdisplaysarequestforconfirmationthatthecertificate istrusted:
Trust this certificate? [no]:

[Link] [Link]:
Certificate was added to keystore

Repeatthisprocessforeachtargetserver.

Generating Stubs and Compiling Classes


[Link] [Link]:onesetcreatedusingJDK1.6andtheJAXWSwebserviceslibraries,andonesetcreated usingJDK1.5_0_08andtheApacheAxis1.4libraries.

16

VMware, Inc.

Chapter 2 Setting Up for Java Development

Precompiled JAX-WS Samples


[Link] [Link]:
%SDKHOME%\java\JAX-WS\lib

IfyourdevelopmentenvironmentisusingtheJAXWSlibrariesandJDK1.6b22,youcanusethese [Link] SimpleClientSampleApplicationtoValidateSetuponpage 18.

Precompiled Axis Samples


[Link],[Link],[Link],[Link] usingAxis1.4andJDK1.5_0_08.Thesefilesarelocatedinthefollowingdirectory:
%SDKHOME%\java\Axis\

IfyourdevelopmentenvironmentincludesthesesameAxisandJavaversions,youcanusetheseprecompiled [Link] ApplicationtoValidateSetuponpage 18.

Using the Included Build Scripts


IfyourdevelopmentenvironmentusesdifferentversionsoftheJDKorclientsidelibrariesthantheonesused fortheprecompiledsamplefiles,youmustregeneratetheclientsideproxycode(stubs)andrecompilethem [Link]([Link])scriptincludedwiththeSDKperformsallnecessary tasksforyou. Youmustregeneratethestubsunderthefollowingconditions: [Link] includedbuildscripts,theJAVAHOMEenvironmentvariablemustbeset. YouareusingtheAxislibrariesandyouareusingJavaversionotherthanJDK1.5_0_08,oranAxisversion [Link],youmustsettheAXISHOME,JAVAHOME,and WBEMHOMEenvironmentvariables(seeSettingEnvironmentVariablesforAxisDevelopmenton page 13). To generate stubs and compile using the [Link] or [Link] script 1 2 Openacommandprompt. [Link],thisdirectoryis:
%SDKHOME%\java\JAX-WS\

ForAxis,thisdirectoryis:
%SDKHOME%\java\Axis\

VMware, Inc.

17

Developers Setup Guide

[Link]([Link])scriptbyenteringitsnameatthecommandprompt.
build

Theconsoledisplaysoutput,[Link],theprocess [Link],asshowninExample [Link] stubsfromwsdlmessageappearstwice,becausethisbuildfilegeneratesclientstubsusingbothsetsof WSDLdeclarations(foundin\vimand\vim25subdirectories). Example 2-1. Successful Stub Generation and Compilation Using [Link] Script
Generating stubs from wsdl Compiling stubs. ... Done. C:\devprojects\visdk21\SDK\vsphere-ws\java\Axis>

Whentheprocesscompletessuccessfully,[Link]. TocompilewithoutregeneratingthestubsfromtheWSDL,usethewflagwiththebuildscript,asfollows:
build -w

Youcanrunanyofthesampleapplicationsbyfollowingtheinstructionsinthenextsection,Runningthe SimpleClientSampleApplicationtoValidateSetup.

Running the SimpleClient Sample Application to Validate Setup


Youcanquicklytestyoursetupandconnectivitybyrunningoneofthesampleapplications,suchas [Link] inventoryentities,[Link]([Link]) script. IfyouareusingstubsgeneratedbyJAXWS,thesescriptsrequiretheJAVAHOMEenvironmentvariabletobe set.IfyouareusingstubsgeneratedbyAxis1.4,thescriptsrequireyoutosettheAXISHOME,JAVAHOME, VMKEYSTORE,andWBEMHOMEenvironmentvariables(seeTable 22).

Running a Sample Application Using the Provided Scripts


[Link],specifythe Javaclassforthesampleapplicationalongwiththeurl,username,andpasswordswitchesonthe [Link] [Link] appropriateJavasamplessubdirectoryforJAXWS(%SDKHOME%\java\JAXWS\com\vmware\samples\ general\SimpleClient)orAxis (%SDKHOME%\java\Axis\com\vmware\samples\general\ SimpleClient):
[Link] [Link] --url [Link] --username username --password password [--ignorecert ignorecert]

Example 22showssampleoutputfromtheSimpleClientsampleprogram.

18

VMware, Inc.

Chapter 2 Setting Up for Java Development

Example 2-2. Sample Output of a Successful Run of SimpleClient (Precompiled Java Sample)
Object Type : Folder Reference Value : ha-folder-vm Property Name : name Property Value : vm Object Type : HostSystem Reference Value : ha-host Property Name : name Property Value : [Link] Object Type : ResourcePool Reference Value : ha-root-pool Property Name : name Property Value : Resources Object Type : Folder Reference Value : ha-folder-host Property Name : name Property Value : host Object Type : ComputeResource Reference Value : ha-compute-res Property Name : name Property Value : [Link] Object Type : VirtualMachine Reference Value : 16 Property Name : name Property Value : Windows_2K3_VM ... Object Type : Datacenter Reference Value : ha-datacenter Property Name : name Property Value : ha-datacenter Object Type : Folder Reference Value : ha-folder-root Property Name : name Property Value : ha-folder-root

To run the precompiled SimpleClient from the command prompt 1 2 OpenaWindowscommandpromptorshellpromptonLinux. [Link],thissubdirectoryis:
cd %SDKHOME%\java\JAXWS\samples

ForAxissamples,thissubdirectoryis:
cd %SDKHOME%\java\Axis\samples

InvoketheJavaruntime,providingthefullpackagenameoftheSimpleClient,serverURN,credentials, andJavakeyStorelocation(orthe--ignorecertargument).Thecompletesyntaxisasfollows:
java -[Link]=keystore-path-or-%KEYSTORE%-environment-variable package-hierarchy-classname --url server-url --username username --password password [--ignorecert ignorecert]

Forexample:
java -[Link]=%VMKEYSTORE% [Link] --url [Link] --username pubs --password *** --ignorecert ignorecert

NOTEIferrormessagesareraisedduetosystemheaporothermemoryissues,youcangivetheJavaVM morememory,asfollows:
java -[Link]=%VMKEYSTORE% -Xms512M -Xmx1024M [Link] [Link] --username username --password password --ignorecert ignorecert

VMware, Inc.

19

Developers Setup Guide

Troubleshooting Setup Issues


IfyouareunabletosuccessfullyruntheSimpleClient,checkyourenvironmentsettingsandallothersetup [Link] 25listssomecommonerrormessagesandprovidesstepsthatyoucantaketoresolvethem. Table 2-5. Java Runtime Error Messages
Symptom Exception in thread "main" [Link]: com/vmware/vim/ManagedObjectReference at [Link] ServiceRef([Link]) at [Link](S [Link]) Caught Exception : Name : [Link] Message : (301)Moved Permanently Trace : AxisFault faultCode: {[Link] faultSubcode: faultString: (301)Moved Permanently faultActor: faultNode: faultDetail: {}:return code: 301 Possible Solution VerifythattheCLASSPATHincludesallAxislibraries, directlyorthroughuseoftheAXISHOME environmentvariable. VerifythattheAXISHOMEvariablehasbeenset correctly.

Afterverifyingthattheservercertificatehasbeen importedintothelocalkeystore,runthecommand usingHTTPSandprovidethecredentials(user account,password)fortheserver.

{[Link] (301)Moved Permanently at [Link] FromSocket([Link])

20

VMware, Inc.

Setting Up for Microsoft C# Development

Thischapterincludesthesetopics: Requirementsonpage 21 SetupInstructionsforC#Developmentonpage 22 [Link](C#)VersionofSimpleClientonpage 24 TroubleshootingSetupIssuesonpage 25

Requirements
ThevSphereWebServicesSDKincludesC#(.cs)sourcefilesandMicrosoftVisualStudioprojectfiles (solutions,[Link])[Link]#requires: DevelopmentenvironmentforC#,suchasMicrosoftVisualC#orMicrosoftVisualStudio. [Link],whichisincludedwithMicrosoftVisualStudio. [Link] includesthecommandlineC#compiler([Link]).

Environment Variable Settings


ThevSphereWebServicesSDK5.0includestwoversionsoftheWSDLfiles: WSDLfilesthatsupportvim25forusewithESXi5.0,ESX/ESXi4.1,ESX/ESXi4.0,vCenterServer4.1and 4.0,ESX3.5,[Link]\wsdl\vim25. [Link] directorysdk\wsdl\vim. [Link] batchfiles,youmustcreatetheenvironmentvariableWSDLFILEandsetittotheWSDLdirectory (%SDKHOME%\wsdl). ThevSphereWebServicesSDKdownloadcontainsbatchfilesforsettingupthesamplesforMicrosoftVisual [Link](.sln)files). IfyourMicrosoftsoftwaresetupvariesfromthedefaultpaths,youmustcreateaVSINSTALLDIR environmentvariableasdefinedinTable 31.

VMware, Inc.

21

Developers Setup Guide

Table 3-1. Environment Variable Names Required for Build Scripts


Variable Name VSINSTALLDIR Description LocationofMicrosoft...\Common7and ...\SDKsubdirectories. Usage Note Requiredonlyifyourdevelopmentsetupvariesfrom Microsoftdefaultinstallationpaths. Usequotationmarksaroundsubdirectorypathnamesthat [Link]: C:\devstuff\Microsoft Visual Studio 8\Common7 C:\devstuff\Microsoft Visual Studio 8\SDK WSDLFILE LocationoftheWSDLfiles. Setto%SDKHOME%\wsdlforusewithbuildscripts.

To set environment variables required by the build script 1 2 CreatetheenvironmentvariableWSDLFILE,asdefinedinTable [Link] environmentvariables. [Link],createand settheVSINSTALLDIRenvironmentvariableasdefinedinTable 31.

Setup Instructions for C# Development


Specificsetupinstructionsdependonwhetheryourdevelopmentworkstationalreadymeetssomeorallofthe requirementsandwhetheryouplantousetheprovidedsamples. To set up a development workstation to use C# 1 InstalltheMicrosoftVisualprogrammingenvironment,suchasMicrosoftVisualC#orMicrosoftVisual Studio. VMwarerecommendsusingMicrosoftVisualStudio2005orlater,[Link] Framework(2.0orlater)[Link],goto [Link] 2 3 4 [Link](ifyoudonotalreadyhaveit)fromMicrosoft,at [Link] ObtaintheVMwarevSphereWebServicesSDKpackagefromVMwareWebsiteat [Link] [Link] VisualStudio,[Link],[Link].

Toensurethatallpathstoalltools([Link],[Link])aresetcorrectly,executethecommandscriptfrom [Link],[Link].

Building the C# Samples


InthevSphereWebServicesSDK,VMwaresuppliessampleclientsforVisualStudio2005,2008,[Link] SDKincludesasolution(.sln)fileforeachversionofVisualStudio,[Link] [Link],[Link] [Link].

Building for a Chosen Version of Visual Studio


[Link] willcontaintheactualversion,whereastheprocedureshowsfilenamesthatcontaintheplaceholderstring 20xx.SubstituteyourVisualStudioversionwhereveryousee20xxinafilename. Forexample,ifyouplantoruntheDLLsintheVisualStudio2010environment,usetheswitch /out:VimService2010.dllinstep4and/p [Link] [Link].

22

VMware, Inc.

Chapter 3 Setting Up for Microsoft C# Development

Iterating the Build for Both Vim and Vim25 Namespaces


Inaddition,youmustdothesequenceofstep3throughstep8twice,substitutingtheactualvaluesVimand [Link] becausethesolutionfilesreferenceboththeoldandthenewAPInamespaces. Forexample,ifyouplantoruntheDLLsintheVisualStudio2010environment,usetheswitch/n:VimApiin step3and/out:VimService2010.dllinstep4thefirsttimethrough.Continuetostep8,makingthesame substitutionsintheothersteps.Returntostep3andrepeatuntilstep8,usingtheswitch/n:Vim25Apiinstep 3,/out:Vim25Service2010.dllinstep4,andsoon. To build the C# samples 1 [Link](fromtheWindowsStartmenu,select Programs>[Link]>[Link] launches. NavigatetotheDotNetsamplessubdirectory.
cd %SDKHOME%\samples\DotNet

[Link],[Link]:
[Link] /n:VimyyApi [Link] [Link]

[Link](thedefaultoutputfile)inthecurrentdirectory,usingtheVim ortheVim25namespace. 4 [Link].


csc /t:library /out:[Link] [Link]

Thiscommandgeneratesaserializerassembly(aDLL). 5 UsethesgentooltopregenerateandcompiletheXMLserializers.
sgen /p [Link]

[Link] DLLfilecontainspregeneratedXMLserializercode. [Link] example,bydefaultsgenissupposedtooutputoptimizednondebugcode,butthatisnotalwaysthe [Link],usethe/kflag,whichcausessgentokeepallitstemporary generatedfiles,includingthesourcefilesandcommandlineoptionfiles. 6 UsingthefindandreplacecapabilityinVisualStudiooryourfavoriteeditor,findthefollowingstring intheVimService.csfilethatyougeneratedinstep3.


[[Link]

Replaceitwith:
// [[Link]

[Link] [Link] pageformoredetailsonthisattribute: [Link] [Link],modifythereplacedstringtocommentitoutaccordingtothe syntaxofthatlanguage. 7 AnnotatetheVimServiceclassintheVimService.csfilethatyougeneratedinstep3,addingthe [Link] annotation:


[[Link](AssemblyName = "[Link]")]

VMware, Inc.

23

Developers Setup Guide

Youshouldendupwithsomethinglikethis:
// ... Some code here ... [[Link](AssemblyName = "[Link]")] public partial class VimService : [Link] { // ... More code here.

TheAssemblynameshouldbethenameoftheSerializerDLLgeneratedbythesgentoolinstep5. 8 [Link]:
csc /t:library /out:[Link] [Link]

[Link].

Running the Microsoft .NET (C#) Version of SimpleClient


TheseinstructionsassumethatyouhavefollowedallsetupinstructionsdetailedinSetupInstructionsforC# Developmentonpage 22. To run the SimpleClient application 1 [Link] theSDKdownload,thedirectoryisasfollows:
%SDKHOME%\samples\DotNet\cs\SimpleClient\bin\Debug

24

VMware, Inc.

Chapter 3 Setting Up for Microsoft C# Development

Runtheapplication,passingtothecommandlineurl,username,andpasswordswitchesalongwith [Link],theSimpleClientapplication([Link])requiresthatcredentials (useraccountandpassword)bepassedtotheexecutable,eveniftheserverisconfiguredtosupportHTTP. Youcanchangethesourcecodeyourselfandrecompile. Ifyoudonotprovideallthreeargumentsserveraddress,accountname,andpasswordtheexecutable [Link] lineswitchesasshownhere:


simpleclient --url [Link] --username useraccount -password password

[Link]:

[Link],the outputfromserverdisplaysintheconsole(commandprompt),asshowninExample 31: Example 3-1. Sample Output of a Successful Run of SimpleClient
Object Type : Datacenter Reference Value : ha-datacenter Property Name : name Property Value : ha-datacenter Object Type : Folder Reference Value : ha-folder-root Property Name : name Property Value : ha-folder-root

Troubleshooting Setup Issues


IfyouareunabletosuccessfullyruntheSimpleClient,checkyourenvironmentsettingsandallothersetup [Link] 32listssomecommonerrormessagesandprovidesstepsthatyoucantaketoresolve. Table 3-2. Microsoft C# Runtime Error Messages
Symptom [Link] [Link] <user> <pass> Caught Exception : Name : WebException Message : Unable to connect to the remote server Trace : at [Link]() at [Link].I nvoke(String methodName, Object[] parameters) at [Link](ManagedObject Reference _this) ... Exception disconnecting. Caught Exception : Name : NullReferenceException Message : Object reference not set to an instance of an object. Trace: ... Possible Solution [Link] [Link] onthesamesubnetastheclient.

VMware, Inc.

25

Developers Setup Guide

26

VMware, Inc.

Appendix: vSphere Server Certificates

Thisappendixincludesthesetopics: SecureClientServerCommunicationsonpage 27 SimplifiedSecuritySetupforDevelopmentEnvironmentonpage 27 ObtainingServerCertificatesonpage 28 ModifyingServerConfigurationstoSupportHTTPonpage 29

Secure Client-Server Communications


[Link],bydefault,ESX, ESXi,andvCenterServerareconfiguredforHTTPSandsupportSSLtoencryptcommunications. ToconnecttotheserverusingHTTPS,clientapplicationsmustverifytheidentifyoftheserverbyusingthe [Link],sothat [Link] 28formoreinformation. ToconnecttotheserverusingHTTPrequiresthatyoufirstmodifythetargetserversdefaultconfigurationso [Link],youdonotneedto [Link] SupportHTTPonpage [Link] tothevSphereAPIisrecommendedfortestordevelopmentenvironmentsonly,notforproduction [Link],HTTPS,forproductiondeployments.

Simplified Security Setup for Development Environment


JavadeveloperscanusetheSunFakeTrustSocketFactoryclasstoignoretheservercertificateverification [Link] anoptionalcommandlineargument,--[Link] [Link] clientpackage. Ifyouplantousethe--ignorecertoptionorusethisautomaticservercertificateverificationtechniquein yourowncode,[Link] page 11formoreinformation. [Link] awarethatbynotverifyingtheservercertificateduringtheSSLhandshake,theclientapplicationissubjectto maninthemiddleattacks.

VMware, Inc.

27

Developers Setup Guide

Obtaining Server Certificates


VMwareproductsusestandardX.509version3(X.509v3)certificatestoencryptsessioninformationsentover SSL(securesocketslayer)[Link] anSSLsessionwiththeserver,theserversendsitscertificatetotheclientapplication,whichcheckstheX.509 certificateagainstalistofknownCertificateAuthorities(CAs)[Link] clientthenusestheserverspublickey(containedintheX.509certificate)togeneratearandomsymmetrickey, whichitusestoencryptallsubsequentcommunications. TheservercertificatesarecreatedautomaticallyduringtheprocessofinstallingVMwareproducts,including ESX,ESXi,[Link],thecertificatenamematchestheDNSname [Link],[Link] signedbyanofficialrootCA,youmustobtaintheservercertificatefromeachserverthatyouplantotarget withyourclientapplicationandstoreitlocally. Forexample,ifyouarecreatingaclientapplicationtorunagainstthevCenterServerandanESXsystem directly(instandalonemode),[Link] theotherhand,ifyourapplicationisaimedsolelyatthevCenterServerthatmightmanageanynumberofESX systems,youmustobtainthecertificateonlyfromthevCenterServer. Youcanobtainthecertificatesinoneoftwogeneralways: DevelopersworkingontheMicrosoftWindowsplatformcanusethecertificatehandlingcapabilitiesof thevSphereClientfromthedevelopmentworkstationtoconnecttoeachESX,ESXi,orvCenterServerand [Link] thevSphereClientonpage 28. Developerswithaccessprivilegesonthetargetserversystemscanuseasecureshellclientutility(SCP, WinSCP,orSSH)toconnectdirectlytotheESX,ESXi,orvCenterServerandcopythecertificatesdirectly [Link] Systemsonpage 29fordetails.

Obtaining Certificates by Using the vSphere Client


[Link] leveragesthenativeMicrosoftcredentialhandlingmechanismstoallowyoutoacceptthecertificateand exportitasalocalfile. To obtain server certificates using vSphere Client 1 CreateadirectorynamedVMware-Certs(attherootlevel)[Link] ServicesSDKbatchfilesassumethispathasthelocationofthekeystoreandfailifyoudonotusethispath.
C:\VMware-Certs

2 3

InstallthevSphereClientonthedevelopmentworkstationifnecessary. LaunchthevSphereClientandthennavigatetotheESX,ESXi,orvCenterServerwebserver. ASecurityWarningmessageboxdisplaysregardingthecertifyingauthorityforthecertificate.

4 5 6 7 8 9

ClickViewCertificatetodisplaytheCertificatepropertiespage. ClicktheDetailstab. ClickCopytoFile...tolaunchtheCertificateExportwizard. SelectDERencodedbinaryX.509 (thedefault)andclickNext. ClickBrowse...andnavigatetotheC:\VMware-Certssubdirectory. Enteranameforthecertificatethatidentifiestheservertowhichitbelongs.


C:\VMware-Certs\<servername>.cer

28

VMware, Inc.

Appendix: vSphere Server Certificates

Afterobtainingthecertificatefromeachtargetserver,followtheothersetupstepsappropriateforyour [Link]#developers,seeSetupInstructionsforC#Developmentonpage [Link] developers,seeSetupInstructionsforJavaDevelopmentonpage 11.

Obtaining Certificates by Connecting Directly to Server Systems


Thisapproachcanbeusedbydeveloperswhohaveappropriateprivilegestodirectlyconnecttothetarget [Link],andassumethatyou canaccessthenecessarysubdirectory. To obtain server certificates using secure shell client application 1 Fromthedevelopmentworkstation,createadirectoryinwhichtostorecertificatesofserversthatyou wanttotargetduringdevelopment:
~\vmware-certs\

[Link] theESXserviceconsoleasrootareeffectivelydisabled,soyoumustconnectasanotheruserwith privilegesontheservertoobtainthecertificate. TheservercertificatefilenamesandlocationsofESXandvCenterServerarelistedinthefollowingtable.


Server ESX5.0 vCenterServer5.0 Directory Location for Certificate /etc/vmware/ssl/ C:\Documents and Settings\All Users\Application Data\VMware\VMware VirtualCenter\SSL\ Certificate [Link] [Link]

Copythecertificatesfromtheservertothecertificatesubdirectoryofthedevelopmentworkstation,using auniquefilenameforthecertificate(assumingyouarecopyingmultipledefaultcertificatesfrommultiple ESXsystems,forexample). Importtheservercertificateintothecertificatestorefollowingthespecificinstructionsforyour programminglanguage(Java,C#).SeeSettingUpforJavaDevelopmentonpage 11.

Modifying Server Configurations to Support HTTP


ESX,ESXi,andvCenterServersupportthevSphereAPIthroughtheirrespectiveWebservices(SOAP) [Link],theseWebservicesrunonport443,asasecureWebservicethatcanbeaccessedusingSSL overHTTP(HTTPS).However,foradevelopmentenvironment,youmaywanttosimplifytheconnection processfromaclientapplicationbyconfiguringthetargetserverstosupportregular(nonSSL)HTTP. [Link] handlesrequeststotheAPI(throughthe/sdkpath)andtotheManagedObjectBrowser(pathis/mob).The reverseproxyservicehasaconfigurationfile,[Link],whichcanbemodifiedtospecifysupportforHTTP astheprotocolfortheWebservice.(Figure [Link] HTTPforboththeMOBandtheSDK.) To modify the Web proxy service on ESX to support HTTP 1 2 3 4 Logintotheserviceconsoleastherootuser. Changedirectoriesto/etc/vmware/hostd. [Link]. Navigatetothelistofendpointsinthefile(identifiedbythe<EndpointList>tag)thatcontainssettingsfor [Link]:
... <e id=1> <_type>[Link]</_type> <accessMode>httpsWithRedirect</accessMode>

VMware, Inc.

29

Developers Setup Guide

<pipeName>/var/run/vmware/proxy-sdk</pipeName> <serverNamespace>/sdk</serverNamespace> </e> ...

5 6 7 8

[Link],tocompletelydisableHTTPS,youcansetto httpOnly. (Optional)ChangethesettingfortheMOBaswell. Saveyoursettingsandclosethefile. Restartthevmware-hostdprocessbyenteringthefollowingcommand:


service mgmt-vmware restart

Example A-1. Edited [Link] File


<config> <EndpointList> <_length>7</_length> <_type>[Link][]</_type> <e id=0> <_type>[Link]</_type> <serverNamespace>/</serverNamespace> <accessMode>httpsWithRedirect</accessMode> <pipeName>\\.\pipe\vmware-vpxd-webserver-pipe</pipeName> </e> <e id=1> <_type>[Link]</_type> <serverNamespace>/sdk</serverNamespace> <accessMode>httpAndHttps</accessMode> <port>8085</port> </e> <e id=2> <_type>[Link]</_type> <serverNamespace>/ui</serverNamespace> <accessMode>httpsWithRedirect</accessMode> <port>8086</port> </e> <e id=3> <_type>[Link]</_type> <serverNamespace>/mob</serverNamespace> <accessMode>httpAndHttps</accessMode> <pipeName>\\.\pipe\vmware-vpxd-mob-pipe</pipeName> </e> <e id=4> <_type>[Link]</_type> <serverNamespace>/vod</serverNamespace> <accessMode>httpsWithRedirect</accessMode> <pipeName>\\.\pipe\vmware-vpxd-webserver-pipe</pipeName> </e>

To modify the Web proxy service on ESXi to support HTTP BecauseESXihasnoServiceConsole,youcannotusethesameprocessdescribedinTomodifytheWebproxy serviceonESXtosupportHTTPonpage [Link],youmustusetheappropriatevSphereCLIcommand [Link],modifythefiletosupportHTTP,andthenmovethefilebackto [Link]. To modify the Web proxy service on vCenter Server to support HTTP 1 2 LogintothevCenterServersystemastheWindowsAdministratorofthemachine. [Link]:
c:\Documents and Settings\AllUsers\Application Data\VMware VirtualCenter

3
30

[Link].
VMware, Inc.

Appendix: vSphere Server Certificates

4 5 6

Findthesectionofthefileassociatedwiththe/sdk. ChangetheaccessModetohttpAndHttps. RestarttheservicefromacommandlineorfromtheWindowsServicescontrolpanel.

VMware, Inc.

31

Developers Setup Guide

32

VMware, Inc.

Index

A
Apache Axis, generating stubs 16 API 7 AXISHOME 14

V
VMKEYSTORE 15 VSINSTALLDIR 22 vSphere SDK Package 9 vSphere SDK package, WSDL files 9

C
C# requirements 21 CLASSPATH 14

W
WBEMHOME 15 WSDL (web services description language), defined 7 WSDL files 9 WSDLFILE 22

E
environment variables C# 22 Java 13, 14, 15 error message, not implemented 10

H
http protocol, configuring 29

J
JAVAHOME 14

M
Microsoft .NET requirements 21 Microsoft Visual Studio 2005 22

N
non-SSL, configuring server for HTTP 29

O
operations 7

P
PATH 14

R
Requirements C# development 21 Java development 11

S
[Link] 9 SDKHOME 14 SOAP toolkits 8 SOAP, defined 7

T
technical support resources 6

VMware, Inc.

33

Developers Setup Guide

34

VMware, Inc.

You might also like