2

I am using suds-client for soap wsdl services. When i try to setup the suds client for soap service, I get the Type not found error. I search everywhere. There are many unanswered questions with the same error. I am adding the links as Question1, Question2, Question3

Here is my code

from suds.client import Client
wsdlfile = 'http://track.tcs.com.pk/trackingaccount/track.asmx?WSDL'
track_client = Client(TCS_TRACK_URI)

On the last line, I got this error

Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/home/adil/Code/mezino/RoyalTag/royal_tag_services/sms_service/tcs_api.py", line 24, in <module>
track_client = Client(TCS_TRACK_URI)
File "/home/adil/Code/mezino/RoyalTag/royalenv/local/lib/python2.7/site-packages/suds/client.py", line 112, in __init__
self.wsdl = reader.open(url)
File "/home/adil/Code/mezino/RoyalTag/royalenv/local/lib/python2.7/site-packages/suds/reader.py", line 152, in open
d = self.fn(url, self.options)
File "/home/adil/Code/mezino/RoyalTag/royalenv/local/lib/python2.7/site-packages/suds/wsdl.py", line 159, in __init__
self.build_schema()
File "/home/adil/Code/mezino/RoyalTag/royalenv/local/lib/python2.7/site-packages/suds/wsdl.py", line 220, in build_schema
self.schema = container.load(self.options)
File "/home/adil/Code/mezino/RoyalTag/royalenv/local/lib/python2.7/site-packages/suds/xsd/schema.py", line 95, in load
child.dereference()
File "/home/adil/Code/mezino/RoyalTag/royalenv/local/lib/python2.7/site-packages/suds/xsd/schema.py", line 323, in dereference
midx, deps = x.dependencies()
File "/home/adil/Code/mezino/RoyalTag/royalenv/local/lib/python2.7/site-packages/suds/xsd/sxbasic.py", line 422, in dependencies
raise TypeNotFound(self.ref)
TypeNotFound: Type not found: '(schema, http://www.w3.org/2001/XMLSchema, )'

Please help me find a solution ?

Community
  • 1
  • 1
Mahammad Adil Azeem
  • 9,112
  • 13
  • 57
  • 84

1 Answers1

4

I have been searching for the answer and finally I found a solution that solved my problem.

We Just need to add the missing schema to the imports of suds. Below is the code

from suds.xsd.doctor import Import, ImportDoctor
imp=Import('http://www.w3.org/2001/XMLSchema',location='http://www.w3.org/2001/XMLSchema.xsd')
imp.filter.add('http://tempuri.org/')
track_client = Client(TCS_TRACK_URI, doctor=ImportDoctor(imp))
Mahammad Adil Azeem
  • 9,112
  • 13
  • 57
  • 84
  • I'm trying this to contact [Textbroker's API](https://api.textbroker.fr/Budget/budgetCheckService.php?wsdl) but I don't know what to pass to `imp.filter.add` to make it work. Where did you find 'http://tempuri.org/' ? Thanks – BriceP Oct 19 '16 at 08:49
  • This is the default namespace web-services use. If you don't find any, try using it, May be it work @BriceP – Mahammad Adil Azeem Oct 19 '16 at 11:35
  • I tried with this and I still get the same error (`suds.TypeNotFound: Type not found: '(Struct, http://www.w3.org/2001/XMLSchema, )'`). Thanks anyway! I'll ask directly the API provider, even though they seem to only know about PHP SOAP clientes. – BriceP Oct 20 '16 at 13:53