Which is the most mature Soap module?

  • Thread starter =?ISO-8859-1?Q?Mickel_Gr=F6nroos?=
  • Start date
?

=?ISO-8859-1?Q?Mickel_Gr=F6nroos?=

Hi everybody,

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
of the various Soap modules around. Those I have found seem to need a lot
of other third-party modules.

Thanks,

/Mickel
 
J

John J. Lee

Mickel Grönroos said:
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.

Don't take my poor memory as gospel, though, read the recent article
by Uche Ogbuji and Mike Olson that was referenced in a recent weekly
Python-URL.

Or you could just stick with httplib (I'd certainly rather not know
anything about SOAP if I can help it, though).

of the various Soap modules around. Those I have found seem to need a lot
of other third-party modules.
[...]

What third-party modules? PyXML is the only one that comes to mind.
That's only one package.


John
 
?

=?ISO-8859-1?Q?Mickel_Gr=F6nroos?=

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)?


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:

Whereas ZSI failed on a TypeError:
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))

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
 
J

John J Lee

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?

dunno -- it's a while since I used it. Is that part of the WSDL stuff?
All that (which is common code between ZSI and SOAPpy) was pretty flaky
when I tried it.

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

Yes, no reason why not to use my ClientCookie package to do that, but I
don't know from memory exactly where you need to insert the required code
in SOAPpy. I'm slightly surprised if SOAP needs cookie handling, but not
entirely, since I know it is required for some XML-RPC services.

[...]
2. Second, I need to upload a local file to a specific place on the server
using the cookie as authentification. [...]
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.

No idea without digging, sorry. As I say, WSDL support is definitely
flaky, so it's always possible you've just hit a bug.

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)?? [...]
-> 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!

I might have a look this weekend, but don't promise.


John
 
?

=?ISO-8859-1?Q?Mickel_Gr=F6nroos?=

Yes, no reason why not to use my ClientCookie package to do that, but I
don't know from memory exactly where you need to insert the required code
in SOAPpy.

Do you mean subclassing SOAPpy and changing the places where it uses
urllib to talk to the server? (This might be totally off target -- I've
been browsing the code in SOAPpy and I'm getting confused ...)
I'm slightly surprised if SOAP needs cookie handling, but not
entirely, since I know it is required for some XML-RPC services.

I don't think SOAP needs cookies for anything. My problem is that the SOAP
server for upload is only available if I have a certain cookie that I
can send to the web server in the http header, i.e. the web server won't
let me through to the SOAP server unless I can supply the cookie first.
I might have a look this weekend, but don't promise.

If you have the time, that would be much appreciated!

Have a nice weekend,

/Mickel
 
J

John J Lee

Do you mean subclassing SOAPpy and changing the places where it uses
urllib to talk to the server? (This might be totally off target -- I've
been browsing the code in SOAPpy and I'm getting confused ...)

Something like that.

I don't think SOAP needs cookies for anything. My problem is that the SOAP
server for upload is only available if I have a certain cookie that I
can send to the web server in the http header, i.e. the web server won't
let me through to the SOAP server unless I can supply the cookie first.
[...]

Right.


John
 
?

=?ISO-8859-1?Q?Mickel_Gr=F6nroos?=

Hi!

I abandoned trying to use the WSDL descriptions from SOAPpy and went back
to looking at ZSI. I got ZSI to work better when using ZSI.Binding (and
not ZSI.ServerProxy). I have two tasks I need to perform:

1. Run a login function with two string parameters ("username" and
"passwd") on a SOAP server that returns a cookie

2. Run an upload function with two parameters (string "fullpath" and
base64 encoded "filecontent") on another SOAP server adding the cookie to
the HTTP header being sent with the SOAP message

Part 1 works with the following code:
import ZSI, sys
loginservice = ZSI.Binding(url="https://hotpage.csc.fi/log/soap.phtml", .... ssl=True, host="hotpage.csc.fi")
cookie = loginservice.login("username", "secretpass")[0]

Now I have the cookie in the unicode string "cookie"

Part 2 almost works with the following code:
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/local/lib/python2.3/site-packages/ZSI/client.py", line 28, in
__call__
requesttypecode=TC.Any(self.name, aslist=1))
File "/usr/local/lib/python2.3/site-packages/ZSI/client.py", line 143,
in RPC
return self.Receive(replytype, **kw)
File "/usr/local/lib/python2.3/site-packages/ZSI/client.py", line 286,
in Receive
raise FaultException(msg)
ZSI.FaultException: Denied access to method (upload) in class (main) at
/usr/lib/perl5/site_perl/5.8.0/SOAP/Lite.pm line 2128.


I reckon the problem is I do not explicitly create a
ZSI.TC.Base64String object of the base64 encoded string. I have been

yields the same error message.

Any ideas? In particular, how do I send base64 encoded data in the SOAP
message?

Cheers,

/Mickel
 
?

=?ISO-8859-1?Q?Mickel_Gr=F6nroos?=

[...]
2. Run an upload function with two parameters (string "fullpath" and
base64 encoded "filecontent") on another SOAP server adding the cookie to
the HTTP header being sent with the SOAP message
[...]Traceback (most recent call last):
[...]

I got this working by using Send() for sending the SOAP message calling
the upload command instead of using upload() directly:
.... ("/tmp/crap.txt", data),
.... nsdict={'ns1':'urn:Files'})
The success of the command can be tested like this:
.... except: print "failed"
....
1
The clue that solved the mystery was found here:

<http://www-106.ibm.com/developerworks/webservices/library/ws-pyth8.html>

/Mickel (over and out)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top