VMware vsphere development (1) install and configure the running environment of the VMware vsphere Web Services SDK

Source: Internet
Author: User

 

 

 

Forwarding

VMware vsphere development (1) install and configure the running environment of the VMware vsphere Web Services SDK

Author: fliggy (http://hi.baidu.com/imlidapeng)

I. Preparation

To use the VMware vsphere Web Services SDK to develop Java Web-service client applications, you must use the Java SDK and Java Web service development tools as follows:

1. Required Software

VMware vsphere Web Services SDK

Http://www.vmware.com/support/developer/vc-sdk/

J2se 1.5.x or j2se 1.4.x. VMware recommends j2se 1.5.0 _ 08 or later.

Http://java.sun.com/javase/downloads/previous.jsp

Apache axis 1.4

Http://ws.apache.org/axis/java/releases.html

2. SDK content

A. Directory Introduction

\ Doc: javadoc of the vsphere api reference manual and Java example.

\ Samples \ axis: The Example code of the Java version implemented by axix.

\ Samples \ DOTNET: Sample Code implemented using C #

\ SMS: Storage Management Server SDK. In vcenter Server 4.0, there is a service named Storage Management Service (SMS) that provides APIs to obtain information about all vcenter storage.
\ WSDL: The description file of the sdk api-related WebService.

B. Description of batch files and shell scripts in Java

Build. BAT/build. SH: Check the environment variables (axishome, javahome, vmkeystore, webmhome); set the local classpath (by calling LCP. BAT); clear existing Java-related files (by calling clean. BAT), such as a class or jar file.

This script file will generate the client stub and recompile all the example programs. If the script is successfully executed, Vim. jar, vim25.jar, apputil. jar, credstore. jar, and samples. jar are generated. You can use-W to re-compile without generating stub.

LCP. BAT/LCP. sh: set local classpath. Called by build. BAT and run. bat.

Run. BAT/run. sh: used to run the example.

Clean. BAT/clean. sh: clear existing Java-related files, such as class files or jar files.

2. Configure the Java environment

The vsphere Web Services SDK contains vim. jar, vim25.jar, and apputils. jar, credstore. jar and samples. jar. These jar files are compiled by Apache axis 1.4 and Java JDK 1.5. If you do not need to re-compile and generate stub, you can directly use these pre-compiled jar files from VMware in the application.

1. Create related directories

Create a directory for the VMware vsphere Web Services SDK, Apache axis, and j2se respectively (the directory name should not contain spaces)

Recommended directory name

Windows Linux
SDK c: \ devprojects \ visdk21 ~ \ Apps \ visdk
Apache axis c: \ apache \ axis ~ \ Apps \ apache \ axis
J2se c: \ Java \ jdk1.5.0 _ nn ~ \ Apps \ Java \ jdk1.5.0 _ nn
C: \ Java \ jre1.5.0 _ nn ~ \ Apps \ Java \ jre1.5.0 _ nn
2. Install related software

Decompress the VMware vsphere Web Services SDK and Apache axis to the Created directory and install j2se to the Created directory.

3. Import the server certificate

Log on to the ESX Server and copy/etc/vmware/SSL/Rui. CRT to c: \ VMware-Certs.

Use keytool to import certificates. The usage is as follows: keytool-import-file <Certificate-FILENAME>-alias <server-Name>-keystore VMware. keystore

Example: C: \ VMware-Certs> keytool-import-file Rui. CRT-alias sdkpubs01-keystore VMware. keystore

You can also use the -- ignorecert parameter to ignore server certificate verification during runtime, but it is not recommended to use it in the production environment.

4. Configure related environment variables

Axishome = c: \ apache \ axis1.4
Javahome = c: \ Java \ jdk1.5.0 _ 21
Vmkeystore = c: \ VMware-Certs \ VMware. keystore
Wbemhome = c: \ devprojects \ visdk21 \ SDK \ samples \ axis \ Java \ Lib \ WBEM. Jar

5. test whether the environment is configured successfully.

Run. BAT to test whether the example can run normally.

Syntax: run com. VMware. samples. General. simpleclient -- URL https: // yourfqdnservername/SDK -- username <username> -- password <password> [-- ignorecert]

Example: run com. VMware. samples. General. simpleclient -- URL
Https://sdkpubslab-01.eng.vmware.com/sdk -- username pubs -- password *** -- ignorecert

If the execution is successful, the following similar output can be obtained:

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: sdkpubslab-02.eng.vmware.com
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: sdkpubslab-02.eng.vmware.com
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

Now, you have successfully installed and configured the running environment of the VMware vsphere Web Services SDK.
 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.