SUDS Exception Imported Schema Failed
Question: I'm getting the error:

> Exception: imported schema (<http://www.w3.org/2001/XMLSchema>) at
> (<http://www.w3.org/2001/XMLSchema.x> sd), failed

when passing a Doctor (constructed with _ImportDoctor_) to the **suds**
_Client_ constructor.

I'm working on two _Windows_ machines, both of them got the same version of
**suds** installed, but only one of them rises the error above.

Could someone guide me here to know why this error rises?, so I can figure out
what's missing on the machine where it happens?.

Thanks in advance!!!.

**UPDATE** : I don't really know if this is important, but it's worth noting
that my _Windows_ machine that is rising the error is an _Amazon Web Services_
instance. At my local machine everything's working well!.

**UPDATE** : Here's some code I ran at the python interpreter of the machine I
mentioned. Here you can detail how the error is rising...

    
    
    >>> from suds.client import Client
    >>> from suds.xsd.doctor import ImportDoctor, Import
    >>> missing_import = Import("http://www.w3.org/2001/XMLSchema")
    >>> missing_import.filter.add("http://tempuri.org/")
    >>> doctor = ImportDoctor(missing_import)
    >>> client = Client("http://etcfulfill.ebooks.com/Fulfillment.asmx?wsdl")
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "suds\client.py", line 112, in __init__
        self.wsdl = reader.open(url)
      File "suds\reader.py", line 152, in open
        d = self.fn(url, self.options)
      File "suds\wsdl.py", line 159, in __init__
        self.build_schema()
      File "suds\wsdl.py", line 220, in build_schema
        self.schema = container.load(self.options)
      File "suds\xsd\schema.py", line 95, in load
        child.dereference()
      File "suds\xsd\schema.py", line 323, in dereference
        midx, deps = x.dependencies()
      File "suds\xsd\sxbasic.py", line 422, in dependencies
        raise TypeNotFound(self.ref)
    suds.TypeNotFound: Type not found: '(schema, http://www.w3.org/2001/XMLSchema, )'
    >>> client = Client("http://etcfulfill.ebooks.com/Fulfillment.asmx?wsdl", doctor=doctor)
    No handlers could be found for logger "suds.xsd.sxbasic"
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "suds\client.py", line 112, in __init__
        self.wsdl = reader.open(url)
      File "suds\reader.py", line 152, in open
        d = self.fn(url, self.options)
      File "suds\wsdl.py", line 159, in __init__
        self.build_schema()
      File "suds\wsdl.py", line 220, in build_schema
        self.schema = container.load(self.options)
      File "suds\xsd\schema.py", line 93, in load
        child.open_imports(options)
      File "suds\xsd\schema.py", line 305, in open_imports
        imported = imp.open(options)
      File "suds\xsd\sxbasic.py", line 542, in open
        result = self.download(options)
      File "suds\xsd\sxbasic.py", line 567, in download
        raise Exception(msg)
    Exception: imported schema (http://www.w3.org/2001/XMLSchema) at (http://www.w3.org/2001/XMLSchema.xsd), failed
    

**UPDATE** :

I realized that **suds** connections always open in _TCP_ increasing ports,
and if it reaches the maximum _TCP_ port (65535) then it starts opening again
from the minimum _TCP_ port available, so there's no problem with this.

The problem shows up when using **suds** _ImportDoctor_ , because it has to
open a previous connection to the location where the import should be
retrieved, and for some reason, if the system reaches the maximum _TCP_ port
count, then **suds** somehow assumes that there's no _TCP_ port available to
open the connection for obtaining the import, and in consecuence it throws the
exception:

> Exception: imported schema (<http://www.w3.org/2001/XMLSchema>) at
> (<http://www.w3.org/2001/XMLSchema.xsd>), failed

I repeat, this only happens if **suds** has to open this previous connection
for obtaining the import. If _ImportDoctor_ is not used, then **suds** has no
problem if the _TCP_ port count reaches its maximum, it just restarts at the
minimum port available.

Does anyone has any clue on how to resolve this issue???. I'd really
appreciate the help!!!.


Answer: I've figured out what the problem was. The schema that was missing from the
_WSDL_ I was trying to use with **suds** was:

> <http://www.w3.org/2001/XMLSchema>

And the _XSD_ file for this schema is at:

> <http://www.w3.org/2001/XMLSchema.xsd>

So when I used **suds** _ImportDoctor_ to add this schema import, sometimes
the _w3.org_ domain was denying my access (don't know why really) and that's
why this error was rising:

> Exception: imported schema (<http://www.w3.org/2001/XMLSchema>) at
> (<http://www.w3.org/2001/XMLSchema.xsd>), failed

What did I do to solve this problem?. I just downloaded this schema to my
machine and used **suds** _ImportDoctor_ to retrieve this import locally.

And that was it!!!. Confusing bug!!!. But **SOLVED**.

