How to import .xsd or .wsdl files in Python 3.2
I’m new to Python and am currently doing some conversion from 2.7 to 3.2 after running the 2to3 tool. One of the problems it can’t solve is importing .xsd or .wsdl files. In 2.7
Something like import content, where the content is an .xsd file in our directory seems to work fine, but 3.2 can’t parse this import
. Does anyone know what I should do?
Thanks!
Solution
Sounds like you’re using code generators on .xsd
and .wsdl
files, right?
Otherwise, I’m confused what you mean when you say you can’t import .xsd
files;
I don’t think the Python import toolchain lets you do this without a new importer
Written specifically for SOAP clients.
I recently had to communicate with a SOAP service and chose suds
The
Client
object in suds receives the URL of the wsdl file (I had to modify the url to use file://
to specify a local .wsdl file).
from suds.client import Client
a = Client(<url_to_wsdl_file>)
a.service.Method()
Hope this helps! I’m not sure if suds is compatible with Python 3, and a quick search didn’t yield any useful information.