最近因为工作的原因要调用vmware 服务器自带的web service 功能,测试连接时一切正常,但当把连接指向vcenter 后就报如下错误
No handlers could be found for logger "suds.xsd.sxbasic"
Traceback (most recent call last):
File "D:\WorkFile\pythonpro\vfos3.0\test\psphereTest.py", line 5, in <module>
client = Client("xx.xx.x.x","root","vmware",wsdl_location="remote")
File "D:\Python27\lib\site-packages\psphere-0.5.1-py2.7.egg\psphere\client.py", line 93, in __init__
suds.client.Client.__init__(self, wsdl_uri)
File "build\bdist.win-amd64\egg\suds\client.py", line 112, in __init__
File "build\bdist.win-amd64\egg\suds\reader.py", line 152, in open
File "build\bdist.win-amd64\egg\suds\wsdl.py", line 157, in __init__
File "build\bdist.win-amd64\egg\suds\wsdl.py", line 202, in open_imports
File "build\bdist.win-amd64\egg\suds\wsdl.py", line 314, in load
File "build\bdist.win-amd64\egg\suds\wsdl.py", line 159, in __init__
File "build\bdist.win-amd64\egg\suds\wsdl.py", line 220, in build_schema
File "build\bdist.win-amd64\egg\suds\xsd\schema.py", line 93, in load
File "build\bdist.win-amd64\egg\suds\xsd\schema.py", line 305, in open_imports
File "build\bdist.win-amd64\egg\suds\xsd\sxbasic.py", line 542, in open
File "build\bdist.win-amd64\egg\suds\xsd\sxbasic.py", line 567, in download
Exception: imported schema (urn:reflect) at (https://xx.xx.x.x/sdk/reflect-messagetypes.xsd), failed
几经网上寻找,终于在网上的某国外论坛看到相关的信息,说是因为默认的webservic 服务中没有相关的格式文档,以下引用官方原文
vSphere 5.0 Server WSDL files obtained directly from a Server are not complete.
It is possible to retrieve the vSphere API WSDL files from an ESXi or vCenter Server. These WSDL files are not complete. You cannot use the server-based WSDL; SOAP toolkits cannot process it correctly because the Server does not have a complete set of the schema files. The vSphere Web Services SDK contains a complete WSDL file configuration (WSDL and schema files), located in the following directory of the vSphere Management SDK distribution:
VMware-vSphere-SDK-5.0.0-429209\SDK\vsphere-ws\wsdl\vim25\
祝你成功