lost and found ( for me ? )

ESX 5 : how to use API over http instead of https

By default , SDK port is tcp 443 ( https://vcenter IP/sdk )
Here’s an explanation of how to enable both http and https access.
When evaluating SDK , it is useful to use http instead of https to debug.

1.
access to the vCenter server

2.

go to <Drive name>:\Documents and Settings\All Users\Application Data\VMware\VMware VirtualCenter” directory

3.
edit proxy.xml file.

from

   <e id="9">
     <_type>vim.ProxyService.LocalServiceSpec</_type>
     <accessMode>httpsWithRedirect</accessMode>
     <port>8085</port>
     <serverNamespace>/sdk</serverNamespace>
   </e>


to
   <e id="9">
     <_type>vim.ProxyService.LocalServiceSpec</_type>
     <accessMode>httpAndHttps</accessMode>
     <port>8085</port>
     <serverNamespace>/sdk</serverNamespace>
   </e>


4.
restart vCenter service

5. access to http://vCenter IP/sdk

over http
root@ubuntu1204-vm1:~# python
Python 2.7.3 (default, Aug  1 2012, 05:14:39)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from pysphere import VIServer
>>> server = VIServer()
>>> server.connect("http://1.1.1.10/sdk","username",".password.")
>>> server.get_server_type()
'VMware vCenter Server'
>>> server.get_api_version()
'5.1'
>>> server.disconnect


over https
>>> server.connect("http://1.1.1.10/sdk","username",".password.")
>>> server.get_server_type()
'VMware vCenter Server'
>>> server.disconnect

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.