Which is the most mature Soap module?

Mickel Grönroos mickel at csc.fi
Fri Jun 4 12:26:48 CEST 2004


The following is a rather long message. Here is a summary of my questions
below:

1. ZSI fails on a TypeError when using ZSI.ServiceProxy, why?

2. Is there a way to use cookie authentification with SOAPpy
(client-side)?


On Tue, 1 Jun 2004, John J. Lee wrote:

> Mickel Grönroos <mickel at csc.fi> writes:
>
> > To the heart of the matter: Which of the available Soap modules is best
> > fitted for client side soap messaging? I have an upload service (written
> > in Perl) that I want to use from a Python application. What I want to do
> > is send base64 encoded files via Soap to this upload service which is on a
> > SSL encrypted server. I cannot really grasp the current development status
>
> IIRC, ZSI is.  Certainly there is no solid WSDL implementation.

I downloaded and installed both ZSI (1.5) and SOAPpy (0.11.4) both from
<http://pywebsvcs.sourceforge.net/>. ZSI only required PyXML (0.8.3, from
<http://pyxml.sourceforge.net/>) to be available, SOAPpy needed PyXML as
well as fpconst (0.7.0, from
<http://www.analytics.washington.edu/statcomp/projects/rzope/fpconst/>)

My problem concerns doing two things:

1. First, I need to log in at a secure server. In return I get a cookie
that functions as user authentification.

2. Second, I need to upload a local file to a specific place on the server
using the cookie as authentification.

I got the login part working nicely using SOAPpy:

>>> import SOAPpy
>>> server = SOAPpy.WSDL.Proxy("https://hotpage.csc.fi/log/soap.phtml?wsdl")
>>> cookie = server.login("myusername", "secretpass")
>>>

Whereas ZSI failed on a TypeError:

>>> server = ZSI.ServiceProxy('https://hotpage.csc.fi/log/soap.phtml?wsdl',
... use_wsdl=True)
>>> cookie = server.login(username='myusername', passwd='secretpass')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/local/lib/python2.3/site-packages/ZSI/ServiceProxy.py", line
278, in __call__
    return self.parent()._call(self.__name__, *args, **kwargs)
  File "/usr/local/lib/python2.3/site-packages/ZSI/ServiceProxy.py", line
83, in _call
    nsdict=self._nsdict, soapaction=soapAction, requesttypecode=request)
  File "/usr/local/lib/python2.3/site-packages/ZSI/client.py", line 209,
in Send    self.h.connect()
  File "/usr/local/lib/python2.3/httplib.py", line 960, in connect
    sock.connect((self.host, self.port))
  File "<string>", line 1, in connect
TypeError: an integer is required
>>>

Any ideas what this might be? I gather I would need to set the port to 443
somewhere, but I can't find the right place.


The second part, i.e. the upload, is trickier. Using SOAP::Lite in Perl,
one can specify a cookie to use for authentification, but I can seem to
find that in the documentation of SOAPpy. So how do I do cookie
authentification with SOAPpy (or ZSI for that matter)??

Here is the Perl SOAP::Lite code that does the trick (copied from
<http://guide.soaplite.com/>):

  use SOAP::Lite;
  use HTTP::Cookies;

  my $soap = SOAP::Lite
    -> uri('urn:xmethodsInterop')

    -> proxy('http://services.xmethods.net/soap/servlet/rpcrouter',
             cookie_jar => HTTP::Cookies->new(ignore_discard => 1));

  print $soap->echoString('Hello')->result;

I need something like that 'cookie_jar' parameter in SOAPpy too. Help and
thanks!

/Mickel




More information about the Python-list mailing list