[Fedora-suds-list] ImportDoctor or SAX?
Jeff Ortel
jortel at redhat.com
Thu May 21 20:48:57 UTC 2009
Zhiwu Xie wrote:
> Newbie here, would appreciate your help and/or hint.
>
> Not sure if it's because I didn't use ImportDoctor properly or because
> it's a SAX parser so it didn't reach the scheme for the namespace
> 'urn:theplatform-com:v4/base/' before trying to parse it, or it's the
> WSDL file (http://admin.theplatform.com/API/urn:service.wsdl) that's
> wrongly formed.
The wsdl contains (16) schemas and (3) of them reference types in the in the
'urn:theplatform-com:v4/base/' namespace but fail to properly import the schema. Even
though, the schema is defined within the same wsdl, XSD import rules apply.
What you have below is very close - but backwards. The Import() constructor takes the
namespace (and optional schema location) of an <xs:import/> to add (if missing). The
Import.filter takes the targetNamepsace(s) of this schema(s) to be fixed (that are missing
the import(s) ).
This works for me:
>
> url = 'http://admin.theplatform.com/API/urn:service.wsdl'
> imp = Import('urn:theplatform-com:v4/base/')
> imp.filter.add('urn:theplatform-com:v4/admin/value/')
> imp.filter.add('urn:theplatform-com:v4/content/value/')
> imp.filter.add('urn:theplatform-com:v4/rights/value/')
> d = ImportDoctor(imp)
> client = Client(url, schemadoctor=d)
>
Regards,
Jeff
>
> Thanks a lot,
>
> Zhiwu
>
>
> >>> from suds.xsd.doctor import *
> >>> imp = Import('http://www.w3.org/2001/XMLSchema')
> >>> imp.filter.add('urn:theplatform-com:v4/base/')
> >>> doctor = ImportDoctor(imp)
> >>> url = 'http://admin.theplatform.com/API/urn:service.wsdl'
> >>> client = Client(url, schemadoctor=doctor)
> Traceback (most recent call last):
> File "<pyshell#9>", line 1, in <module>
> client = Client(url, schemadoctor=doctor)
> File "C:\Python25\Lib\site-packages\suds\client.py", line 106, in __init__
> self.wsdl = Definitions(url, options)
> File "C:\Python25\Lib\site-packages\suds\wsdl.py", line 193, in __init__
> self.build_schema()
> File "C:\Python25\Lib\site-packages\suds\wsdl.py", line 255, in
> build_schema
> self.schema = container.load()
> File "C:\Python25\Lib\site-packages\suds\xsd\schema.py", line 92, in load
> child.dereference()
> File "C:\Python25\Lib\site-packages\suds\xsd\schema.py", line 294, in
> dereference
> midx, deps = x.dependencies()
> File "C:\Python25\Lib\site-packages\suds\xsd\sxbasic.py", line 783, in
> dependencies
> raise TypeNotFound(qref)
> TypeNotFound: Type not found: '(BusinessObject,
> urn:theplatform-com:v4/base/, )'
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> fedora-suds-list mailing list
> fedora-suds-list at redhat.com
> https://www.redhat.com/mailman/listinfo/fedora-suds-list
More information about the fedora-suds-list
mailing list