惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Tailwind CSS Blog
C
CERT Recently Published Vulnerability Notes
P
Proofpoint News Feed
Vercel News
Vercel News
博客园 - 三生石上(FineUI控件)
IT之家
IT之家
Help Net Security
Help Net Security
月光博客
月光博客
N
News and Events Feed by Topic
Cloudbric
Cloudbric
博客园 - 司徒正美
L
LangChain Blog
Recent Commits to openclaw:main
Recent Commits to openclaw:main
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
T
Tenable Blog
The Register - Security
The Register - Security
The Hacker News
The Hacker News
I
InfoQ
The Last Watchdog
The Last Watchdog
MyScale Blog
MyScale Blog
Schneier on Security
Schneier on Security
WordPress大学
WordPress大学
小众软件
小众软件
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
宝玉的分享
宝玉的分享
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
K
Kaspersky official blog
L
LINUX DO - 热门话题
N
News | PayPal Newsroom
F
Fortinet All Blogs
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
S
Security @ Cisco Blogs
Recorded Future
Recorded Future
大猫的无限游戏
大猫的无限游戏
H
Help Net Security
Google Online Security Blog
Google Online Security Blog
S
Schneier on Security
C
Cisco Blogs
N
News and Events Feed by Topic
V2EX - 技术
V2EX - 技术
Latest news
Latest news
PCI Perspectives
PCI Perspectives
T
The Blog of Author Tim Ferriss
P
Palo Alto Networks Blog
T
Tor Project blog
Project Zero
Project Zero
云风的 BLOG
云风的 BLOG
Webroot Blog
Webroot Blog
Attack and Defense Labs
Attack and Defense Labs
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org

博客园 - wishma

SOAR平台初探(一) Logstash和Flume-NG Syslog接收小测试 Elasticsearch 填坑记 IBM TBSM 业务关联规则配置一例 免费实用微软系统工具集推荐(转) Netcool/OMNIbus Probe脚本编写例子(1) VMware vSphere开发(2)配置VMware vSphere Web Services SDK的开发环境 数字电视业务PSI/SI学习系列(转) SMI-S存储管理协议资料 strus2格式化数字和日期(转) - wishma - 博客园 IPhone数据库操作代码例子 NSDate常用代码范例 64位windows7连接网络共享打印机的问题 IPhone 视图切换的的2种方法 我的D630,安装MAC经历 Eclipse快捷键大全(转贴) (转贴)JIRA安装和破解,随便看看吧 CentOS上安装Tomcat,切换JDK的方法 哥不是间谍,哥只是在找信号!(转贴有意思)
VMware vSphere开发(1)安装配置VMware vSphere Web Services SDK的运行环境
wishma · 2011-06-27 · via 博客园 - wishma


  转发   

VMware vSphere开发(1)安装配置VMware vSphere Web Services SDK的运行环境
2010-03-12 14:28
作者:飞哥 (http://hi.baidu.com/imlidapeng)

一、准备

使用VMware vSphere Web Services SDK开发Java Web-service客户端应用,需要使用到java SDK和Java Web Service开发工具,如下:

1.所需软件

VMware vSphere Web Services SDK

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

J2SE 1.5.x或者J2SE 1.4.x。VMware推荐使用J2SE 1.5.0_08或以后。

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

Apache Axis 1.4

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

2.SDK内容介绍

a.目录介绍

\doc:vSphere API参考手册、java例子的javadoc。

\samples\Axis:使用Axix实现的java版例子代码。

\samples\DotNet:使用C#实现的例子代码

\sms:Storage Management Server SDK。在vCenter Server 4.0中有一个名叫Storage Management Service (SMS)的服务,通过此服务提供之API可获得vCenter所有存储的相关信息。
\wsdl:SDK API相关webservice的描述文件。

b.java版中batch文件及shell脚本说明

build.bat/build.sh:检查环境变量(AXISHOME、JAVAHOME、VMKEYSTORE、WEBMHOME);设置本地classpath(通过调用lcp.bat);清除已经存在的java相关文件(通过调用clean.bat),如class文件或jar文件。

这个脚本文件将产生客户端stub及重新编译所有的例子程序。如果脚本成功执行后,将产生vim.jar、vim25.jar、apputil.jar、credstore.jar、samples.jar。使用-w可以在重新编译过程中不产生stub。

lcp.bat/lcp.sh:设置本地classpath。被build.bat和run.bat调用。

run.bat/run.sh:用来运行例子。

clean.bat/clean.sh:清除已经存在的java相关文件,如class文件或jar文件。

二、配置Java环境

在vSphere Web Services SDK中包含vim.jar、vim25.jar、apputils.jar、credstore.jar以及samples.jar,这些jar文件是由Apache Axis 1.4和Java JDK 1.5编译完成的。如果你不需要重新编译和产生stub,可以直接在应用中使用这些VMware预先编译好的jar文件。

1.建立相关目录

分别为VMware vSphere Web Services SDK、Apache Axis和J2SE建立相应的目录(目录的名字中最好不要含有空格)

推荐的目录名称

                      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.安装相关软件

将VMware vSphere Web Services SDK和Apache Axis解压缩到之前建立好的目录中,安装J2SE到之前建立好的目录中。

3.导入服务器证书


登录ESX Server,拷贝/etc/vmware/ssl/rui.crt至C:\VMware-Certs。

使用keytool工具导入证书,用法如下:keytool -import -file <certificate-filename> -alias <server-name> -keystore vmware.keystore

例如:C:\VMware-Certs>keytool -import -file rui.crt -alias sdkpubs01 -keystore vmware.keystore

在运行时也可以使用--ignorecert参数忽略服务器证书验证,但不建议在生产环境中使用。

4.配置相关环境变量

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.测试环境是否配置成功。

使用run.bat测试例子是否可以正常运行。

语法如下:run com.vmware.samples.general.SimpleClient --url https://yourFQDNservername/sdk --username <username> --password <password> [--ignorecert ignorecert]

例如:run com.vmware.samples.general.SimpleClient --url
https://sdkpubslab-01.eng.vmware.com/sdk --username pubs --password *** --ignorecert ignorecert

如果成功执行,可获得如下的类似输出:

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

至此,你已经成功安装配置了VMware vSphere Web Services SDK的运行环境。