Menu

#308 wsdl2py script expexting namespace not defined in wsdl file

v2.1
open
nobody
5
2014-01-21
2014-01-19
Bernhard
No

I tried to build a client using wsdl2py for running requests to a Cisco Communications Manager (cucm). (Find wsdl files and scripts created by wsdl2py attached.)

I experienced problems parsing the responses from cucm.
Did some research and found cucm sends responses containing elements "return" and "componentVersion" without namespace while the wsdl2py scripts are expecting these elements with namespace "http://www.cisco.com/AXL/API/9.1".

After having a deeper look at the WSDL file it seems to me as this is a bug in wsdl2py.

The WSDL file AXLAPI.wsdl contains message

  • <message name="getCCMVersionIn">
  • <part element="xsd1:getCCMVersion" name="axlParams"/>
  • </message>
    in line 4546.

Namespace xsd1 is defined in line 2 as xmlns:xsd1="http://www.cisco.com/AXL/API/9.1"

The element xsd1:getCCMVersion is defined in the (line 3) imported file:

  • <import location="AXLSoap.xsd" namespace="http://www.cisco.com/AXL/API/9.1"/>

File AXLSoap.xsd defines a namespace xmlns:axlapi="http://www.cisco.com/AXL/API/9.1" in line 3.

Request and response are defined starting at line 38858:

  • <xsd:complexType name="GetCCMVersionReq">
  • <xsd:sequence>
  • <xsd:element name="processNodeName" type="axlapi:String255" minOccurs="0"/>
  • </xsd:sequence>
  • </xsd:complexType>
  • <xsd:element name="getCCMVersion" type="axlapi:GetCCMVersionReq"/>
  • <xsd:complexType name="GetCCMVersionRes">
  • <xsd:complexContent>
  • <xsd:extension base="axlapi:APIResponse">
  • <xsd:sequence>
  • <xsd:element name="return">
  • <xsd:complexType>
  • <xsd:sequence>
  • <xsd:element name="componentVersion">
  • <xsd:complexType>
  • <xsd:sequence>
  • <xsd:element name="version" type="axlapi:String50"/>
  • </xsd:sequence>
  • </xsd:complexType>
  • </xsd:element>
  • </xsd:sequence>
  • </xsd:complexType>
  • </xsd:element>
  • </xsd:sequence>
  • </xsd:extension>
  • </xsd:complexContent>
  • </xsd:complexType>
  • <xsd:element name="getCCMVersionResponse" type="axlapi:GetCCMVersionRes"/>

As far as I understand the elements "return" and "componentVersion" are defined without namespace.

Unfortunately AXLAPIService_types.py contain
line 64958

  • kw["pname"] = ("http://www.cisco.com/AXL/API/9.1","return")
    line 64978
  • kw["pname"] = ("http://www.cisco.com/AXL/API/9.1","componentVersion")

instead of

  • kw["pname"] = (None,"return")
  • kw["pname"] = (None,"componentVersion")

I think I will open a bug report for this.

1 Attachments

Discussion

  • Bernhard

    Bernhard - 2014-01-19

    I'm using ZSI version 2.1~a1-3build1 on Ubuntu 13.10.

     
  • Joshua Boverhof

    Joshua Boverhof - 2014-01-20

    This bug was reported in wsdl2py a long time ago, I think it was introduced into this alpha release. I fixed it in SVN years ago, but never got around to making a new release. I'm not supporting ZSI anymore, so if you want to use it that is fine but I think there are other python SOAP stacks that are still supported.. Maybe not.

    If you really want to use ZSI I can help you out, the issue I believe is the "elementFormDefault="unqualified", which means local elements are not in a namespace. ZSI is generating code for "elementFormDefault="qualified"".

    So if you want to use ZSI grab the SVN code, run it on this WSDL. It appears to generate you element declaration correctly:

            class componentVersion_Dec(ZSI.TCcompound.ComplexType, LocalElementDeclaration):
                literal = "componentVersion"
                schema = "http://www.cisco.com/AXL/API/9.1"
                def __init__(self, **kw):
                    ns = ns0.GetCCMVersionRes_Def.return_Dec.componentVersion_Dec.schema
                    TClist = [GTD("http://www.cisco.com/AXL/API/9.1","String50",lazy=False)(pname="version", aname="_version", minOccurs=1, maxOccurs=1, nillable=False, typed=False, encoded=kw.get("encoded"))]
                    kw["pname"] = "componentVersion"
                    kw["aname"] = "_componentVersion"
                    self.attribute_typecode_dict = {}
                    ZSI.TCcompound.ComplexType.__init__(self,None,TClist,inorder=0,**kw)
                    class Holder:
                        __metaclass__ = pyclass_type
                        typecode = self
                        def __init__(self):
                            # pyclass
                            self._version = None
                            return
                    Holder.__name__ = "componentVersion_Holder"
    
     
  • Bernhard

    Bernhard - 2014-01-21

    Thanks for your answer!
    The newer version from svn seems to work fine.
    It's a pity zsi won't be developed any longer!

    If there is someone else with the same problem. Here is a possible way to get the latest alpha version:
    1) Remove old python-zsi
    "sudo apt-get remove python-zsi"
    2) Get the files from svn (maybe you have to install subversion "sudo apt-get install subversion")
    "svn checkout svn://svn.code.sf.net/p/pywebsvcs/code/trunk pywebsvcs-code"
    3) change directory
    "cd ./pywebsvcs-code/zsi/"
    4) build zsi
    "python setup.py build"
    5) install zsi
    "sudo python setup.py install"

     

Log in to post a comment.

Auth0 Logo