Re: Malformed type attribute (bad NS) with 2.1a1 but not with 2.0

Peter Åstrand <[email protected]> Wed, 8 Apr 2009 09:47:36 +0200 (CEST)
Newsgroups gmane.comp.python.pywebsvcs.general,gmane.comp.python.xml
Message-ID <[email protected]>
> ZSI-2.1a uses minidom, this is beneficial in several ways but is not as complete a DOM solution as PyXML.

I understand that minidom is not a complete DOM parser, but does anyone 
have an idea what is actually missing? The 2.1a1 release notes also talkes 
about this:

"Also minidom is now used as the default parser because PyXML is no longer 
supported. There are known issues with minidom, but for most applications 
it is sufficient."

This is very vague. How do I know for which applications minidom is 
sufficient? 
http://docs.python.org/library/xml.dom.minidom.html#minidom-and-the-dom-standard 
looks like a good documentation on what minidom actually supports, but 
from a quick glance, I cannot find anything there that indicates that 
minidom lacks some fundamental feature that should prevent SOAP 
communication with VMware.

Regards,
Peter Åstrand

> On Apr 7, 2009, at 7:13 AM, Peter Åstrand wrote:
>
>       We are using ZSI to communicate with VMware vCenter. When we are using ZSI 2.0, things works quite
>       well, except that the performance is quite bad: The Python process eats a lot of CPU when parsing
>       the responses. As I understand it, 2.1 should be much faster. However, when we are trying 2.1a1,
>       we are getting tracebacks:
>
>        File "/opt/foo/modules/bar/vilibrary.py", line 54, in get_resource_pool
>          resources = vi.RetrieveAllProperties("ResourcePool")
>        File "/opt/foo/modules/bar/viframework.py", line 314, in RetrieveAllProperties
>          foobar = self . proxy . RetrieveProperties ( c )
>        File "/opt/foo/modules/bar/VimService_services.py", line 61, in RetrieveProperties
>          response = self.binding.Receive(RetrievePropertiesResponseMsg.typecode)
>        File "/opt/foo/modules/ZSI/client.py", line 536, in Receive
>          return _Binding.Receive(self, replytype, **kw)
>        File "/opt/foo/modules/ZSI/client.py", line 461, in Receive
>          reply = self.ps.Parse(tc)
>        File "/opt/foo/modules/ZSI/parse.py", line 326, in Parse
>          return how.parse(self.body_root, self)
>        File "/opt/foo/modules/ZSI/TCcompound.py", line 196, in parse
>          value = what.parse(c_elt, ps)
>        File "/opt/foo/modules/ZSI/TCcompound.py", line 196, in parse
>          value = what.parse(c_elt, ps)
>        File "/opt/foo/modules/ZSI/TCcompound.py", line 196, in parse
>          value = what.parse(c_elt, ps)
>        File "/opt/foo/modules/ZSI/TC.py", line 1375, in parse
>          pyobj = Any().parse_into_dict_or_list(elt, ps)
>        File "/opt/foo/modules/ZSI/TC.py", line 545, in parse_into_dict_or_list
>          v.append((str(c_elt.localName), self.__class__(**self.kwargs).parse(c_elt, ps)))
>        File "/opt/foo/modules/ZSI/TC.py", line 550, in parse
>          (ns,type) = self.checkname(elt, ps)
>        File "/opt/foo/modules/ZSI/TC.py", line 201, in checkname
>          return self.checktype(elt, ps)
>        File "/opt/foo/modules/ZSI/TC.py", line 219, in checktype
>          ps.Backtrace(elt))
>       ZSI.EvaluateException: Malformed type attribute (bad NS)
>       [Element trace:
>       /soapenv:Envelope/soapenv:Body/RetrievePropertiesResponse/returnval/propSet[2]/val/ResourceConfigSpec[1]]
>
>       I've tried to debug the problem, but haven't really found a solution. I've noticed a few strange
>       things, though, such that:
>
>       * checktype() calls:
>
>       uri = ps.GetElementNSdict(elt).get(prefix)
>
>       ...with prefix being None. With 2.0, this actually works(!). With 2.1, the uri is instead indexed
>       as ''.
>
>       * In GetElementNSdict, there's this statement:
>
>                      if a.namespaceURI == XMLNS.BASE:
>                          if a.localName == "xmlns":
>                              d[''] = a.nodeValue
>                          else:
>                              d[a.localName] = a.nodeValue
>
>       With 2.0, a.namespaceURI is equal to XMLNS.BASE, but with 2.1, a.namespaceURI is
>       "http://www.w3.org/2001/XMLSchema-instance" rather than XMLNS.BASE
>       (="http://www.w3.org/2000/xmlns/"). Is this relevant, perhaps?
>
>       The response begins like this:
>
>       200
>       OK
>       -------
>       Date: Tue, 7 Apr 2009 09:41:50 GMT
>       Cache-Control: no-cache
>       Content-Type: text/xml; charset=utf-8
>       Content-Length: 7933
>
>       <?xml version="1.0" encoding="UTF-8"?>
>       <soapenv:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
>       xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
>       xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>       <soapenv:Body>
>       <RetrievePropertiesResponse xmlns="urn:vim25"><returnval><obj
>       type="ResourcePool">resgroup-7</obj><propSet><name>availableField</name><val
>       xsi:type="ArrayOfCustomFieldDef"></val></propSet><propSet><name>childConfiguration</name><val
>       xsi:type="ArrayOfResourceConfigSpec"><ResourceConfigSpec xsi:type="ResourceConfigSpec"><entitytype="ResourcePool">resgroup-40</entity><cpuAllocation><reservation>0</reservation><expandableReservation>tru
> e</expandableReservation><limit>-1</limit><shares><shares>4000</shares><level>normal</level></shares></cpuAll
> ocation><memoryAllocation><reservation>0</reservation><expandableReservation>true</expandableReservation><lim
> it>-1</limit><shares><shares>163840</shares><level>normal</level></shares></memoryAllocation></ResourceConfig
>       Spec><ResourceConfigSpec xsi:type="ResourceConfigSpec"><entitytype="ResourcePool">resgroup-41</entity><cpuAllocation><reservation>0</reservation><expandableReservation>tru
> e</expandableReservation><limit>-1</limit><shares><shares>4000</shares><level>normal</level></shares></cpuAll
> ocation><memoryAllocation><reservation>0</reservation><expandableReservation>true</expandableReservation><lim
> it>-1</limit><shares><shares>163840</shares><level>normal</level></shares></memoryAllocation></ResourceConfig
>       Spec><ResourceConfigSpec xsi:type="ResourceConfigSpec">
> 
>
>       Any help is appreciated.
>
>       Best regards, ---
>       Peter Åstrand ThinLinc Chief Developer
>       Cendio AB http://www.cendio.com
>       Wallenbergs gata 4
>       583 30 Linköping Phone: +46-13-21 46
>       00------------------------------------------------------------------------------
>       This SF.net email is sponsored by:
>       High Quality Requirements in a Collaborative Environment.
>       Download a free trial of Rational Requirements Composer Now!
>       http://p.sf.net/sfu/www-ibm-com_______________________________________________
>       Pywebsvcs-talk mailing list
>       [email protected]
>       https://lists.sourceforge.net/lists/listinfo/pywebsvcs-talk
>       Also archived at http://groups.google.com/group/pywebsvcs
> 
> 
> 
>


---
Peter Åstrand		ThinLinc Chief Developer
Cendio AB		http://www.cendio.com
Wallenbergs gata 4
583 30 Linköping	Phone: +46-13-21 46 00

------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com

_______________________________________________
Pywebsvcs-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pywebsvcs-talk
Also archived at http://groups.google.com/group/pywebsvcs