vmware / vmware/pyvmomi

pyVmomi.VmomiSupport.UnknownWsdlTypeError: 'PbmProfileQueryProfileResultInternal'

Open
#464 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
Python
Stars
2.3k
Forks
763
PR merge metrics
No merged PRs in 30d

Description

Sample code :

1 from pyVim.connect import SmartConnect, VimSessionOrientedStub, Disconnect
2 from pyVmomi import EamObjects, PbmObjects, VmomiSupport, SoapStubAdapter, pbm, vim, vmodl
3 import atexit
4 import re
5 import ssl
6 from config import CONFIG
7
8 def main():
9 si = None
10 try:
11 key = CONFIG['vAppKey']
12 cert_file = CONFIG['CertPath']
13 key_file = CONFIG['KeyPath']
14
15 stub = SoapStubAdapter(version='vim.version.version10',
16 certFile=cert_file,
17 certKeyFile=key_file,
18 httpProxyHost="xxx.yyy.com",
19 url='https://sdkTunnel:8089/sdk/vimService')
20
21 sessionStub = VimSessionOrientedStub(stub, VimSessionOrientedStub.makeExtensionLoginMethod(key))
22
23 si = vim.ServiceInstance("ServiceInstance", sessionStub)
24 content=si.content
25 pyvmomi_cookie = re.sub('vmware_soap_session=', '', si._stub.soapStub.cookie)
26 header = {'vcSessionCookie': pyvmomi_cookie}
27
28 sslContext = ssl._create_unverified_context()
29 pbmstub = SoapStubAdapter(host="xxx.yyy.com",
30 port=443,
31 version="pbm.version.version2",
32 path="/pbm/sdk",
33 requestContext=header,
34 sslContext=sslContext)
35
36 pbmstub.cookie = pyvmomi_cookie
37 pbmsi = pbm.PbmServiceInstance("ServiceInstance", pbmstub)
38 pbmcontent = pbmsi.PbmRetrieveServiceContent()
39 profileMgr = pbmcontent.profileManager
40 resType = profileMgr.FetchResourceType()
41
42 for resId in range(len(resType)):
43 pbmProfileIds = profileMgr.QueryProfile(resType[resId])
44
45 for profId in range(len(pbmProfileIds)):
46 entity = profileMgr.QueryAssociatedEntity(pbmProfileIds[profId])
47 if len(entity) == 0:
48 continue
49
50 print("========= ENTITY ========")
51 print(entity)
52 print("=========")
53 print("Get profile for EACH entity")
54 for entityId in range(len(entity)):
55 print("========= entity[%d] ========" % (entityId))
56 profileResult = profileMgr.QueryAssociatedProfile(entity[entityId])
57 print(profileResult)
58 print("=========")
59
60 print("Get associated profiles for ALL entities")
61 profileResult = profileMgr.QueryAssociatedProfiles(entity)
62 print(profileResult)
63
64 atexit.register(Disconnect, si)
65
66 except vmodl.MethodFault as e:
67 print("Caught vmodl fault: %s" % e)
68 return -1
69
70 if name == "main":
71 main()

When the code hits line #61 above, I get the following exception :

========= ENTITY ========
(pbm.ServerObjectRef) [
(pbm.ServerObjectRef) {
dynamicType = ,
dynamicProperty = (vmodl.DynamicProperty) [],
objectType = 'virtualDiskId',
key = 'vm-20:2000',
serverUuid = '92f50500-3cfd-4845-983f-11503cacb4f7'
},
(pbm.ServerObjectRef) {
dynamicType = ,
dynamicProperty = (vmodl.DynamicProperty) [],
objectType = 'virtualDiskId',
key = 'vm-19:2000',
serverUuid = '92f50500-3cfd-4845-983f-11503cacb4f7'
},
(pbm.ServerObjectRef) {
dynamicType = ,
dynamicProperty = (vmodl.DynamicProperty) [],
objectType = 'virtualDiskId',
key = 'vm-41:2000',
serverUuid = '92f50500-3cfd-4845-983f-11503cacb4f7'
},
(pbm.ServerObjectRef) {
dynamicType = ,
dynamicProperty = (vmodl.DynamicProperty) [],
objectType = 'virtualDiskId',
key = 'vm-18:2000',
serverUuid = '92f50500-3cfd-4845-983f-11503cacb4f7'
}

]

Get profile for EACH entity
========= entity[0] ========
(pbm.profile.ProfileId) [
(pbm.profile.ProfileId) {
dynamicType = ,
dynamicProperty = (vmodl.DynamicProperty) [],
uniqueId = '0f183083-d745-4a0a-a2d2-a9f9c7ad1e0e'
}

]

========= entity[1] ========
(pbm.profile.ProfileId) [
(pbm.profile.ProfileId) {
dynamicType = ,
dynamicProperty = (vmodl.DynamicProperty) [],
uniqueId = '0f183083-d745-4a0a-a2d2-a9f9c7ad1e0e'
}

]

========= entity[2] ========
(pbm.profile.ProfileId) [
(pbm.profile.ProfileId) {
dynamicType = ,
dynamicProperty = (vmodl.DynamicProperty) [],
uniqueId = '0f183083-d745-4a0a-a2d2-a9f9c7ad1e0e'
}

]

========= entity[3] ========
(pbm.profile.ProfileId) [
(pbm.profile.ProfileId) {
dynamicType = ,
dynamicProperty = (vmodl.DynamicProperty) [],
uniqueId = '0f183083-d745-4a0a-a2d2-a9f9c7ad1e0e'
}

]

Get associated profiles for ALL entities
Traceback (most recent call last):
File "/home/vmware/abcdef/lib/pyVmomi/SoapAdapter.py", line 635, in LookupWsdlType
return GetWsdlType(ns, name)
File "/home/vmware/abcdef/lib/pyVmomi/VmomiSupport.py", line 1032, in GetWsdlType
typ = _LoadVmodlType(_wsdlDefMap[(ns, name)][0])
KeyError: ('urn:pbm', 'PbmProfileQueryProfileResultInternal')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/vmware/abcdef/lib/pyVmomi/SoapAdapter.py", line 502, in ParseData
parser.ParseFile(data)
File "/home/abuild/rpmbuild/BUILD/Python-3.4.5/Modules/pyexpat.c", line 405, in StartElement
File "/home/vmware/abcdef/lib/pyVmomi/SoapAdapter.py", line 680, in StartElementHandler
dynType = self.LookupWsdlType(ns, name, allowManagedObjectReference=True)
File "/home/vmware/abcdef/lib/pyVmomi/SoapAdapter.py", line 645, in LookupWsdlType
return GuessWsdlType(name)
File "/home/vmware/abcdef/lib/pyVmomi/VmomiSupport.py", line 1066, in GuessWsdlType
raise UnknownWsdlTypeError(name)
pyVmomi.VmomiSupport.UnknownWsdlTypeError: 'PbmProfileQueryProfileResultInternal'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "tryme2.py", line 71, in
main()
File "tryme2.py", line 61, in main
profileResult = profileMgr.QueryAssociatedProfiles(entity)
File "/home/vmware/abcdef/lib/pyVmomi/VmomiSupport.py", line 580, in
self.f(_(self.args + (obj,) + args), *_kwargs)
File "/home/vmware/abcdef/lib/pyVmomi/VmomiSupport.py", line 386, in _InvokeMethod
return self._stub.InvokeMethod(self, info, args)
File "/home/vmware/abcdef/lib/pyVmomi/SoapAdapter.py", line 1364, in InvokeMethod
raise exc
File "/home/vmware/abcdef/lib/pyVmomi/SoapAdapter.py", line 1354, in InvokeMethod
obj = deserializer.Deserialize(fd, info.result)
File "/home/vmware/abcdef/lib/pyVmomi/SoapAdapter.py", line 833, in Deserialize
ParseData(self.parser, response)
File "/home/vmware/abcdef/lib/pyVmomi/SoapAdapter.py", line 513, in ParseData
reraise(ParserError, pe, tb)
File "/usr/lib/python3.4/site-packages/six.py", line 658, in reraise
raise value.with_traceback(tb)
File "/home/vmware/abcdef/lib/pyVmomi/SoapAdapter.py", line 502, in ParseData
parser.ParseFile(data)
File "/home/abuild/rpmbuild/BUILD/Python-3.4.5/Modules/pyexpat.c", line 405, in StartElement
File "/home/vmware/abcdef/lib/pyVmomi/SoapAdapter.py", line 680, in StartElementHandler
dynType = self.LookupWsdlType(ns, name, allowManagedObjectReference=True)
File "/home/vmware/abcdef/lib/pyVmomi/SoapAdapter.py", line 645, in LookupWsdlType
return GuessWsdlType(name)
File "/home/vmware/abcdef/lib/pyVmomi/VmomiSupport.py", line 1066, in GuessWsdlType
raise UnknownWsdlTypeError(name)
pyVmomi.SoapAdapter.ParserError: 'xml document: <http.client.HTTPResponse object at 0x7fcc099d9fd0> parse error at: line:1, col:420'

Any help appreciated.

Thanks

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the sample's QueryAssociatedProfiles call at line 61 and trace deserialization through pyVmomi/SoapAdapter.py and pyVmomi/VmomiSupport.py, as shown in the traceback. Reproduce the request and inspect the returned PbmProfileQueryProfileResultInternal type. Done means the response is deserialized without UnknownWsdlTypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.