#209 Multiple calls to the same method: _get_type_or_substitute

zsi (169)


I'm having an issue which I think is potentially a bug in ZSI 2.0. I searched through the bug tracker, but I couldn't find anything that looks like this problem.

I'm writing a client that connects to the VMware web service. The problem is that when I log in and log out more than once during a process lifetime, I start getting parse errors[1]

I've looked at the XML that comes back after the second call, and I can't see anything wrong with it. I've boiled the code down to a small sample program that generates the problem (see attached). I've also attached a trace log from a sample run.

I'd really appreciate it if anyone has any ideas on how I could solve this problem.


1: parse errors:

Traceback (most recent call last):
File "test.py", line 43, in <module>
content = getSvcContent(service)
File "test.py", line 9, in getSvcContent
response = svc.RetrieveServiceContent(svcRequest)
File "/code/5137/usr/lib/python/racemi/devicedrivers/chassis/vmware_connector/vim_service.py", line 1128, in RetrieveServiceContent
response = self.binding.Receive(RetrieveServiceContentResponseMsg.typecode)
File "/opt/race/share/sw/os/Linux_2.6_i686/python/lib/python2.5/site-packages/ZSI/client.py", line 503, in Receive
return _Binding.Receive(self, replytype, **kw)
File "/opt/race/share/sw/os/Linux_2.6_i686/python/lib/python2.5/site-packages/ZSI/client.py", line 437, in Receive
reply = self.ps.Parse(tc)
File "/opt/race/share/sw/os/Linux_2.6_i686/python/lib/python2.5/site-packages/ZSI/parse.py", line 323, in Parse
return how.parse(self.body_root, self)
File "/opt/race/share/sw/os/Linux_2.6_i686/python/lib/python2.5/site-packages/ZSI/TCcompound.py", line 201, in parse
value = what.parse(c_elt, ps)
File "/opt/race/share/sw/os/Linux_2.6_i686/python/lib/python2.5/site-packages/ZSI/TCcompound.py", line 234, in parse
'" missing from complexType', ps.Backtrace(elt))
ZSI.EvaluateException: Element "__this" missing from complexType
[Element trace: /soapenv:Envelope/soapenv:Body/RetrieveServiceContentResponse/returnval]


  • Greg Jednaszewski

    Logged In: YES
    Originator: YES

    File Added: vim_service.py

  • Greg Jednaszewski

    Logged In: YES
    Originator: YES

    File Added: samplecode.zip

  • Greg Jednaszewski

    Logged In: YES
    Originator: YES

    File Added: tf.log

  • Greg Jednaszewski

    Trace file from sample code run

  • Greg Jednaszewski

    Logged In: YES
    Originator: YES

    File Added: wsdl.zip

  • Greg Jednaszewski

    WSDL files

  • Joshua Boverhof

    Joshua Boverhof - 2007-07-17

    Logged In: YES
    Originator: NO

    Function TCcompound._get_type_or_substitute changes attributes (pname, nspname, minOccurs, maxOccurs) on a substitute typecode (same type or derivation) in order for it to be used in a different context (element declaration/reference) , should make a shallow copy first.

    This error is introduced during serialization of the substituted element in the different element context.

    Workaround: Remove the "typecode" attribute

    sessionMgr = pyobj.Returnval.SessionManager
    sessionMgr.typecode = None

    $ svn info
    Path: .
    URL: https://pywebsvcs.svn.sourceforge.net/svnroot/pywebsvcs/trunk/zsi
    Repository Root: https://pywebsvcs.svn.sourceforge.net/svnroot/pywebsvcs
    Repository UUID: 7150bf37-e60d-0410-b93f-83e91ef0e581
    Revision: 1408
    Node Kind: directory
    Schedule: normal
    Last Changed Author: boverhof
    Last Changed Rev: 1408
    Last Changed Date: 2007-07-17 15:26:07 -0700 (Tue, 17 Jul 2007)

    $ svn diff -r1407 ZSI/TCcompound.py
    Index: ZSI/TCcompound.py
    --- ZSI/TCcompound.py (revision 1407)
    +++ ZSI/TCcompound.py (working copy)
    @@ -19,6 +19,7 @@
    from ZSI.wstools.Utility import SplitQName
    from ZSI.wstools.logging import getLogger as _GetLogger
    import re, types
    +from copy import copy as _copy

    _find_arrayoffset = lambda E: E.getAttributeNS(SOAP.ENC, "offset")
    _find_arrayposition = lambda E: E.getAttributeNS(SOAP.ENC, "position")
    @@ -74,12 +75,14 @@
    'failed to serialize substitute %s for %s, not derivation: %s' %
    (sub, typecode, sw.Backtrace(elt),))

    - # Make our substitution type match the elements facets
    + # Make our substitution type match the elements facets,
    + # since typecode is created for a single existing pyobj
    + # some facets are irrelevant.
    + sub = _copy(sub)
    sub.nspname = typecode.nspname
    sub.pname = typecode.pname
    sub.aname = typecode.aname
    - sub.minOccurs = 1
    - sub.maxOccurs = 1
    + sub.minOccurs = sub.maxOccurs = 1
    return sub

  • Joshua Boverhof

    Joshua Boverhof - 2007-07-17
    • assigned_to: nobody --> boverhof
    • summary: Multiple calls to the same method --> Multiple calls to the same method: _get_type_or_substitute
    • status: open --> open-fixed
  • Joshua Boverhof

    Joshua Boverhof - 2007-10-31
    • status: open-fixed --> closed-fixed

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks