<div dir="ltr"><div class="gmail_extra">Hi Paul:</div><div class="gmail_extra"><br></div><div class="gmail_extra">You can see a proof of concept developed for Uruguay electronic invoicing webservice:</div><div class="gmail_extra"><br></div><div class="gmail_extra"><a href="https://github.com/reingart/py_efactura_uy/blob/master/prueba.py#L101">https://github.com/reingart/py_efactura_uy/blob/master/prueba.py#L101</a><br class=""><br>The relevant code would be:</div><div class="gmail_extra"><br></div><div class="gmail_extra"><div class="gmail_extra"><font face="monospace, monospace">from pysimplesoap.client import SoapClient</font></div><div class="gmail_extra"><font face="monospace, monospace">from pysimplesoap.wsse import BinaryTokenSignature</font></div><div class="gmail_extra"><font face="monospace, monospace"><br></font></div><div class="gmail_extra"><div class="gmail_extra"><span style="font-family:monospace,monospace">client = SoapClient(...</span><span style="font-family:monospace,monospace">)</span></div><div class="gmail_extra"><font face="monospace, monospace"><br></font></div></div></div><div class="gmail_extra"><div class="gmail_extra"><font face="monospace, monospace">plugin = BinaryTokenSignature(certificate="certificado.crt",</font></div><div class="gmail_extra"><font face="monospace, monospace">                              private_key="private.key", </font></div><div class="gmail_extra"><font face="monospace, monospace">                              password=None,</font></div><div class="gmail_extra"><font face="monospace, monospace">                              cacert="CorreoUruguayoCA.crt",</font></div><div class="gmail_extra"><font face="monospace, monospace">                              )</font></div><div class="gmail_extra"><font face="monospace, monospace">client.plugins += [plugin]</font><br></div><div class="gmail_extra"><br></div><div class="gmail_extra">Of course you'll have to change the certificate, private key and certification authority. You can use a password if the private key has a pass-phrase.</div><div class="gmail_extra">Then you can call remote methods as usual, both using "raw" arbitrary request or WSDL parsed methods, for more info see:</div><div class="gmail_extra"><br></div><div class="gmail_extra"><a href="https://code.google.com/p/pysimplesoap/wiki/SoapClient">https://code.google.com/p/pysimplesoap/wiki/SoapClient</a><br></div><div class="gmail_extra"><br></div>You're right, the Google Code wiki is not updated as it will be taken down, but I didn't have time to move it to GitHub yet. </div><div class="gmail_extra">But, you can download the latest development code (including WSSE support) from there:</div><div class="gmail_extra"><br></div><div class="gmail_extra"><a href="https://github.com/pysimplesoap/pysimplesoap">https://github.com/pysimplesoap/pysimplesoap</a><br></div><div class="gmail_extra"><br></div><div class="gmail_extra">Finally, compared to the suds, pysimplesoap implementation is more ad-hoc and you could easily debug it and adapt the xml generated or signing phase, if required (so far it should work out of the box, but I've seen at least a specific server that responds with a special xml canonicalization method/transformation that needs some work).</div><div class="gmail_extra">Also, the idea of pysimplesoap is to facilitate experimentation and learning from webservices internals, xml security, etc.</div><div class="gmail_extra"><br></div><div class="gmail_extra">In the other side, the suds plug-in seems to be using dm.xmlsec.binding (depending on XMLSec C library, that is very complex and include more dependencies, as far I could analyze) and PyOpenSSL (that is is a rather thin wrapper around (a subset of) the OpenSSL library, according their own documentation)</div><div class="gmail_extra">pysimplesoap uses just M2Crypto (that is more complete to PyOpenSSL but you'll have to check python3 experimental support if you need it, AFAIK). Note that lxml dependency is optional.</div><div class="gmail_extra">There is even a pure python implementation of a c14n.py module (canonicalization) in pysimplesoap (taken form others projects IIRC), that I'm trying to migrate to Python 3 and enhance, to avoid lxml dependency at all.<br></div><div class="gmail_extra"><br></div><div class="gmail_extra">Best regards </div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature">Mariano Reingart<br><a href="http://www.sistemasagiles.com.ar/" target="_blank">http://www.sistemasagiles.com.ar</a><br><a href="http://reingart.blogspot.com/" target="_blank">http://reingart.blogspot.com</a></div></div><div class="gmail_signature"><br></div><div class="gmail_quote">On Mon, Apr 27, 2015 at 12:06 PM, Paul Tomblin <span dir="ltr"><<a href="mailto:ptomblin@xcski.com" target="_blank">ptomblin@xcski.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">I need to talk to a web service that requires wsse:BinarySecurityToken, ds:Security, wsse:UsernameToken and wsu:Timestamp headers. I see that the latest version of pysimplesoap on <a href="http://python.org" target="_blank">python.org</a> has some sort of plugin architecture and a wsse.py for at least some of these headers, but I don't see any documentation on how to use them. The Google Code page doesn't have the wsse.py file, and so obviously nothing in their Wiki.<div><br></div><div>Can somebody point me to documentation or examples?</div><span class=""><font color="#888888"><div><br clear="all"><div><br></div>-- <br><div><a href="http://www.linkedin.com/in/paultomblin" target="_blank">http://www.linkedin.com/in/paultomblin</a><br><a href="http://careers.stackoverflow.com/ptomblin" target="_blank">http://careers.stackoverflow.com/ptomblin</a><br></div>
</div></font></span></div>
<br>_______________________________________________<br>
Soap mailing list<br>
<a href="mailto:Soap@python.org">Soap@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/soap" target="_blank">https://mail.python.org/mailman/listinfo/soap</a><br>
<br></blockquote></div><br></div></div>