Go to: vm-sdk-java install development environment

vSphere Web Services SDK Installation
Category: Virtualization & Cloud Computing 2013-03-22 02:48 479 people read comments (0) Collection report
 The VMware vSphere Web Services SDK includes all the components necessary to work with the VMware vSphere API, including WSDL files, sample code, and libraries. The vSphere Web Services SDK facilitates development of client applications that target the VMware vSphere API. With the vSphere Web Services SDK, developers can create client applications to manage, monitor, and maintain VMware vSphere components, as deployed on VMware®VMware vSphere®ESX®, ESXi™, and VMware® vCenter™ Server systems.
This is the official introduction to the vSphere Web Services SDK. In short, it provides the program interface for managing vcenter and ESXi. Currently, it supports JAVA and .NET platforms. The following takes the Windows 7 platform as an example to introduce the deployment process of the JAVA development environment.
1. Preparation of the development environment
1. Install JAVA development environment J2SE 1.6 b22
http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase6-419409.html#jdk-6u22-oth-JPR
Install it to c:\java, do not install it to C:\program files, there are spaces in the directory, and an error will be reported when executing the script
 
2. Install the SOAP tool JAX-WS2.1
http://jax-ws.java.net/2.1.1/index.html
Double click to install
 
3. Download vSphere Web Services SDK 5.1
http://communities.vmware.com/community/vmtn/developer/downloads
Unzip to c:\devprojects
 
Second, the development environment configuration
1. Set system variables
JAVA_HOME=C:\java\jdk1.6.0_22
JAVAHOME=C:\java\jdk1.6.0_22
SDKHOME=C:\devprojects
VMKEYSTORE=C:\VMware-Certs\vmware.keystore (the installation process will be described later)
WEBHOME=C:\devprojects\vsphere-ws\java\Axis\lib\wbem.jar
WS_SDK_HOME=C:\devprojects\SDK\vsphere-ws
CLASSPATH=.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;C:\devprojects\SDK\vsphere-ws\java\JAXWS\lib\samples.jar;C:\devprojects\ SDK\vsphere-ws\java\JAXWS\lib\vim25.jar (this variable is very important)
 
2. Server Authentication
2.1. Import the certificate of ESX Server or Vcenter into the machine, the certificate of ESXi is in /etc/vmware/ssl/rui.crt; the certificate of Vcenter is in C: /Documents and Settings/All Users/Application Data/VMware/VMware VitualCenter/ SSL/rui.crt
2.2. Copy the certificate to the C:/VMware-Certs directory of the local machine, open the command line interface of windows7, switch to the C:/VMware-Certs directory, and use the jdk keytool tool to import the certificate:
keytool -import -file <certificate-filename> -alias <server-name> -keystore vmware.keystore
The certificate-filename is rui.crt, and the service-name can be the machine name or IP address of the server. After successful operation, the vmware.keystore file will be generated in the C:/VMware-Certs directory.
 
3. Recompile JAX-WS
If your installed version is not JDK 1.6 b22 or SOAP is not using JAX-WS2.1, you need to recompile
Open CMD and switch to C:\devprojects\SDK\vsphere-ws\java\JAXWS\
run build.bat
It will appear if the operation is successful
Generating stubs from wsdl
 
Compiling stubs.
...
Done
 
3. Run a simple client-side script to verify that the installation was successful
 
Open CMD and switch to C:\devprojects\SDK\vsphere-ws\java\JAXWS\
 
run.bat com.vmware.general.SimpleClient --urlhttps://yourFQDNservername/sdk --username username --password password, the following output indicates that the SDK is configured successfully
 
 

 
4. Error debugging
1. If there is an error that the class cannot be found, ClassNotFoundException:........, you can do this
 
Open CMD and switch to C:\devprojects\SDK\vsphere-ws\java\JAXWS\
 
java -Djavax.net.ssl.trustStore=%VMKEYSTORE% com.vmware.general.SimpleClient--url https://example.com/sdk --username pubs --password ***
 
2. If it prompts that the memory of the JAVA virtual machine is not enough, you can do this
 
java -Djavax.net.ssl.trustStore=%VMKEYSTORE% -Xms 512M -XMx1024M com.vmware.general.SimpleClient--url https://example.com/sdk --username pubs --password ***

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326644238&siteId=291194637