imported schema (urn:reflect) at (https://xx.xx.x.x/sdk/reflect-messagetypes.xsd), failed 解決方法

最近因爲工作的原因要調用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\

意思是說,讓你下VMware-vSphere-SDK-5.0.0-429209 這個sdk 包,在對應的目錄下有相關的文件,所以我將這個目錄下的 reflect-types.xsd 和reflect-messagetypes.xsd copy 到vcenter sdk 目錄的,一般這個目錄在/etc/vmware-vpx/docRoot/sdk

祝你成功

發佈了24 篇原創文章 · 獲贊 3 · 訪問量 6萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章