Recently, a module of a PHP project needs to be implemented in Python and isolated.
In the PHP code, found that the use of the SOAP protocol, did not touch before, checked, is a relatively old protocol, to achieve data communication. (It's basically an API for the HTTP protocol)
Post a SOAP introduction: http://www.ibm.com/developerworks/cn/xml/x-sisoap/
Baidu Search, Python has a sapppy implementation of the SOAP protocol, you can implement the server and the client. (There may be other better, I have tried, feel enough to use this first)
1. Site
https://pypi.python.org/pypi/SOAPpy/
2. Download
Https://pypi.python.org/packages/source/S/SOAPpy/SOAPpy-0.12.22.zip
3. Installation
the environment I'm using is centos6.2.
installation is also very simple
Unzip Soappy-0.12.22.zippython setup.py buildpython setup.py Install installation Complete, you can enter the Python command line,>>> import Soappy If you do not call the police, the installation is complete
4. Simple Test
I refer to the example of the official website in the terminal environment ran a bit, very smooth, successful.
server-side:
Finished processing dependencies for Soappy==0.12.22[[email protected] soappy-0.12.22]# Pythonpython 2.6.6 (r266:84292, Jan, 09:42:36) [GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on Linux2type "help", "copyright", "credits" or "license" fo R more information.>>> import soappy>>> def hello (): ... Return "Hello World." ... >>> server = Soappy.soapserver (("0.0.0.0", 9096)) >>> server.registerfunction (hello) >> > Server.serve_forever ()
Client:
[Email protected] ~]# Pythonpython 2.6.6 (r266:84292, Jan, 09:42:36) [GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on Li Nux2type "Help", "copyright", "credits" or "license" for more information.>>> import soappy>>> server = Soappy.soapproxy ("http://localhost:9096/") >>> print Server.hello () Hello world.
Soappy Simple Trial