source: TI12-security/trunk/python/Tests/xmlsec/WS-Security/wsClient.py @ 1465

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/python/Tests/xmlsec/WS-Security/wsClient.py@1465
Revision 1465, 1.5 KB checked in by pjkersha, 13 years ago (diff)

Added sign and verify to wsServer but problems with canonicalization causing verify error. This seems to be
due to attribute order differences. These shouldn't happen given the same canonicalization method for
signature and verification but the could be a problem with the way that the DOM code creates the nodes in
sign() ?

sing was added to server side code by overriding SOAPRequestHandler.do_POST and making a custom _Dispatch
function.

  • Property svn:executable set to *
Line 
1#!/usr/bin/env python
2
3import sys, socket
4from ZSI import Binding, TCcompound, TC
5from wsInterface import *
6import wsSecurity
7
8MESSAGE = "Hello from Python!"
9
10def main():
11   
12    # Signature handler object is passed to binding
13    signatureHandler = wsSecurity.SignatureHandler(\
14                                certFilePath='../../Junk-cert.pem',
15                                priKeyFilePath='../../Junk-key.pem',
16                                priKeyPwd=open('../../tmp2').read().strip())
17
18    binding = Binding(url='http://localhost:8080/wsServer.py',
19                      sig_handler=signatureHandler)
20                 
21    echoRequest = echoRequestWrapper()
22    echoRequest._message = MESSAGE
23   
24    import pdb;pdb.set_trace()
25    print ' Sending: %s' % MESSAGE
26   
27    try:
28        txResp = binding.Send(None, 
29                 'echo', 
30                 echoRequest,
31                 encodingStyle="http://schemas.xmlsoap.org/soap/encoding/")
32   
33        rxResp = binding.Receive(echoResponseWrapper(), 
34                 encodingStyle="http://schemas.xmlsoap.org/soap/encoding/")
35
36    except socket.error, (errNum, errMsg):
37        print >>sys.stderr, "Socket error: %s" % errMsg
38        sys.exit(1)
39       
40    if not isinstance(rxResp, echoResponse) and \
41       not issubclass(echoResponse, rxResp.__class__):
42        print >>sys.stderr, "%s incorrect response type" % rxResp.__class__
43        sys.exit(1)
44
45    print 'Response: %s' % rxResp._message
46
47
48if __name__ == '__main__':
49    main()
Note: See TracBrowser for help on using the repository browser.