source: TI12-security/trunk/python/ndg.security.common/ndg/security/common/AttAuthority/AttAuthority_services.py @ 3832

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/python/ndg.security.common/ndg/security/common/AttAuthority/AttAuthority_services.py@3832
Revision 3832, 4.2 KB checked in by pjkersha, 12 years ago (diff)

Use extended version of ZSI.client.Binding to enable SOAP clients to see through HTTP proxies. Re-tested AA and SM unit tests.

ndg.security.common/ndg/security/common/zsi_utils/urllib2client.py: urllib2 version of ZSI.client.Binding class to enable clients to talk through HTTP proxies. This manifests in calls from RAL to other partner site services.

ndg.security.common/ndg/security/common/SessionMgr/Makefile,
ndg.security.common/ndg/security/common/AttAuthority/Makefile:
When generating stub substitute ZSI.client import with urllib2client for reasons of above.

  • Property svn:keywords set to Id
Line 
1##################################################
2# AttAuthority_services.py
3# generated by ZSI.generate.wsdl2python
4##################################################
5
6
7from AttAuthority_services_types import *
8import urlparse, types
9from ZSI.TCcompound import ComplexType, Struct
10from ndg.security.common.zsi_utils import urllib2client as client
11import ZSI
12from ZSI.generate.pyclass import pyclass_type
13
14# Locator
15class AttAuthorityServiceLocator:
16    AttAuthority_address = "http://localhost:5700"
17    def getAttAuthorityAddress(self):
18        return AttAuthorityServiceLocator.AttAuthority_address
19    def getAttAuthority(self, url=None, **kw):
20        return AttAuthorityBindingSOAP(url or AttAuthorityServiceLocator.AttAuthority_address, **kw)
21
22# Methods
23class AttAuthorityBindingSOAP:
24    def __init__(self, url, **kw):
25        kw.setdefault("readerclass", None)
26        kw.setdefault("writerclass", None)
27        # no resource properties
28        self.binding = client.Binding(url=url, **kw)
29        # no ws-addressing
30
31    # op: <ZSI.wstools.WSDLTools.Message instance at 0x84a3dec>
32    def getAttCert(self, userId,userCert,userAttCert):
33
34        request = getAttCertInputMsg()
35        request._userId = userId
36        request._userCert = userCert
37        request._userAttCert = userAttCert
38
39        kw = {}
40        # no input wsaction
41        self.binding.Send(None, None, request, soapaction="getAttCert", **kw)
42        # no output wsaction
43        response = self.binding.Receive(getAttCertOutputMsg.typecode)
44        attCert = response._attCert
45        msg = response._msg
46        return attCert,msg
47
48    # op: <ZSI.wstools.WSDLTools.Message instance at 0x84a812c>
49    def getHostInfo(self):
50
51        request = getHostInfoInputMsg()
52
53        kw = {}
54        # no input wsaction
55        self.binding.Send(None, None, request, soapaction="getHostInfo", **kw)
56        # no output wsaction
57        response = self.binding.Receive(getHostInfoOutputMsg.typecode)
58        hostname = response._hostname
59        aaURI = response._aaURI
60        aaDN = response._aaDN
61        loginURI = response._loginURI
62        loginServerDN = response._loginServerDN
63        loginRequestServerDN = response._loginRequestServerDN
64        return hostname,aaURI,aaDN,loginURI,loginServerDN,loginRequestServerDN
65
66    # op: <ZSI.wstools.WSDLTools.Message instance at 0x84a8d8c>
67    def getTrustedHostInfo(self, role):
68
69        request = getTrustedHostInfoInputMsg()
70        request._role = role
71
72        kw = {}
73        # no input wsaction
74        self.binding.Send(None, None, request, soapaction="getTrustedHostInfo", **kw)
75        # no output wsaction
76        response = self.binding.Receive(getTrustedHostInfoOutputMsg.typecode)
77        trustedHosts = response._trustedHosts
78        return trustedHosts
79
80    # op: <ZSI.wstools.WSDLTools.Message instance at 0x84a8f2c>
81    def getAllHostsInfo(self):
82
83        request = getAllHostsInfoInputMsg()
84
85        kw = {}
86        # no input wsaction
87        self.binding.Send(None, None, request, soapaction="getAllHostsInfo", **kw)
88        # no output wsaction
89        response = self.binding.Receive(getAllHostsInfoOutputMsg.typecode)
90        hosts = response._hosts
91        return hosts
92
93    # op: <ZSI.wstools.WSDLTools.Message instance at 0x84b20cc>
94    def getX509Cert(self):
95
96        request = getX509CertInputMsg()
97
98        kw = {}
99        # no input wsaction
100        self.binding.Send(None, None, request, soapaction="getX509Cert", **kw)
101        # no output wsaction
102        response = self.binding.Receive(getX509CertOutputMsg.typecode)
103        x509Cert = response._x509Cert
104        return x509Cert
105
106getAttCertInputMsg = ns0.getAttCert_Dec().pyclass
107
108getAttCertOutputMsg = ns0.getAttCertResponse_Dec().pyclass
109
110getHostInfoInputMsg = ns0.getHostInfo_Dec().pyclass
111
112getHostInfoOutputMsg = ns0.getHostInfoResponse_Dec().pyclass
113
114getTrustedHostInfoInputMsg = ns0.getTrustedHostInfo_Dec().pyclass
115
116getTrustedHostInfoOutputMsg = ns0.getTrustedHostInfoResponse_Dec().pyclass
117
118getAllHostsInfoInputMsg = ns0.getAllHostsInfo_Dec().pyclass
119
120getAllHostsInfoOutputMsg = ns0.getAllHostsInfoResponse_Dec().pyclass
121
122getX509CertInputMsg = ns0.getX509Cert_Dec().pyclass
123
124getX509CertOutputMsg = ns0.getX509CertResponse_Dec().pyclass
Note: See TracBrowser for help on using the repository browser.