Using Python to talk to a Perl SOAP::Lite server

Christopher Browne cbbrowne at
Fri Aug 16 14:36:29 CEST 2002

>My apologies if this is viewed as off-topic.

It seems relevant enough...

>I have a SOAP server written in Perl using SOAP::Lite.  I have no
>problem using this to instantiate an object using Perl and then making
>method calls on it.  However, the client software is being written in
>Python and my coworker (who, like me, is unfamiliar with SOAP), cannot
>seem to perform the same task.  If I recode the SOAP server to use
>functions instead of methods, he has no problem connecting and getting
>appropriate responses.  Here's the Python code:
>from ZSI.client import Binding
>server = Binding(url='/soap/temper.cgi',
>                 ns='',
>                 host='',
>                 port=80,
>                 soapaction='')
>    print server.f_f2c(100) # Works
>    print      # Doesn't
>    print "Got XML I can't parse:"
>    print server.ReceiveRaw()
> Note that the line marked "Works" is a simple function call and is
> not dependant on an object.

> I've been searching through mailing lists, Google, and FAQS for
> about three hours and I am not even close to getting an answer.  Is
> it possible that Python cannot instantiate a Perl object via SOAP?
> (I don't know anything about SOAP, either, so this may be a stupid
> question).

This is definitely a question about SOAP, as opposed to being terribly

In a sense, the moniker "SOAP" is pretty misleading.  The "S" is for
"Simple," and it's not particularly that.  More importantly, "O" is
for "Object," and you're seeing here that it's not real strongly that.

It would be _plausible_ for it to make sense to do some sort of
"" call, but NOT for some sort of "object instantiation,"
rather to establish a connection.

For instance, the Google WebServices API includes a "new()" method
which is used to request an authentication token that is passed into
the other methods.

But since HTTP, the usual protocol, is connectionless, if there's not
some _special_ prep work required for calculating temperature
conversions, there's nothing special that the server would need as
preparation from the client.

If the server implements a method called new(), then you can use it;
if it doesn't, you can't.

And there are "native new()" methods to go around, with the difference
that they generally get called something like Binding() or handle().

- On the client, all the "new()" you need to do is when you run the
  Binding() method to set up the server object.

- On the server, the "new()" involves something along the lines of:
 server = SOAP.SOAPServer(("host", 5471))
 for function in functions:


 my $SoapServer = SOAP::Transport::HTTP::Daemon 
   -> new( hostargs ) -> dispatch_to qw( fun1 fun2 fun3 ... )
   -> handle;

A client process won't be initiating starting up the server, so
there's really not anything there vis-a-vis the server to do a new()

SOAP is definitely more about invoking "functions" than it is about
invoking "methods."
(concatenate 'string "chris" "")
The way to a man's heart is through the left ventricle.

More information about the Python-list mailing list