|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
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
|
|||
|
|||
|
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. |
|
#3
|
|||
|
|||
|
|
|
#4
|
|||
|
|||
|
I was reading over the python cookbook and remembered that OSE (http://ose.sourceforge.net/) provides a rather easy SOAP API. Good Luck.
|
|
#5
|
||||
|
||||
|
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. |
|
#6
|
||||
|
||||
|
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/.../14/pysoap.html Mark. |
|
#7
|
|||
|
|||
|
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! |
|
#8
|
||||
|
||||
|
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. |
|
#9
|
|||
|
|||
|
Quote:
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 ;-) |
|
#10
|
|||
|
|||
|
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... |
|
#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. |
|
#12
|
|||
|
|||
|
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! |
|
#13
|
|||
|
|||
|
any help would be much appreciated, oxygenthief.
|
|
#14
|
|||
|
|||
|
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 |
|
#15
|
|||
|
|||
|
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.
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > Python And Soap |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|