The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages
> Python Programming
|
Python And Soap
Discuss Python And Soap in the Python Programming forum on Dev Shed. Python And Soap Python Programming forum discussing coding techniques, tips and tricks, and Zope related information. Python was designed from the ground up to be a completely object-oriented programming language.
|
|
 |
|
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

December 30th, 2003, 12:43 PM
|
|
Junior Member
|
|
Join Date: Aug 2003
Location: Yuma,AZ
Posts: 11
Time spent in forums: < 1 sec
Reputation 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
|

December 30th, 2003, 05:09 PM
|
|
Contributing User
|
|
Join Date: Nov 2003
Posts: 35
Time spent in forums: < 1 sec
Reputation Power: 10
|
|
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.
|

January 2nd, 2004, 11:57 AM
|
|
Contributing User
|
|
Join Date: Dec 2001
Location: Houston, TX
Posts: 383
Time spent in forums: 1 h 41 m 27 sec
Reputation Power: 12
|
|
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.
|

January 2nd, 2004, 01:49 PM
|
|
Registered User
|
|
Join Date: Apr 2003
Posts: 25
Time spent in forums: < 1 sec
Reputation 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.
|

January 2nd, 2004, 04:10 PM
|
 |
Hello World :)
|
|
Join Date: Mar 2003
Location: Hull, UK
|
|
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
|

January 5th, 2004, 06:24 PM
|
 |
Hello World :)
|
|
Join Date: Mar 2003
Location: Hull, UK
|
|
|

January 6th, 2004, 03:59 PM
|
|
Registered User
|
|
Join Date: Jan 2004
Posts: 10
Time spent in forums: < 1 sec
Reputation 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!
|

January 6th, 2004, 04:20 PM
|
 |
Hello World :)
|
|
Join Date: Mar 2003
Location: Hull, UK
|
|
|
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.
|

January 6th, 2004, 05:09 PM
|
|
Contributing User
|
|
Join Date: Nov 2003
Posts: 35
Time spent in forums: < 1 sec
Reputation Power: 10
|
|
Quote: 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 ;-)
|

January 7th, 2004, 11:07 AM
|
|
Registered User
|
|
Join Date: Jan 2004
Posts: 10
Time spent in forums: < 1 sec
Reputation 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...
|

January 7th, 2004, 11:46 AM
|
|
Contributing User
|
|
Join Date: Nov 2003
Posts: 35
Time spent in forums: < 1 sec
Reputation Power: 10
|
|
|
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.
|

January 7th, 2004, 12:52 PM
|
|
Registered User
|
|
Join Date: Jan 2004
Posts: 10
Time spent in forums: < 1 sec
Reputation 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!
|

January 8th, 2004, 10:40 AM
|
|
Registered User
|
|
Join Date: Jan 2004
Posts: 10
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
any help would be much appreciated, oxygenthief.
|

January 8th, 2004, 12:02 PM
|
|
Registered User
|
|
Join Date: Jan 2004
Posts: 10
Time spent in forums: < 1 sec
Reputation 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
|

January 9th, 2004, 01:06 PM
|
|
Contributing User
|
|
Join Date: Nov 2003
Posts: 35
Time spent in forums: < 1 sec
Reputation Power: 10
|
|
|
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.
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|