Which is the most mature Soap module?

Discussion in 'Python' started by =?ISO-8859-1?Q?Mickel_Gr=F6nroos?=, Jun 1, 2004.

  1. 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

    --
    Mickel Grönroos, application specialist, linguistics, Research support, CSC
    PL 405 (Tekniikantie 15 a D), 02101 Espoo, Finland, phone +358-9-4572237
    CSC is the Finnish IT center for science, www.csc.fi
     
    =?ISO-8859-1?Q?Mickel_Gr=F6nroos?=, Jun 1, 2004
    #1
    1. Advertising

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

    John J. Lee Guest

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

    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
     
    John J. Lee, Jun 1, 2004
    #2
    1. Advertising

  3. 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 <> 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
     
    =?ISO-8859-1?Q?Mickel_Gr=F6nroos?=, Jun 4, 2004
    #3
  4. =?ISO-8859-1?Q?Mickel_Gr=F6nroos?=

    John J Lee Guest

    On Fri, 4 Jun 2004, [ISO-8859-1] Mickel Grönroos wrote:

    > 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
     
    John J Lee, Jun 4, 2004
    #4
  5. On Fri, 4 Jun 2004, John J Lee wrote:

    > > 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.


    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

    --
    Mickel Grönroos, application specialist, linguistics, Research support, CSC
    PL 405 (Tekniikantie 15 a D), 02101 Espoo, Finland, phone +358-9-4572237
    CSC is the Finnish IT center for science, www.csc.fi
     
    =?ISO-8859-1?Q?Mickel_Gr=F6nroos?=, Jun 4, 2004
    #5
  6. =?ISO-8859-1?Q?Mickel_Gr=F6nroos?=

    John J Lee Guest

    On Fri, 4 Jun 2004, [ISO-8859-1] Mickel Grönroos wrote:

    > On Fri, 4 Jun 2004, John J Lee wrote:
    >
    > > > 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.

    >
    > 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'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.

    [...]

    Right.


    John
     
    John J Lee, Jun 4, 2004
    #6
  7. 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:

    >>> import base64
    >>> data = base64.encodestring("the crap to upload")
    >>> uploadservice.upload("/tmp/crap.txt", data)

    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
    reading the docs of ZSI at <http://pywebsvcs.sourceforge.net/zsi.html> but
    can't figure it out. Doing:

    >>> base64data = ZSI.TC.Base64String("filecontent", default=data)
    >>> uploadservice.upload("/tmp/crap.txt", base64data)


    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?=, Jun 8, 2004
    #7
  8. On Tue, 8 Jun 2004, Mickel Grönroos wrote:

    > [...]
    > 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
    > [...]
    > >>> import base64
    > >>> data = base64.encodestring("the crap to upload")
    > >>> uploadservice.upload("/tmp/crap.txt", data)

    > 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:

    >>> uploadservice.Send(None, 'ns1:upload',

    .... ("/tmp/crap.txt", data),
    .... nsdict={'ns1':'urn:Files'})
    >>>


    The success of the command can be tested like this:

    >>> try: uploadservice.Receive()

    .... 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)
     
    =?ISO-8859-1?Q?Mickel_Gr=F6nroos?=, Jun 8, 2004
    #8
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mitja Trampus
    Replies:
    0
    Views:
    497
    Mitja Trampus
    Jun 22, 2006
  2. Aubrey Hutchison

    Test if IDLE is a mature program

    Aubrey Hutchison, Dec 31, 2003, in forum: Python
    Replies:
    15
    Views:
    458
    Brian Kelley
    Jan 6, 2004
  3. Chetan Gadgil

    RE: Which is the most mature Soap module?

    Chetan Gadgil, Jun 4, 2004, in forum: Python
    Replies:
    0
    Views:
    478
    Chetan Gadgil
    Jun 4, 2004
  4. Guch Wu
    Replies:
    34
    Views:
    987
    Earl Purple
    Jun 5, 2006
  5. Buzz Lightyear

    How to give a mature module design.

    Buzz Lightyear, Mar 13, 2009, in forum: C++
    Replies:
    7
    Views:
    348
    Ian Collins
    Mar 20, 2009
Loading...

Share This Page