RosesDurden / pysimplesoap

Automatically exported from code.google.com/p/pysimplesoap
0 stars 0 forks source link

Accessing SOAP service with Client certificates #45

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Pysimplesoap.client.SoapClient could not connect a SOAP service, which requires 
the use of client certificates, due to obvious lack of a certificate parameter.

Using httplib2 directly I could retrieve data from the service.

h2 = httplib2.Http()
h2.add_certificate('c.pem','s.pem','someservice.xyz')
url = "https://someservice.xyz/public.asmx?wsdl"
content = h2.request(url,"GET")

Since httplib2 works and is supported by SoapClient, I decided to patch the 
source (patched client.py attached to this report).

SoapClient now takes tree new parameters (clientpem, serverpem and ssldomain) 
and if you're using httplib2 it creates a SSL connection with client 
certificates.

I left all the modifications inside client.py since I only use httplib2, but it 
might be smart to move all parameters into __init__ of various HttpTransports 
and configure each accordingly. 

Sidenote: I started using pysimplesoap only because every other library is even 
more complicated with client certificates. It is a real issue (just check 
stackoverflow on 1001 way of semi solving this problem) and perhaps it might be 
smart if support for client certificates was more developed (ie - directly from 
SoapClient, with all three different libraries).

PS: @reingart, thanks for swift answer.

Original issue reported on code.google.com by luka.bi...@gmail.com on 25 Jan 2012 at 9:17

Attachments:

GoogleCodeExporter commented 8 years ago
Thanks for the patch, it is really simple.

I'll try to move it to transport.py, I guess at least pycurl support it too.

Original comment by reingart@gmail.com on 25 Jan 2012 at 2:44

GoogleCodeExporter commented 8 years ago
My stab at the implementation.

Implements it in transport.py. Reuse the (unused) cert argument to SoapClient() 
and add new arguments to the HttpTransports abstraction. Did not try pycurl 
yet. httplib2 works fine here. I dropped the ssldomain argument and made 
httplib2 use the client cert always, because you usually speak to just one 
system with one SoapClient anyway.

Original comment by herrsa...@googlemail.com on 15 Mar 2012 at 2:38

Attachments:

GoogleCodeExporter commented 8 years ago
Thank you!
Could you make a patch (diff), and if possible, a test case.

Also, if you want, I can give you commit access (I'm on vacation now, so you 
could apply the patch directly)

Original comment by reingart@gmail.com on 16 Mar 2012 at 8:10

GoogleCodeExporter commented 8 years ago
The diff is already attached to this case :-)

I do not have experience in the whole unittest business to be honest. I can't 
even get them to run

wlan-pc@wlanpc:~/pysimplesoap$ python -m unittest discover

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK

I would feel more comfortable if you checked the code and commited it yourself. 
I don't think it's that urgent.

Original comment by herrsa...@googlemail.com on 16 Mar 2012 at 8:35

GoogleCodeExporter commented 8 years ago
Hello, 
I am struggling to create a minimal Soap Server exposing a function over https 
and a corresponding Client. Could you provide an example ? Thanks 

Original comment by marcopag...@gmail.com on 20 May 2013 at 7:28

GoogleCodeExporter commented 8 years ago
Hi marcopagliarella, 

Soap Server is documented in the wiki

https://code.google.com/p/pysimplesoap/wiki/SoapServer

https://code.google.com/p/pysimplesoap/wiki/WSGIServer

Please, if you can, open a new issue detailing your problem, as this one is 
about clients.

Original comment by reingart@gmail.com on 30 May 2013 at 3:35