1. sboz
  2. osa
  3. Issues
Issue #16 new

Failing to parse WSDL

Philip Goh
created an issue

I'm attempting to use osa to parse a WSDL file published by the ONVIF consortium. The following code fails to run:

if __name__=="__main__":
    import osa
    WSDL_URL = 'http://www.onvif.org/onvif/ver10/device/wsdl/devicemgmt.wsdl'
    cl = osa.Client(WSDL_URL)
    print cl

The error I'm getting is:

Traceback (most recent call last):
  File "scratch-pad.py", line 4, in <module>
    cl = osa.Client(WSDL_URL)
  File "build/bdist.macosx-10.9-intel/egg/osa/client.py", line 108, in __init__
  File "build/bdist.macosx-10.9-intel/egg/osa/wsdl.py", line 296, in parse
  File "build/bdist.macosx-10.9-intel/egg/osa/wsdl.py", line 61, in get_types
  File "build/bdist.macosx-10.9-intel/egg/osa/xmlschema.py", line 156, in convert_xmltypes_to_python
  File "build/bdist.macosx-10.9-intel/egg/osa/xmlschema.py", line 207, in create_type
  File "build/bdist.macosx-10.9-intel/egg/osa/xmlschema.py", line 415, in create_complex_class
  File "build/bdist.macosx-10.9-intel/egg/osa/xmlschema.py", line 247, in get_type_by_name
  File "build/bdist.macosx-10.9-intel/egg/osa/xmlschema.py", line 218, in create_type
  File "build/bdist.macosx-10.9-intel/egg/osa/xmlschema.py", line 288, in create_alias
  File "build/bdist.macosx-10.9-intel/egg/osa/xmlschema.py", line 248, in get_type_by_name
KeyError: '{http://www.onvif.org/ver10/schema}ReferenceToken'

Comments (1)

  1. Cherish Chen

    I have the same problem

    >>> wsdl.get_types()
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/local/lib/python2.7/dist-packages/osa/wsdl.py", line 61, in get_types
        types = xmlschema.XMLSchemaParser.convert_xmltypes_to_python(xtypes)
      File "/usr/local/lib/python2.7/dist-packages/osa/xmlschema.py", line 156, in convert_xmltypes_to_python
        XMLSchemaParser.create_type(k, x, xtypes, types)
      File "/usr/local/lib/python2.7/dist-packages/osa/xmlschema.py", line 207, in create_type
        XMLSchemaParser.create_complex_class(name, element, xtypes, types)
      File "/usr/local/lib/python2.7/dist-packages/osa/xmlschema.py", line 415, in create_complex_class
        type = XMLSchemaParser.get_type_by_name(type_name, xtypes, types)
      File "/usr/local/lib/python2.7/dist-packages/osa/xmlschema.py", line 247, in get_type_by_name
        XMLSchemaParser.create_type(name, xtypes[name], xtypes, types)
      File "/usr/local/lib/python2.7/dist-packages/osa/xmlschema.py", line 218, in create_type
        XMLSchemaParser.create_alias(name, base_type, xtypes, types)
      File "/usr/local/lib/python2.7/dist-packages/osa/xmlschema.py", line 288, in create_alias
        alias = XMLSchemaParser.get_type_by_name(alias_type, xtypes, types)
      File "/usr/local/lib/python2.7/dist-packages/osa/xmlschema.py", line 248, in get_type_by_name
        cl = types[name]
    KeyError: '{http://www.onvif.org/ver10/schema}ReferenceToken'
    

    similar problem in ZSI

    >>> from ZSI.ServiceProxy import ServiceProxy
    >>> ServiceProxy(wsdl='devicemgmt.wsdl')
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/local/lib/python2.7/dist-packages/ZSI/ServiceProxy.py", line 87, in __init__
        self._mod = self._load(wsdl)
      File "/usr/local/lib/python2.7/dist-packages/ZSI/ServiceProxy.py", line 118, in _load
        files = commands.wsdl2py(args)
      File "/usr/local/lib/python2.7/dist-packages/ZSI/generate/commands.py", line 147, in wsdl2py
        files = _wsdl2py(options, wsdl)
      File "/usr/local/lib/python2.7/dist-packages/ZSI/generate/commands.py", line 240, in _wsdl2py
        wsm.writeTypes(fd)
      File "/usr/local/lib/python2.7/dist-packages/ZSI/generate/wsdl2python.py", line 232, in writeTypes
        sd.fromSchema(schema)
      File "/usr/local/lib/python2.7/dist-packages/ZSI/generate/wsdl2python.py", line 417, in fromSchema
        self.items[-1].fromSchemaItem(item)
      File "/usr/local/lib/python2.7/dist-packages/ZSI/generate/wsdl2python.py", line 517, in fromSchemaItem
        self.content.setUp(item)
      File "/usr/local/lib/python2.7/dist-packages/ZSI/generate/containers.py", line 2779, in setUp
        'Not Supporting simpleType/Restriction w/User-Defined Base: %s %s' %(tp.getItemTrace(),item.getItemTrace())
    ZSI.generate.Wsdl2PythonError: Not Supporting simpleType/Restriction w/User-Defined Base: <schema targetNamespace="http://www.onvif.org/ver10/schema"><simpleType name="ReceiverReference"> <schema targetNamespace="http://www.onvif.org/ver10/schema"><simpleType name="ReferenceToken">
    
  2. Log in to comment