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

wsdl parse error (XML schema)?

Anonymous created an issue

Hi, I'm new to trying to use Python to consume a SOAP-based web service. I have written a service using WCF (.NET). Using osa, I have just this Python code:

import osa

client = osa.Client('http://localhost:8733/Design_Time_Addresses/LexemeRepositoryServiceLibrary/LexemeRepositoryService/?wsdl')

It finds the wsdl and tries to parse it, but gives the following error output:

Traceback (most recent call last): File "V:/Source/LearnIt/PyLearning/lexwcf.py", line 6, in <module> client = osa.Client('http://localhost:8733/Design_Time_Addresses/LexemeRepositoryServiceLibrary/LexemeRepositoryService/?wsdl') File "build\bdist.win-amd64\egg\osa\client.py", line 108, in init File "build\bdist.win-amd64\egg\osa\wsdl.py", line 296, in parse File "build\bdist.win-amd64\egg\osa\wsdl.py", line 61, in get_types File "build\bdist.win-amd64\egg\osa\xmlschema.py", line 156, in convert_xmltypes_to_python File "build\bdist.win-amd64\egg\osa\xmlschema.py", line 196, in create_type File "build\bdist.win-amd64\egg\osa\xmlschema.py", line 288, in create_alias File "build\bdist.win-amd64\egg\osa\xmlschema.py", line 245, in get_type_by_name ValueError: Class {http://www.w3.org/2001/XMLSchema}unsignedByte not found in anywhere

I gather from this that the parser is having trouble dealing with the XML namespace mentioned in the XML. The wsdl file has the following element at the beginning:

<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" name="LexemeRepositoryService" targetNamespace="http://tempuri.org/">

Is there some reason this attribute should cause a problem? xmlns:xsd="http://www.w3.org/2001/XMLSchema"

Thanks. S. Smith

Comments (9)

  1. sboz repo owner

    Hi, your issue is not related to namespaces. The basic "unsignedByte" was missing, now it is in. That is your bug should be fixed. Please check it.

  2. Martin Donies

    I have the same issue and i dont have the control on the SOAP server.

    I just try to use osa like that :

    import osa
    cl = osa.Client("https://my_wsdl_provider/?WSDL")
    

    this is my stack trace :

    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/Library/Python/2.7/site-packages/osa/client.py", line 108, in __init__
        self._types, self._services = parser.parse()
      File "/Library/Python/2.7/site-packages/osa/wsdl.py", line 296, in parse
        t = self.get_types()
      File "/Library/Python/2.7/site-packages/osa/wsdl.py", line 61, in get_types
        types = xmlschema.XMLSchemaParser.convert_xmltypes_to_python(xtypes)
      File "/Library/Python/2.7/site-packages/osa/xmlschema.py", line 156, in convert_xmltypes_to_python
        XMLSchemaParser.create_type(k, x, xtypes, types)
      File "/Library/Python/2.7/site-packages/osa/xmlschema.py", line 207, in create_type
        XMLSchemaParser.create_complex_class(name, element, xtypes, types)
      File "/Library/Python/2.7/site-packages/osa/xmlschema.py", line 408, in create_complex_class
        XMLSchemaParser.create_type(child_name, compl, xtypes, types)
      File "/Library/Python/2.7/site-packages/osa/xmlschema.py", line 207, in create_type
        XMLSchemaParser.create_complex_class(name, element, xtypes, types)
      File "/Library/Python/2.7/site-packages/osa/xmlschema.py", line 415, in create_complex_class
        type = XMLSchemaParser.get_type_by_name(type_name, xtypes, types)
      File "/Library/Python/2.7/site-packages/osa/xmlschema.py", line 245, in get_type_by_name
        raise ValueError(' Class %s not found in anywhere' % (name))
    ValueError:  Class {http://www.w3.org/2001/XMLSchema}schema not found in anywhere
    
  3. Travis Val

    I just ran into somethime similar:

      File "...\lib\site-packages\osa\xmlschema.py", line 207, in create_type
        XMLSchemaParser.create_complex_class(name, element, xtypes, types)
      File "...\lib\site-packages\osa\xmlschema.py", line 415, in create_complex_class
        type = XMLSchemaParser.get_type_by_name(type_name, xtypes, types)
      File "...\lib\site-packages\osa\xmlschema.py", line 245, in get_type_by_name
        raise ValueError(' Class %s not found in anywhere' % (name))
    ValueError:  Class {http://www.w3.org/2001/XMLSchema}time not found in anywhere
    
  4. Log in to comment