Vladimir Kadalashvili
Vladimir Kadalashvili

Reputation: 757

python - SOAP suds library Type Not Found Error

I'm trying to create Python client for Textbroker API, but having troubles accessing their SOAP interface. I can access Login Service ( https://api.textbroker.com/Budget/loginService.php?wsdl ) just fine, but when I try to access Budget Check Service ( https://api.textbroker.com/Budget/budgetCheckService.php?wsdl ), I get the following error message:

suds.TypeNotFound: Type not found: '(Struct, http://www.w3.org/2001/XMLSchema, )'

As far as I understood reading other similar questions, I need to use ImportDoctor to fix this issue. I tried the following:

    class BaseService:
        password = None
        wsdl = None
        client = None

        def __init__(self):
            imp = Import('http://www.w3.org/2001/XMLSchema')
            imp.filter.add("urn:loginService")
            self.client = Client(self.wsdl, doctor=ImportDoctor(imp), cache=None)

But unfortunately I still get the same error message. I'm almost sure I need to use ImportDoctor to fix this problem, I just do it wrong.

Upvotes: 2

Views: 1957

Answers (1)

hecvd
hecvd

Reputation: 668

As per this answer: SOAP suds and the dreaded schema Type Not Found error you probably need to add a specific location to Import()

imp = Import('http://www.w3.org/2001/XMLSchema',
              location='http://www.w3.org/2001/XMLSchema.xsd')

Upvotes: 2

Related Questions