Hi,
I am looking for a python SOAP 1.2 client but it seems that it does not exist . All of the existing clients are either not maintainted or only compatible with SOAP 1.1:
- suds
- SOAPpy
- ZSI
Hi,
I am looking for a python SOAP 1.2 client but it seems that it does not exist . All of the existing clients are either not maintainted or only compatible with SOAP 1.1:
WSF/Python is supporting SOAP 1.2.
INTRODUCTION
WSF/Python is the Python language extension to WSO2 WSF/C [http://www.wso2.org/projects/wsf/c]. This version enables you to consume/provide Web Services both with REST and SOAP.
- Support for REST
- Support for SOAP 1.1
- Support for SOAP 1.2
For downloading, you don't have to register. Just click "submit" at the very bottom.
Samples can be found within the downloaded archive, eg:
LOG_DIR = '/tmp/'
LOG_LEVEL = 4
WSFC_HOME = '/opt/wso2/wsf_c'
END_POINT = 'http://localhost:9090/axis2/services/echo/echoString'
if __name__ == '__main__':
message = """
<ns1:echoString xmlns:ns1="http://ws.apache.org/axis2/services/echo">
<text>Hello World!</text>
</ns1:echoString>
"""
try:
client = wso2.wsf.WSClient({
'to':END_POINT,
'WSF_LOG_DIR':LOG_DIR,
'WSF_LOG_LEVEL':LOG_LEVEL,
'WSFC_HOME':WSFC_HOME,
})
print 'Sending: ' + message
response = client.request(message)
if response is not None:
print 'Respose: ' + response + '\n'
else:
print 'Error occurred!'
except wso2.wsf.WSFault, e:
print 'Exception occurred:'
print e
If you are really wanting to use SOAP 1.2 even though it is not used as a standard as yet, I reckon I can post an answer that requires some work (all for the greater good :)
).
I recommend that you use gSOAP:
gSOAP - a easy-use, cross-platform toolkit for C/C++ lovers to develop XML-based Web services and XML parsers. Although it is well-known as a Web service development toolkit and has been proved its good performance, it can also be used to create high-performance XML parsers, serializers and deserializers from XML schemas or C/C++ structs/classes. My experimental results demonstrate that the XML parsers generated using gSOAP toolkit run several times faster than xerces-c parsers in either DOM or SAX mode.
Now, I wish it were that easy. Due to gSOAP being a C++ library, you are going to have to wrap it to be able to use it in Python.
One way of wrapping the library is to use a tool by the name of SWIG (Simplified Wrapper and Interface Generator). This tool automatically wraps C/C++ libraries for use in high level languages, for example (you guessed it) Python.
I also recommend you read this PDF file (from page 14) on implementing gSOAP with C++. It is very helpful.
Using this solution, you can utilize a well looked after library, SOAP 1.2 and a very nice performance ratio. I think you will be quite happy with the results.
I have had the very similar problem some years ago and I have solved it by using Jython.
If there is no existed implementation of SOAP 1.2 for Python, you may be interested in Jython, which seamlessly integrates you with the Java platform. It means, you can use any of the existed SOAP 1.2 Java classes and just import it into your Jython program. Your Jython program is just your Python program, but you can import Java classes.
Jython itself includes almost all of the modules in the standard Python programming language distribution, but be sure that your program does not use any special non-standard Python library.
Example: say, you have Jython installed (it is free and Open Source) and your Python program is called myprog.py and you want use Java class CLASSNAME:
1) import required Java class inserting import CLASSNAME
into your myprog.py
2) run jython myprog.py