Having generated SRMServerV1_services.py via 'wsdl2py -bu http://castor.web.cern.ch/castor/DIST/CERN/savannah/SRMv11.pkg/WSDL/srm.v1.1.wsdl', I now have the following test script:
## Derived from http://pywebsvcs.sourceforge.net/cookbook.pdf
import SRMServerV1_services as S
from socket import sslerror
# get a port proxy instance
loc = S.SRMServerV1Locator()
port = loc.getISRM(...) [SERVER DETAILS NOT SUPPLIED]
# create a new request
req = S.ping3In()
##req = S.put0In()
# call the remote method
resp = port.ping(req)
##resp = port.put(req)
# print the result
print resp
Executing the above code results in the following error:
Traceback (most recent call last):
File "zsi.py", line 14, in <module>
resp = port.ping(req)
File "/home/csf/castorop/srm/SRMServerV1_services.py", line 73, in ping
self.binding.Send(None, None, request, soapaction="ping", encodingStyle="http://schemas.xmlsoap.org/soap/encoding/", **kw)
File "/usr/local/lib/python2.5/site-packages/ZSI-2.0-py2.5.egg/ZSI/client.py", line 266, in Send
File "/usr/local/lib/python2.5/httplib.py", line 1131, in connect
ssl = socket.ssl(sock, self.key_file, self.cert_file)
File "/usr/local/lib/python2.5/socket.py", line 74, in ssl
return _realssl(sock, keyfile, certfile)
socket.sslerror: (8, 'EOF occurred in violation of protocol')
I have searched many web pages for a solution to this problem but there doesn't seem to be a clear fix: the fault may well lie at the SRM server end but I am unable to change that.
Does anyone know of a fix or work-around that can be used with ZSI? Alternatively, is there another Python SOAP package that I can use that avoid this problem? SOAP.py gives the same error.
Thanks ...
Richard Prosser
Logged In: YES
user_id=599403
Originator: YES
I forgot to mention that I used Python 2.5.1 on Linux SL3.
Logged In: YES
user_id=711889
Originator: NO
Richard,
I can't tell you exactly what this is, but I can offer a few suggestions for trying to debug it. If you can get access to the server logs, there might be more useful information there. Since the EOF is occuring during the connect, it is fairly likely that the server is unhappy about something it has received.
Another thing to try is using the openssl s_client command line tool. You can run: openssl s_client -debug -cert [certFile] -key [keyFile]] -connect host:port, if that fails in the same way, the extra debug output may help. If that works, then you are probably going to need to switch to using M2Crypto for the underlying ssl connection. I believe you can do this by editing client.py to change the defaultHttpsTransport variable from httplib.HTTPConnection to M2Crypto.httpslib.HTTPSConnection. I haven't tried this recently, so it may require a few other small tweaks to make it work.
--keith