views:

67

answers:

1

Dear Python programmers,

Although this question is very popular here in StackOverflow, after spending some time here and in the Google, I still haven't find a concrete answer on what is the most appropriate way to do SOAP consuming in Python 3.

I took a look at http://stackoverflow.com/questions/1534554/does-a-python-3-soap-client-module-exist, and I hope it is outdated and today some solution to this may have appeared.

I was thinking about some ideas:

  1. Use 2to3 script to port some existing libraries to Python 3 (SOAPy, suds, etc).
  2. Load an external module, by mixing technologies (Py3k + Jython, Py3k + Python 2.6, etc.)
  3. Write in hardcode Python classes that corresponds to definitions of WSDL files (which implies in tight-coupling/high maintenance).
  4. Write the software in Python 3.0, call the "python2.6-only" module functions through the execnet package. Which requires the Python 2.6 to be installed on the machine and the software written in Python3.0 to be a frozen binary.

Any ideas?

Thanks in advance

+1  A: 

I would probably start by trying your suggested 2to3 port. For many things, it works pretty well. It would still be a day or two worth of work to convert something like suds, I imagine.

Paul McMillan
I don't believe this solution would work, 2to3 was designed to make simple translations such as prints statements, exceptions, absolute imports and so on. Otherwise I guess A SOAPy client for py3k would be released. Don't you agree?
Eduardo Coelho
@Eduardo: I don't. I've seen some Python modules (including some rather complex ones) specifically state that their official transition mechanism is to ensure 2to3 works as well as possible on their codebase. You'll note the documentation for 2to3 (http://docs.python.org/library/2to3.html) specifically states "The standard library contains a rich set of fixers that will handle almost all code.".
Nicholas Knight
2to3 works pretty well for many codebases. The places it breaks down are where authors tried to be too clever and make weird uses of edge cases. If the code is written in a straightforward, pythonic style, 2to3 often does a large portion of the work.
Paul McMillan