Thread: Python And Soap

Page 1 of 2 12 Last
  • Jump to page:
    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Location
    Yuma,AZ
    Posts
    11
    Rep Power
    0

    Python And Soap


    Because I'm sleeping entirely too much lately, I've decided to pick up a new skill and code some worthless Python modules while I'm at it (I'm picking a semi interesting Perl module off of CPAN and implementing it in Python. PyPI needs to grow).

    Are there any decent Python SOAP modules out there? I know PythonWare used to have one but they don't have it on there page any more.

    I'd prefer one that is at least relatively stable. No Pre-Alpha (which seemed to be all I could find when I googled around for it)

    -rag
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Posts
    35
    Rep Power
    11
    Theres an article on IBM Developerworks covering a few implementations, PySOAP is one, SOAPpy another. I think 4Suite has one.

    One of the more robust and I believe commonly used implemenations has a SF page (sf.net is down, and I can't recall the URL--I think its the pywsdl project?), but when I looked at it a while back I found code in CVS to be confusing, as the project merged a few SOAP related projects into one recently, I believe. To be honest, I couldn't make heads nor tails of it with a quick 15 minute glance through the repository, much of the documentation seemed to be out of date or lacking, though I'm certain they've probably changed much of that since I last looked at it (months, admittedly).

    I did see a link to this in the Python mailing list a while back: http://interview-machine.com/soap/. I've looked at it just a wee bit but it seemed more straightforward to me.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2001
    Location
    Houston, TX
    Posts
    383
    Rep Power
    13
    I don't remember where we got our SOAP module from, but the IRC bot project that I code on has its SOAP.py in CVS and can be seen here.
    Debian - because life's too short for worrying.
    Best. (Python.) IRC bot. ever.
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2003
    Posts
    25
    Rep Power
    0
    I was reading over the python cookbook and remembered that OSE (http://ose.sourceforge.net/) provides a rather easy SOAP API. Good Luck.
  8. #5
  9. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    Using SOAP from Python you've gotta like the SOAPy project. Its small, and seems to be very easy to use (but i havn't done much with it yet), definatly worth a look though

    http://sourceforge.net/projects/soapy

    Theres a pretty nice SOAP module that comes with PyGoogle although i'm not sure if this is the one from pythonware.com or another project?

    Mark.
    programming language development: www.netytan.com Hula

  10. #6
  11. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    a little info for anyone interested in this subject.. anyway theres a nice little article on OnLamp that shows just how powerful mixing python and SOAP can be!!!!

    http://www.onlamp.com/pub/a/python/2...14/pysoap.html

    Mark.
    programming language development: www.netytan.com Hula

  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2004
    Posts
    10
    Rep Power
    0
    Hi,

    Are there any good resources on how to write your own soap module?

    I would use modules that are already written but i want to learn exactly how it works.

    Thanks!
  14. #8
  15. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    Not that i know of... your best bet would be to look at how SOAP works in general and of course download some of the existing modules and picking though their code!

    Mark.
    programming language development: www.netytan.com Hula

  16. #9
  17. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Posts
    35
    Rep Power
    11
    Originally posted by JuiceMan
    Hi,

    Are there any good resources on how to write your own soap module?

    I would use modules that are already written but i want to learn exactly how it works.

    Thanks!
    Starting with the SOAP spec would be your best bet: http://www.w3.org/2000/xp/Group/

    If you can make it through that, you'll see why there are a few unfinished or incomplete SOAP modules floating around ;-)
  18. #10
  19. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2004
    Posts
    10
    Rep Power
    0
    Cant you just send a HTTP request using Python's internet API to send the soap server the header and body?

    Like using:
    req = HTTP("***")
    req.putrequest("POST", ****")
    req.putheader("Accept", "text/xml; charset=utf-8")
    req.putheader("Content-Legth", str(len(postdata)))
    req.putheade("SOAPAction", "*****")
    req.endheaders()

    then sending off the xml body?

    To me, it seems like that would work but i guess there are a lot more to it.

    Gotta go read up on some more soap...
  20. #11
  21. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Posts
    35
    Rep Power
    11
    Yeah, you can do that. I've done this for one project we worked on that just needed a single call to a JMS server. Rather than mess around with an XML library as well, we used string formatting to create the packet. It made the code *much* shorter.

    Its just not as "pretty" or as usable as a module would be though. Writing a module that conforms to all ofthe SOAP specs and handles stuff like WSDL is a little bit harder.
  22. #12
  23. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2004
    Posts
    10
    Rep Power
    0
    does that body have to be encoded in some way or can you just send off a variable with string formatted.

    req.send(postdata)

    i just assigned the long string(which is the xml in soap's envelop) to "postdata" and sent it off as above. I received a response but had an "The root element is missing" error.

    Thanks!
  24. #13
  25. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2004
    Posts
    10
    Rep Power
    0
    any help would be much appreciated, oxygenthief.
  26. #14
  27. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2004
    Posts
    10
    Rep Power
    0
    i used "req.send(postdata)" to send off my body, is that what you used to send off the SOAP message?? I think i might be wrong on that one...postdata is my soap message.



    # Send SOAP body
    req.send(postdata)


    ec, em, h = req.getreply()
    print "\n*************************** HTTP RESPONSE **********************************"
    print ec, em

    print "\n*************************** HTTP HEADER RESPONSE ***************************"
    print h

    # get file-like object from HTTP response
    # and print received HTML to screen
    fd = req.getfile()
    textlines = fd.read()
    fd.close()

    print "\n************************** INCOMING SOAP ***********************************"
    print textlines
  28. #15
  29. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Posts
    35
    Rep Power
    11
    I'm not sure what context req is being used in exactly. The project I worked on, we used httplib and created our own header file, and contents. Lemme see if I can dig it up and give you an example. Sorry for the late reply, I just formatted my primary computer and put slackware on it. Finally got mail working and saw this thread had some movement.
Page 1 of 2 12 Last
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo