soaplib + https

78 views
Skip to first unread message

Carlos Ble

unread,
May 16, 2008, 8:59:04 AM5/16/08
to soaplib.optio
Hi,
First of all, congratulations for soaplib, it works very good for me
so far :-)
I've modified the client.py in version 0.7.2 rc27 to support HTTPS and
I have it working.

On the server side, you only need the lines below in order to have it
running on https:
server = CherryPyWSGIServer(('localhost' ,17777), MyService())
server.ssl_private_key = '/fullpath/file.key'
server.ssl_certificate = '/fullpath/file.pem'
server.start()

On the client side, given the patch attached you'd call the service
like this:
self.clientInfoService = make_service_client('localhost:17777/',
MyService(), https=True)

Patch: cat client.py.0.7.2r27.diff

76c76
< def __init__(self,host,path,descriptor):
---
> def __init__(self,host,path,descriptor, https):
84a85
> self.https = https
132c133,137
< conn = httplib.HTTPConnection(self.host)
---
> if self.https:
> conn = httplib.HTTPSConnection(self.host)
> else:
> conn = httplib.HTTPConnection(self.host)
>
173c178
< def __init__(self,host,path,server_impl):
---
> def __init__(self,host,path,server_impl, https):
179c184
<
setattr(self,method.name,SimpleSoapClient(host,path,method))
---
> setattr(self,method.name,SimpleSoapClient(host,path,method, https))
181c186
< def make_service_client(url,impl):
---
> def make_service_client(url,impl,https=False):
183c188
< return ServiceClient(host,path,impl)
---
> return ServiceClient(host,path,impl, https)


Cheers ! :-)

Aaron Bickell

unread,
May 16, 2008, 11:52:31 AM5/16/08
to soapli...@googlegroups.com
Great, I'll take a look at it. Thanks for the patch.

Aaron

Edward Mao

unread,
May 31, 2008, 11:53:35 PM5/31/08
to soaplib.optio
Another thought would be to have in make_service_client, a line that
says:

if self.url.startswith('https'):
return ServiceClient(host,path,impl,https=True)
else:
return ServiceClient(host,path,impl)

I had originally tried replacing client.py:132 with "if
self.url.startswith('https')", but found out that split_url strips the
"https" away.
Reply all
Reply to author
Forward
0 new messages